diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-09 03:09:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-09 03:09:42 +0300 |
commit | 77914793a349059bf523b131fc925b34349d6884 (patch) | |
tree | e21ee34216768d49a3309c453a444b5e29675a78 /app | |
parent | cb36ae7dd5fde175f8a24bfa97b20e9b2e2058bf (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/jira_connect/components/app.vue | 13 | ||||
-rw-r--r-- | app/assets/javascripts/jira_connect/index.js | 18 | ||||
-rw-r--r-- | app/assets/stylesheets/framework/tables.scss | 43 | ||||
-rw-r--r-- | app/models/approval.rb | 2 | ||||
-rw-r--r-- | app/models/ci/build.rb | 12 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 2 | ||||
-rw-r--r-- | app/models/dependency_proxy.rb | 2 | ||||
-rw-r--r-- | app/models/deployment.rb | 1 | ||||
-rw-r--r-- | app/models/project.rb | 13 | ||||
-rw-r--r-- | app/views/groups/dependency_proxies/_url.html.haml | 2 |
10 files changed, 61 insertions, 47 deletions
diff --git a/app/assets/javascripts/jira_connect/components/app.vue b/app/assets/javascripts/jira_connect/components/app.vue index 7b8b46cb048..490bf2fdd66 100644 --- a/app/assets/javascripts/jira_connect/components/app.vue +++ b/app/assets/javascripts/jira_connect/components/app.vue @@ -1,3 +1,16 @@ +<script> +export default { + name: 'JiraConnectApp', + computed: { + state() { + return this.$root.$data.state || {}; + }, + error() { + return this.state.error; + }, + }, +}; +</script> <template> <div></div> </template> diff --git a/app/assets/javascripts/jira_connect/index.js b/app/assets/javascripts/jira_connect/index.js index a7dc71ced1c..e7aa4c437bb 100644 --- a/app/assets/javascripts/jira_connect/index.js +++ b/app/assets/javascripts/jira_connect/index.js @@ -2,6 +2,15 @@ import Vue from 'vue'; import $ from 'jquery'; import App from './components/app.vue'; +const store = { + state: { + error: '', + }, + setErrorMessage(errorMessage) { + this.state.error = errorMessage; + }, +}; + /** * Initialize necessary form handlers for the Jira Connect app */ @@ -11,9 +20,11 @@ const initJiraFormHandlers = () => { }; const reqFailed = (res, fallbackErrorMessage) => { - const { responseJSON: { error } = {} } = res || {}; + const { responseJSON: { error = fallbackErrorMessage } = {} } = res || {}; + + store.setErrorMessage(error); // eslint-disable-next-line no-alert - alert(error || fallbackErrorMessage); + alert(error); }; AP.getLocation(location => { @@ -66,6 +77,9 @@ function initJiraConnect() { return new Vue({ el, + data: { + state: store.state, + }, render(createElement) { return createElement(App, {}); }, diff --git a/app/assets/stylesheets/framework/tables.scss b/app/assets/stylesheets/framework/tables.scss index 39d9e9a77f9..89713fdbbea 100644 --- a/app/assets/stylesheets/framework/tables.scss +++ b/app/assets/stylesheets/framework/tables.scss @@ -184,46 +184,3 @@ table { border-top: 0; } } - -.vulnerability-list { - @media (min-width: $breakpoint-sm) { - .checkbox { - padding-left: $gl-spacing-scale-4; - padding-right: 0; - width: 1px; - - + td, - + th { - padding-left: $gl-spacing-scale-4; - } - } - - .detected { - width: 9%; - } - - .status { - width: 8%; - } - - .severity { - width: 10%; - } - - .description { - max-width: 0; - } - - .identifier { - width: 16%; - } - - .scanner { - width: 10%; - } - - .activity { - width: 5%; - } - } -} diff --git a/app/models/approval.rb b/app/models/approval.rb index bc123de0b20..899ea466315 100644 --- a/app/models/approval.rb +++ b/app/models/approval.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class Approval < ApplicationRecord + include CreatedAtFilterable + belongs_to :user belongs_to :merge_request diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 9babae41751..abf7822ac6f 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -190,6 +190,8 @@ module Ci scope :with_coverage, -> { where.not(coverage: nil) } + scope :for_project, -> (project_id) { where(project_id: project_id) } + acts_as_taggable add_authentication_token_field :token, encrypted: :optional @@ -535,6 +537,7 @@ module Ci strong_memoize(:variables) do Gitlab::Ci::Variables::Collection.new .concat(persisted_variables) + .concat(dependency_proxy_variables) .concat(job_jwt_variables) .concat(scoped_variables) .concat(job_variables) @@ -583,6 +586,15 @@ module Ci end end + def dependency_proxy_variables + Gitlab::Ci::Variables::Collection.new.tap do |variables| + break variables unless Gitlab.config.dependency_proxy.enabled + + variables.append(key: 'CI_DEPENDENCY_PROXY_USER', value: ::Gitlab::Auth::CI_JOB_USER) + variables.append(key: 'CI_DEPENDENCY_PROXY_PASSWORD', value: token.to_s, public: false, masked: true) + end + end + def features { trace_sections: true } end diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 77cca481647..3a5e745ed2f 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -287,7 +287,7 @@ module Ci scope :for_branch, -> (branch) { for_ref(branch).where(tag: false) } scope :for_id, -> (id) { where(id: id) } scope :for_iid, -> (iid) { where(iid: iid) } - scope :for_project, -> (project) { where(project: project) } + scope :for_project, -> (project_id) { where(project_id: project_id) } scope :created_after, -> (time) { where('ci_pipelines.created_at > ?', time) } scope :created_before_id, -> (id) { where('ci_pipelines.id < ?', id) } scope :before_pipeline, -> (pipeline) { created_before_id(pipeline.id).outside_pipeline_family(pipeline) } diff --git a/app/models/dependency_proxy.rb b/app/models/dependency_proxy.rb index 510a304ff17..9cbaf7e9884 100644 --- a/app/models/dependency_proxy.rb +++ b/app/models/dependency_proxy.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true module DependencyProxy + URL_SUFFIX = '/dependency_proxy/containers' + def self.table_name_prefix 'dependency_proxy_' end diff --git a/app/models/deployment.rb b/app/models/deployment.rb index ad741366a74..bf229c2458f 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -37,6 +37,7 @@ class Deployment < ApplicationRecord end scope :for_status, -> (status) { where(status: status) } + scope :for_project, -> (project_id) { where(project_id: project_id) } scope :visible, -> { where(status: %i[running success failed canceled]) } scope :stoppable, -> { where.not(on_stop: nil).where.not(deployable_id: nil).success } diff --git a/app/models/project.rb b/app/models/project.rb index 7824f5610d4..27ef98834a8 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1960,6 +1960,7 @@ class Project < ApplicationRecord .concat(predefined_project_variables) .concat(pages_variables) .concat(container_registry_variables) + .concat(dependency_proxy_variables) .concat(auto_devops_variables) .concat(api_variables) end @@ -2011,6 +2012,18 @@ class Project < ApplicationRecord end end + def dependency_proxy_variables + Gitlab::Ci::Variables::Collection.new.tap do |variables| + break variables unless Gitlab.config.dependency_proxy.enabled + + variables.append(key: 'CI_DEPENDENCY_PROXY_SERVER', value: "#{Gitlab.config.gitlab.host}:#{Gitlab.config.gitlab.port}") + variables.append( + key: 'CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX', + value: "#{Gitlab.config.gitlab.host}:#{Gitlab.config.gitlab.port}/#{namespace.root_ancestor.path}#{DependencyProxy::URL_SUFFIX}" + ) + end + end + def container_registry_variables Gitlab::Ci::Variables::Collection.new.tap do |variables| break variables unless Gitlab.config.registry.enabled diff --git a/app/views/groups/dependency_proxies/_url.html.haml b/app/views/groups/dependency_proxies/_url.html.haml index 9242954b684..25a2442f4d4 100644 --- a/app/views/groups/dependency_proxies/_url.html.haml +++ b/app/views/groups/dependency_proxies/_url.html.haml @@ -1,4 +1,4 @@ -- proxy_url = "#{group_url(@group)}/dependency_proxy/containers" +- proxy_url = "#{group_url(@group)}#{DependencyProxy::URL_SUFFIX}" %h5.prepend-top-20= _('Dependency proxy URL') |