diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-09 18:09:34 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-09 18:09:34 +0000 |
commit | 141902c04943d5fb43c014b8cf42af60a3bc0cdf (patch) | |
tree | 7e5a31fe9b0434fa0071cb5d09273669c3a8acab /app | |
parent | 209bd8cf1f542f6ba2a069b368a9187faa871e96 (diff) | |
download | gitlab-ce-141902c04943d5fb43c014b8cf42af60a3bc0cdf.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
17 files changed, 75 insertions, 24 deletions
diff --git a/app/assets/javascripts/jira_import/components/jira_import_app.vue b/app/assets/javascripts/jira_import/components/jira_import_app.vue index 4b19c4d1b17..6efac949979 100644 --- a/app/assets/javascripts/jira_import/components/jira_import_app.vue +++ b/app/assets/javascripts/jira_import/components/jira_import_app.vue @@ -1,13 +1,25 @@ <script> import getJiraProjects from '../queries/getJiraProjects.query.graphql'; +import JiraImportSetup from './jira_import_setup.vue'; export default { name: 'JiraImportApp', + components: { + JiraImportSetup, + }, props: { + isJiraConfigured: { + type: Boolean, + required: true, + }, projectPath: { type: String, required: true, }, + setupIllustration: { + type: String, + required: true, + }, }, apollo: { getJiraImports: { @@ -18,11 +30,17 @@ export default { }; }, update: data => data.project.jiraImports, + skip() { + return !this.isJiraConfigured; + }, }, }, }; </script> <template> - <div></div> + <div> + <jira-import-setup v-if="!isJiraConfigured" :illustration="setupIllustration" /> + <div v-else></div> + </div> </template> diff --git a/app/assets/javascripts/jira_import/components/jira_import_setup.vue b/app/assets/javascripts/jira_import/components/jira_import_setup.vue new file mode 100644 index 00000000000..917930397f4 --- /dev/null +++ b/app/assets/javascripts/jira_import/components/jira_import_setup.vue @@ -0,0 +1,25 @@ +<script> +export default { + name: 'JiraImportSetup', + props: { + illustration: { + type: String, + required: true, + }, + }, +}; +</script> + +<template> + <div class="empty-state"> + <div class="svg-content"> + <img :src="illustration" :alt="__('Set up Jira Integration illustration')" /> + </div> + <div class="text-content d-flex flex-column align-items-center"> + <p>{{ __('You will first need to set up Jira Integration to use this feature.') }}</p> + <a class="btn btn-success" href="../services/jira/edit"> + {{ __('Set up Jira Integration') }} + </a> + </div> + </div> +</template> diff --git a/app/assets/javascripts/jira_import/index.js b/app/assets/javascripts/jira_import/index.js index a17313fd774..13b16b81c49 100644 --- a/app/assets/javascripts/jira_import/index.js +++ b/app/assets/javascripts/jira_import/index.js @@ -1,6 +1,7 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createDefaultClient from '~/lib/graphql'; +import { parseBoolean } from '~/lib/utils/common_utils'; import App from './components/jira_import_app.vue'; Vue.use(VueApollo); @@ -23,7 +24,9 @@ export default function mountJiraImportApp() { render(createComponent) { return createComponent(App, { props: { + isJiraConfigured: parseBoolean(el.dataset.isJiraConfigured), projectPath: el.dataset.projectPath, + setupIllustration: el.dataset.setupIllustration, }, }); }, diff --git a/app/assets/javascripts/pages/projects/prometheus/metrics/edit/index.js b/app/assets/javascripts/pages/projects/prometheus/metrics/edit/index.js new file mode 100644 index 00000000000..2fd047675b9 --- /dev/null +++ b/app/assets/javascripts/pages/projects/prometheus/metrics/edit/index.js @@ -0,0 +1,3 @@ +import customMetrics from '~/custom_metrics'; + +document.addEventListener('DOMContentLoaded', customMetrics); diff --git a/app/assets/javascripts/pages/projects/prometheus/metrics/new/index.js b/app/assets/javascripts/pages/projects/prometheus/metrics/new/index.js new file mode 100644 index 00000000000..2fd047675b9 --- /dev/null +++ b/app/assets/javascripts/pages/projects/prometheus/metrics/new/index.js @@ -0,0 +1,3 @@ +import customMetrics from '~/custom_metrics'; + +document.addEventListener('DOMContentLoaded', customMetrics); diff --git a/app/assets/stylesheets/pages/reports.scss b/app/assets/stylesheets/pages/reports.scss index 390ebd48685..56194f0af67 100644 --- a/app/assets/stylesheets/pages/reports.scss +++ b/app/assets/stylesheets/pages/reports.scss @@ -63,15 +63,6 @@ list-style: none; padding: 0 1px; margin: 0; - - .license-item { - line-height: $gl-padding-32; - - .license-packages { - font-size: $label-font-size; - } - - } } .report-block-list-icon { diff --git a/app/controllers/projects/import/jira_controller.rb b/app/controllers/projects/import/jira_controller.rb index b5adef399c7..ca427928d85 100644 --- a/app/controllers/projects/import/jira_controller.rb +++ b/app/controllers/projects/import/jira_controller.rb @@ -7,6 +7,7 @@ module Projects before_action :jira_integration_configured? def show + @is_jira_configured = @project.jira_service.present? return if Feature.enabled?(:jira_issue_import_vue, @project) unless @project.latest_jira_import&.in_progress? @@ -39,12 +40,13 @@ module Projects private def jira_import_enabled? - return if Feature.enabled?(:jira_issue_import, @project) + return if @project.jira_issues_import_feature_flag_enabled? redirect_to project_issues_path(@project) end def jira_integration_configured? + return if Feature.enabled?(:jira_issue_import_vue, @project) return if @project.jira_service flash[:notice] = _("Configure the Jira integration first on your project's %{strong_start} Settings > Integrations > Jira%{strong_end} page." % diff --git a/app/graphql/resolvers/projects/jira_imports_resolver.rb b/app/graphql/resolvers/projects/jira_imports_resolver.rb index 9f71d4f187e..b0784b3cdf7 100644 --- a/app/graphql/resolvers/projects/jira_imports_resolver.rb +++ b/app/graphql/resolvers/projects/jira_imports_resolver.rb @@ -14,7 +14,7 @@ module Resolvers end def authorized_resource?(project) - return false unless Feature.enabled?(:jira_issue_import, project) + return false unless project.jira_issues_import_feature_flag_enabled? Ability.allowed?(context[:current_user], :admin_project, project) end diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index 42771eaa82a..9ef3d64f21a 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -123,6 +123,7 @@ module Clusters scope :managed, -> { where(managed: true) } scope :with_persisted_applications, -> { eager_load(*APPLICATIONS_ASSOCIATIONS) } scope :default_environment, -> { where(environment_scope: DEFAULT_ENVIRONMENT) } + scope :with_management_project, -> { where.not(management_project: nil) } scope :for_project_namespace, -> (namespace_id) { joins(:projects).where(projects: { namespace_id: namespace_id }) } diff --git a/app/models/group_group_link.rb b/app/models/group_group_link.rb index 58c188369da..c233f59b1a6 100644 --- a/app/models/group_group_link.rb +++ b/app/models/group_group_link.rb @@ -13,6 +13,8 @@ class GroupGroupLink < ApplicationRecord validates :group_access, inclusion: { in: Gitlab::Access.all_values }, presence: true + scope :non_guests, -> { where('group_access > ?', Gitlab::Access::GUEST) } + def self.access_options Gitlab::Access.options_with_owner end diff --git a/app/models/project.rb b/app/models/project.rb index 1f968cdfad1..4cd92b119b4 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -786,6 +786,10 @@ class Project < ApplicationRecord Feature.enabled?(:context_commits, default_enabled: true) end + def jira_issues_import_feature_flag_enabled? + Feature.enabled?(:jira_issue_import, self) + end + def team @team ||= ProjectTeam.new(self) end @@ -968,7 +972,7 @@ class Project < ApplicationRecord end def jira_import? - import_type == 'jira' && latest_jira_import.present? && Feature.enabled?(:jira_issue_import, self) + import_type == 'jira' && latest_jira_import.present? && jira_issues_import_feature_flag_enabled? end def gitlab_project_import? diff --git a/app/models/project_group_link.rb b/app/models/project_group_link.rb index b4071c6d4a6..f1c491d1a05 100644 --- a/app/models/project_group_link.rb +++ b/app/models/project_group_link.rb @@ -3,11 +3,6 @@ class ProjectGroupLink < ApplicationRecord include Expirable - GUEST = 10 - REPORTER = 20 - DEVELOPER = 30 - MAINTAINER = 40 - belongs_to :project belongs_to :group @@ -18,6 +13,8 @@ class ProjectGroupLink < ApplicationRecord validates :group_access, inclusion: { in: Gitlab::Access.values }, presence: true validate :different_group + scope :non_guests, -> { where('group_access > ?', Gitlab::Access::GUEST) } + after_commit :refresh_group_members_authorized_projects alias_method :shared_with_group, :group @@ -27,7 +24,7 @@ class ProjectGroupLink < ApplicationRecord end def self.default_access - DEVELOPER + Gitlab::Access::DEVELOPER end def self.search(query) diff --git a/app/services/jira_import/start_import_service.rb b/app/services/jira_import/start_import_service.rb index fbbd2d883f0..134cef089e7 100644 --- a/app/services/jira_import/start_import_service.rb +++ b/app/services/jira_import/start_import_service.rb @@ -44,7 +44,7 @@ module JiraImport end def validate - return build_error_response(_('Jira import feature is disabled.')) unless Feature.enabled?(:jira_issue_import, project) + return build_error_response(_('Jira import feature is disabled.')) unless project.jira_issues_import_feature_flag_enabled? return build_error_response(_('You do not have permissions to run the import.')) unless user.can?(:admin_project, project) return build_error_response(_('Jira integration not configured.')) unless project.jira_service&.active? return build_error_response(_('Unable to find Jira project to import data from.')) if jira_project_key.blank? diff --git a/app/views/projects/import/jira/show.html.haml b/app/views/projects/import/jira/show.html.haml index cfc4baa1c25..6003f33f0ba 100644 --- a/app/views/projects/import/jira/show.html.haml +++ b/app/views/projects/import/jira/show.html.haml @@ -1,5 +1,7 @@ - if Feature.enabled?(:jira_issue_import_vue, @project) - .js-jira-import-root{ data: { project_path: @project.full_path } } + .js-jira-import-root{ data: { project_path: @project.full_path, + is_jira_configured: @is_jira_configured.to_s, + setup_illustration: image_path('illustrations/manual_action.svg') } } - else - title = _('Jira Issue Import') - page_title title diff --git a/app/views/projects/issues/import_csv/_button.html.haml b/app/views/projects/issues/import_csv/_button.html.haml index 0a352d26b0b..07c34b51037 100644 --- a/app/views/projects/issues/import_csv/_button.html.haml +++ b/app/views/projects/issues/import_csv/_button.html.haml @@ -1,6 +1,6 @@ - type = local_assigns.fetch(:type, :icon) -- if Feature.enabled?(:jira_issue_import, @project) +- if @project.jira_issues_import_feature_flag_enabled? .dropdown.btn-group %button.btn.rounded-right.text-center{ class: ('has-tooltip' if type == :icon), title: (_('Import issues') if type == :icon), data: { toggle: 'dropdown' }, 'aria-label' => _('Import issues'), 'aria-haspopup' => 'true', 'aria-expanded' => 'false' } diff --git a/app/workers/concerns/gitlab/jira_import/import_worker.rb b/app/workers/concerns/gitlab/jira_import/import_worker.rb index 169d3797b88..537300e6eba 100644 --- a/app/workers/concerns/gitlab/jira_import/import_worker.rb +++ b/app/workers/concerns/gitlab/jira_import/import_worker.rb @@ -26,7 +26,7 @@ module Gitlab def can_import?(project) return false unless project - return false if Feature.disabled?(:jira_issue_import, project) + return false unless project.jira_issues_import_feature_flag_enabled? project.latest_jira_import&.started? end diff --git a/app/workers/gitlab/jira_import/stage/start_import_worker.rb b/app/workers/gitlab/jira_import/stage/start_import_worker.rb index 1561ad90cc1..5b36feadbd1 100644 --- a/app/workers/gitlab/jira_import/stage/start_import_worker.rb +++ b/app/workers/gitlab/jira_import/stage/start_import_worker.rb @@ -25,7 +25,7 @@ module Gitlab def start_import return false unless project - return false if Feature.disabled?(:jira_issue_import, project) + return false unless project.jira_issues_import_feature_flag_enabled? return true if start(project.latest_jira_import) Gitlab::Import::Logger.info( |