Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-08 21:09:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-08 21:09:16 +0300
commit80e9fdc9682cfbcfb9202a2733605a6a6bd23f05 (patch)
tree168375ea13d1a1f01d4cbcf6f0513fc9883e9477 /app
parent5372e109c0660e4670aa987568a51082beca1b3c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/controllers/groups/settings/integrations_controller.rb4
-rw-r--r--app/helpers/groups_helper.rb13
-rw-r--r--app/helpers/services_helper.rb14
-rw-r--r--app/models/project_import_state.rb8
-rw-r--r--app/serializers/diffs_entity.rb2
-rw-r--r--app/views/admin/application_settings/integrations.html.haml2
-rw-r--r--app/views/groups/settings/integrations/index.html.haml9
-rw-r--r--app/views/layouts/nav/sidebar/_group.html.haml5
-rw-r--r--app/views/shared/integrations/_integrations.html.haml (renamed from app/views/projects/services/_integrations.html.haml)4
9 files changed, 51 insertions, 10 deletions
diff --git a/app/controllers/groups/settings/integrations_controller.rb b/app/controllers/groups/settings/integrations_controller.rb
index 0ba030f26bc..adfbe9bfa17 100644
--- a/app/controllers/groups/settings/integrations_controller.rb
+++ b/app/controllers/groups/settings/integrations_controller.rb
@@ -7,6 +7,10 @@ module Groups
before_action :authorize_admin_group!
+ def index
+ @integrations = []
+ end
+
private
# TODO: Make this compatible with group-level integration
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
index 5abe6a635e0..0d7e2a7bd38 100644
--- a/app/helpers/groups_helper.rb
+++ b/app/helpers/groups_helper.rb
@@ -11,7 +11,18 @@ module GroupsHelper
end
def group_nav_link_paths
- %w[groups#projects groups#edit badges#index ci_cd#show ldap_group_links#index hooks#index audit_events#index pipeline_quota#index]
+ %w[
+ groups#projects
+ groups#edit
+ badges#index
+ ci_cd#show
+ integrations#index
+ integrations#edit
+ ldap_group_links#index
+ hooks#index
+ audit_events#index
+ pipeline_quota#index
+ ]
end
def group_packages_nav_link_paths
diff --git a/app/helpers/services_helper.rb b/app/helpers/services_helper.rb
index fe2df918819..a4b6e613100 100644
--- a/app/helpers/services_helper.rb
+++ b/app/helpers/services_helper.rb
@@ -62,10 +62,6 @@ module ServicesHelper
!current_controller?("admin/services") && service.deprecated?
end
- def edit_integration_path(integration)
- edit_admin_application_settings_integration_path(integration)
- end
-
def scoped_integrations_path
if @project.present?
project_settings_integrations_path(@project)
@@ -86,6 +82,16 @@ module ServicesHelper
end
end
+ def scoped_edit_integration_path(integration)
+ if @project.present?
+ edit_project_settings_integration_path(@project, integration)
+ elsif @group.present?
+ edit_group_settings_integration_path(@group, integration)
+ else
+ edit_admin_application_settings_integration_path(integration)
+ end
+ end
+
def scoped_test_integration_path(integration)
if @project.present?
test_project_settings_integration_path(@project, integration)
diff --git a/app/models/project_import_state.rb b/app/models/project_import_state.rb
index 52fd23aefd5..f58b8dc624d 100644
--- a/app/models/project_import_state.rb
+++ b/app/models/project_import_state.rb
@@ -10,6 +10,8 @@ class ProjectImportState < ApplicationRecord
validates :project, presence: true
+ alias_attribute :correlation_id, :correlation_id_value
+
state_machine :status, initial: :none do
event :schedule do
transition [:none, :finished, :failed] => :scheduled
@@ -39,7 +41,11 @@ class ProjectImportState < ApplicationRecord
after_transition [:none, :finished, :failed] => :scheduled do |state, _|
state.run_after_commit do
job_id = project.add_import_job
- update(jid: job_id) if job_id
+
+ if job_id
+ correlation_id = Labkit::Correlation::CorrelationId.current_or_new_id
+ update(jid: job_id, correlation_id_value: correlation_id)
+ end
end
end
diff --git a/app/serializers/diffs_entity.rb b/app/serializers/diffs_entity.rb
index 1d0b4183f96..568d0f6aa8f 100644
--- a/app/serializers/diffs_entity.rb
+++ b/app/serializers/diffs_entity.rb
@@ -99,7 +99,7 @@ class DiffsEntity < Grape::Entity
end
def commit_options(options)
- prev_commit_id, next_commit_id = *commit_neighbors(options[:commit]&.id)
+ next_commit_id, prev_commit_id = *commit_neighbors(options[:commit]&.id)
options.merge(
type: :full,
diff --git a/app/views/admin/application_settings/integrations.html.haml b/app/views/admin/application_settings/integrations.html.haml
index 14df0599583..2b01160a230 100644
--- a/app/views/admin/application_settings/integrations.html.haml
+++ b/app/views/admin/application_settings/integrations.html.haml
@@ -18,7 +18,7 @@
%p
= s_('AdminSettings|Integrations configured here will automatically apply to all projects on this instance.')
= link_to _('Learn more'), '#'
- = render 'projects/services/integrations'
+ = render 'shared/integrations/integrations', integrations: @integrations
- else
= render_if_exists 'admin/application_settings/elasticsearch_form'
diff --git a/app/views/groups/settings/integrations/index.html.haml b/app/views/groups/settings/integrations/index.html.haml
new file mode 100644
index 00000000000..78825cc72b0
--- /dev/null
+++ b/app/views/groups/settings/integrations/index.html.haml
@@ -0,0 +1,9 @@
+- breadcrumb_title _('Integrations')
+- page_title _('Integrations')
+- @content_class = 'limit-container-width' unless fluid_layout
+
+%h4= s_('GroupSettings|Apply integration settings to all Projects')
+%p
+ = s_('GroupSettings|Integrations configured here will automatically apply to all projects in this group.')
+ = link_to _('Learn more'), '#'
+= render 'shared/integrations/integrations', integrations: @integrations
diff --git a/app/views/layouts/nav/sidebar/_group.html.haml b/app/views/layouts/nav/sidebar/_group.html.haml
index b3acf3320d3..89bcccb6185 100644
--- a/app/views/layouts/nav/sidebar/_group.html.haml
+++ b/app/views/layouts/nav/sidebar/_group.html.haml
@@ -159,6 +159,11 @@
= link_to group_settings_ci_cd_path(@group), title: _('CI / CD') do
%span
= _('CI / CD')
+ - if Feature.enabled?(:group_level_integrations, @group)
+ = nav_link(controller: :integrations) do
+ = link_to group_settings_integrations_path(@group), title: _('Integrations') do
+ %span
+ = _('Integrations')
= render_if_exists "groups/ee/settings_nav"
diff --git a/app/views/projects/services/_integrations.html.haml b/app/views/shared/integrations/_integrations.html.haml
index 24aeb598d7b..b2359aca016 100644
--- a/app/views/projects/services/_integrations.html.haml
+++ b/app/views/shared/integrations/_integrations.html.haml
@@ -12,12 +12,12 @@
%th{ role: 'columnheader', scope: 'col', 'aria-colindex': 4 }= _('Last updated')
%tbody{ role: 'rowgroup' }
- - @integrations.each do |integration|
+ - integrations.each do |integration|
%tr{ role: 'row' }
%td{ role: 'cell', 'aria-colindex': 1 }
= boolean_to_icon integration.activated?
%td{ role: 'cell', 'aria-colindex': 2 }
- = link_to edit_integration_path(integration) do
+ = link_to scoped_edit_integration_path(integration) do
%strong= integration.title
%td.d-none.d-sm-block{ role: 'cell', 'aria-colindex': 3 }
= integration.description