diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index d9713f9c9b0..0a7f930110a 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -540,4 +540,13 @@ module ProjectsHelper network ] end + + def sidebar_operations_paths + %w[ + environments + clusters + user + gcp + ] + end end diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml index 174033f3d49..ab15889a465 100644 --- a/app/views/layouts/nav/sidebar/_project.html.haml +++ b/app/views/layouts/nav/sidebar/_project.html.haml @@ -195,7 +195,7 @@ = _('Charts') - if project_nav_tab? :operations - = nav_link(controller: [:environments, :clusters, :user, :gcp]) do + = nav_link(controller: sidebar_operations_paths) do = link_to metrics_project_environments_path(@project), class: 'shortcuts-operations' do .nav-icon-container = sprite_icon('cloud-gear') @@ -203,7 +203,7 @@ = _('Operations') %ul.sidebar-sub-level-items - = nav_link(controller: [:environments, :clusters, :user, :gcp], html_options: { class: "fly-out-top-item" } ) do + = nav_link(controller: sidebar_operations_paths, html_options: { class: "fly-out-top-item" } ) do = link_to metrics_project_environments_path(@project) do %strong.fly-out-top-item-name = _('Operations') @@ -215,6 +215,8 @@ %span = _('Metrics') + = render_if_exists "layouts/nav/sidebar/tracing_link" + = nav_link(controller: :environments, action: [:index, :folder, :show, :new, :edit, :create, :update, :stop, :terminal]) do = link_to project_environments_path(@project), title: _('Environments'), class: 'shortcuts-environments qa-operations-environments-link' do %span @@ -326,6 +328,7 @@ = link_to project_settings_ci_cd_path(@project), title: _('CI / CD') do %span = _('CI / CD') + = render_if_exists 'projects/sidebar/settings_operations' - if @project.pages_available? = nav_link(controller: :pages) do = link_to project_pages_path(@project), title: _('Pages') do diff --git a/spec/lib/gitlab/import_export/attribute_configuration_spec.rb b/spec/lib/gitlab/import_export/attribute_configuration_spec.rb index 65f073b2df3..87ab81d8169 100644 --- a/spec/lib/gitlab/import_export/attribute_configuration_spec.rb +++ b/spec/lib/gitlab/import_export/attribute_configuration_spec.rb @@ -23,15 +23,23 @@ describe 'Import/Export attribute configuration' do let(:safe_attributes_file) { 'spec/lib/gitlab/import_export/safe_model_attributes.yml' } let(:safe_model_attributes) { YAML.load_file(safe_attributes_file) } + let(:ee_safe_attributes_file) { 'ee/spec/lib/gitlab/import_export/safe_model_attributes.yml' } + let(:ee_safe_model_attributes) { File.exist?(ee_safe_attributes_file) ? YAML.load_file(ee_safe_attributes_file) : {} } + it 'has no new columns' do relation_names.each do |relation_name| relation_class = relation_class_for_name(relation_name) relation_attributes = relation_class.new.attributes.keys - expect(safe_model_attributes[relation_class.to_s]).not_to be_nil, "Expected exported class #{relation_class} to exist in safe_model_attributes" - current_attributes = parsed_attributes(relation_name, relation_attributes) - safe_attributes = safe_model_attributes[relation_class.to_s] + safe_attributes = safe_model_attributes[relation_class.to_s].dup || [] + + ee_safe_model_attributes[relation_class.to_s].to_a.each do |attribute| + safe_attributes << attribute + end + + expect(safe_attributes).not_to be_nil, "Expected exported class #{relation_class} to exist in safe_model_attributes" + new_attributes = current_attributes - safe_attributes expect(new_attributes).to be_empty, failure_message(relation_class.to_s, new_attributes) @@ -43,6 +51,7 @@ describe 'Import/Export attribute configuration' do It looks like #{relation_class}, which is exported using the project Import/Export, has new attributes: #{new_attributes.join(',')} Please add the attribute(s) to SAFE_MODEL_ATTRIBUTES if you consider this can be exported. + #{"If the model/associations are EE-specific, use `#{File.expand_path(ee_safe_attributes_file)}`.\n" if ee_safe_model_attributes.any?} Otherwise, please blacklist the attribute(s) in IMPORT_EXPORT_CONFIG by adding it to its correspondent model in the +excluded_attributes+ section.