diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-21 09:07:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-21 09:07:54 +0300 |
commit | 6c3db3c7e44f428675da5e85ef1244a35125940e (patch) | |
tree | edcd626bbcf4ecb2676f990458ecaadbf9455b1e | |
parent | bfb5557b15d66fc1c22aeec5c345241946b103a3 (diff) |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | .gitlab/ci/package-and-test/main.gitlab-ci.yml | 17 | ||||
-rw-r--r-- | app/assets/javascripts/nav/components/new_nav_toggle.vue | 7 | ||||
-rw-r--r-- | app/assets/javascripts/super_sidebar/components/super_sidebar.vue | 1 | ||||
-rw-r--r-- | app/assets/javascripts/super_sidebar/components/user_bar.vue | 9 | ||||
-rw-r--r-- | app/assets/javascripts/super_sidebar/super_sidebar_bundle.js | 4 | ||||
-rw-r--r-- | db/post_migrate/20230218152729_validate_fk_on_ci_job_artifacts_partition_id_and_job_id.rb | 15 | ||||
-rw-r--r-- | db/post_migrate/20230218152730_remove_fk_to_ci_builds_ci_job_artifacts_on_job_id.rb | 35 | ||||
-rw-r--r-- | db/schema_migrations/20230218152729 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20230218152730 | 1 | ||||
-rw-r--r-- | db/structure.sql | 5 | ||||
-rw-r--r-- | qa/qa/flow/login.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/main/login.rb | 1 | ||||
-rw-r--r-- | qa/qa/page/main/menu.rb | 38 | ||||
-rw-r--r-- | qa/qa/runtime/env.rb | 4 | ||||
-rw-r--r-- | spec/db/schema_spec.rb | 2 |
15 files changed, 123 insertions, 21 deletions
diff --git a/.gitlab/ci/package-and-test/main.gitlab-ci.yml b/.gitlab/ci/package-and-test/main.gitlab-ci.yml index 0d30cb78be7..b70ced69969 100644 --- a/.gitlab/ci/package-and-test/main.gitlab-ci.yml +++ b/.gitlab/ci/package-and-test/main.gitlab-ci.yml @@ -213,6 +213,23 @@ _ee:quarantine: variables: QA_RSPEC_TAGS: --tag quarantine +# Temporary test job to support the effort of migrating to Super Sidebar +# https://gitlab.com/groups/gitlab-org/-/epics/9044 +_ee:super-sidebar-nav: + extends: + - .qa + - .parallel + variables: + QA_SCENARIO: Test::Instance::Image + QA_KNAPSACK_REPORT_NAME: ee-instance + QA_TESTS: "" + QA_SUPER_SIDEBAR_ENABLED: "true" + GITLAB_QA_OPTS: --set-feature-flags super_sidebar_nav=enabled + allow_failure: true + rules: + - if: $CI_MERGE_REQUEST_LABELS =~ /group::foundations/ + - !reference [.rules:test:manual, rules] + # ------------------------------------------ # FF changes # ------------------------------------------ diff --git a/app/assets/javascripts/nav/components/new_nav_toggle.vue b/app/assets/javascripts/nav/components/new_nav_toggle.vue index da22a8d2fb7..37e29cc7f04 100644 --- a/app/assets/javascripts/nav/components/new_nav_toggle.vue +++ b/app/assets/javascripts/nav/components/new_nav_toggle.vue @@ -74,7 +74,12 @@ export default { @click.prevent.stop="toggleNav" > {{ $options.i18n.toggleMenuItemLabel }} - <gl-toggle :value="isEnabled" :label="$options.i18n.toggleLabel" label-position="hidden" /> + <gl-toggle + :value="isEnabled" + :label="$options.i18n.toggleLabel" + label-position="hidden" + data-qa-selector="new_navigation_toggle" + /> </div> </li> </template> diff --git a/app/assets/javascripts/super_sidebar/components/super_sidebar.vue b/app/assets/javascripts/super_sidebar/components/super_sidebar.vue index 309299855d7..b7a70825b62 100644 --- a/app/assets/javascripts/super_sidebar/components/super_sidebar.vue +++ b/app/assets/javascripts/super_sidebar/components/super_sidebar.vue @@ -39,6 +39,7 @@ export default { id="super-sidebar" class="super-sidebar gl-display-flex gl-flex-direction-column" data-testid="super-sidebar" + data-qa-selector="navbar" > <user-bar :sidebar-data="sidebarData" /> <div class="gl-display-flex gl-flex-direction-column gl-flex-grow-1 gl-overflow-hidden"> diff --git a/app/assets/javascripts/super_sidebar/components/user_bar.vue b/app/assets/javascripts/super_sidebar/components/user_bar.vue index 4a7ea5bac80..58a6f215a9c 100644 --- a/app/assets/javascripts/super_sidebar/components/user_bar.vue +++ b/app/assets/javascripts/super_sidebar/components/user_bar.vue @@ -64,9 +64,14 @@ export default { <button class="gl-border-none"> <gl-icon name="search" class="gl-vertical-align-middle" /> </button> - <gl-dropdown data-testid="user-dropdown" variant="link" no-caret> + <gl-dropdown data-testid="user-dropdown" data-qa-selector="user_menu" variant="link" no-caret> <template #button-content> - <gl-avatar :entity-name="sidebarData.name" :src="sidebarData.avatar_url" :size="32" /> + <gl-avatar + :entity-name="sidebarData.name" + :src="sidebarData.avatar_url" + :size="32" + data-qa-selector="user_avatar_content" + /> </template> <new-nav-toggle :endpoint="toggleNewNavEndpoint" enabled /> </gl-dropdown> diff --git a/app/assets/javascripts/super_sidebar/super_sidebar_bundle.js b/app/assets/javascripts/super_sidebar/super_sidebar_bundle.js index 307c920e638..dcad6a47f22 100644 --- a/app/assets/javascripts/super_sidebar/super_sidebar_bundle.js +++ b/app/assets/javascripts/super_sidebar/super_sidebar_bundle.js @@ -8,11 +8,11 @@ import SuperSidebar from './components/super_sidebar.vue'; export const initSuperSidebar = () => { const el = document.querySelector('.js-super-sidebar'); + if (!el) return false; + bindSuperSidebarCollapsedEvents(); initSuperSidebarCollapsedState(); - if (!el) return false; - const { rootPath, sidebar, toggleNewNavEndpoint } = el.dataset; return new Vue({ diff --git a/db/post_migrate/20230218152729_validate_fk_on_ci_job_artifacts_partition_id_and_job_id.rb b/db/post_migrate/20230218152729_validate_fk_on_ci_job_artifacts_partition_id_and_job_id.rb new file mode 100644 index 00000000000..9a9cb0d9487 --- /dev/null +++ b/db/post_migrate/20230218152729_validate_fk_on_ci_job_artifacts_partition_id_and_job_id.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ValidateFkOnCiJobArtifactsPartitionIdAndJobId < Gitlab::Database::Migration[2.1] + TABLE_NAME = :ci_job_artifacts + FK_NAME = :fk_rails_c5137cb2c1_p + COLUMNS = [:partition_id, :job_id] + + def up + validate_foreign_key(TABLE_NAME, COLUMNS, name: FK_NAME) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20230218152730_remove_fk_to_ci_builds_ci_job_artifacts_on_job_id.rb b/db/post_migrate/20230218152730_remove_fk_to_ci_builds_ci_job_artifacts_on_job_id.rb new file mode 100644 index 00000000000..02747d57eab --- /dev/null +++ b/db/post_migrate/20230218152730_remove_fk_to_ci_builds_ci_job_artifacts_on_job_id.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class RemoveFkToCiBuildsCiJobArtifactsOnJobId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + SOURCE_TABLE_NAME = :ci_job_artifacts + TARGET_TABLE_NAME = :ci_builds + COLUMN = :job_id + TARGET_COLUMN = :id + FK_NAME = :fk_rails_c5137cb2c1 + + def up + with_lock_retries do + remove_foreign_key_if_exists( + SOURCE_TABLE_NAME, + TARGET_TABLE_NAME, + name: FK_NAME, + reverse_lock_order: true + ) + end + end + + def down + add_concurrent_foreign_key( + SOURCE_TABLE_NAME, + TARGET_TABLE_NAME, + column: COLUMN, + target_column: TARGET_COLUMN, + validate: true, + reverse_lock_order: true, + on_delete: :cascade, + name: FK_NAME + ) + end +end diff --git a/db/schema_migrations/20230218152729 b/db/schema_migrations/20230218152729 new file mode 100644 index 00000000000..f78be055435 --- /dev/null +++ b/db/schema_migrations/20230218152729 @@ -0,0 +1 @@ +ac404c1dd1b2a38b8d02563b4b9306076f35120448d78b130c0421364c11822c
\ No newline at end of file diff --git a/db/schema_migrations/20230218152730 b/db/schema_migrations/20230218152730 new file mode 100644 index 00000000000..55fb6069403 --- /dev/null +++ b/db/schema_migrations/20230218152730 @@ -0,0 +1 @@ +f85595c6176426369f8558ba3dadf6ee2a5efa17f2d304dc8397862fc7d52545
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 2eddcb57bdc..a732006ceb8 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -36135,10 +36135,7 @@ ALTER TABLE ONLY boards_epic_board_recent_visits ADD CONSTRAINT fk_rails_c4dcba4a3e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; ALTER TABLE ONLY ci_job_artifacts - ADD CONSTRAINT fk_rails_c5137cb2c1 FOREIGN KEY (job_id) REFERENCES ci_builds(id) ON DELETE CASCADE; - -ALTER TABLE ONLY ci_job_artifacts - ADD CONSTRAINT fk_rails_c5137cb2c1_p FOREIGN KEY (partition_id, job_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID; + ADD CONSTRAINT fk_rails_c5137cb2c1_p FOREIGN KEY (partition_id, job_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE; ALTER TABLE ONLY packages_events ADD CONSTRAINT fk_rails_c6c20d0094 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE SET NULL; diff --git a/qa/qa/flow/login.rb b/qa/qa/flow/login.rb index 564a51ee483..2702b52f2ef 100644 --- a/qa/qa/flow/login.rb +++ b/qa/qa/flow/login.rb @@ -21,8 +21,8 @@ module QA def sign_in(as: nil, address: :gitlab, skip_page_validation: false, admin: false) Page::Main::Login.perform { |p| p.redirect_to_login_page(address) } - unless Page::Main::Login.perform(&:on_login_page?) - Page::Main::Menu.perform(&:sign_out) if Page::Main::Menu.perform(&:signed_in?) + if !Page::Main::Login.perform(&:on_login_page?) && Page::Main::Menu.perform(&:signed_in?) + Page::Main::Menu.perform(&:sign_out) end Page::Main::Login.perform do |login| diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index f4f8820bc04..7532154f0cc 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -233,6 +233,7 @@ module QA terms.accept_terms if terms.visible? end + Page::Main::Menu.perform(&:enable_new_navigation) if Runtime::Env.super_sidebar_enabled? Page::Main::Menu.validate_elements_present! unless skip_page_validation end diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index 1e050d79e23..0b258c9ee34 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -12,15 +12,24 @@ module QA element :user_profile_link end - view 'app/views/layouts/header/_default.html.haml' do - element :navbar, required: true - element :canary_badge_link - element :user_avatar_content, required: !QA::Runtime::Env.mobile_layout? - element :user_menu, required: !QA::Runtime::Env.mobile_layout? - element :stop_impersonation_link - element :issues_shortcut_button, required: !QA::Runtime::Env.mobile_layout? - element :merge_requests_shortcut_button, required: !QA::Runtime::Env.mobile_layout? - element :todos_shortcut_button, required: !QA::Runtime::Env.mobile_layout? + if QA::Runtime::Env.super_sidebar_enabled? + # Define alternative navbar (super sidebar) which does not yet implement all the same elements + view 'app/assets/javascripts/super_sidebar/components/super_sidebar.vue' do + element :navbar, required: true # TODO: rename to sidebar once it's default implementation + element :user_menu, required: !QA::Runtime::Env.mobile_layout? + element :user_avatar_content, required: !QA::Runtime::Env.mobile_layout? + end + else + view 'app/views/layouts/header/_default.html.haml' do + element :navbar, required: true + element :canary_badge_link + element :user_avatar_content, required: !QA::Runtime::Env.mobile_layout? + element :user_menu, required: !QA::Runtime::Env.mobile_layout? + element :stop_impersonation_link + element :issues_shortcut_button, required: !QA::Runtime::Env.mobile_layout? + element :merge_requests_shortcut_button, required: !QA::Runtime::Env.mobile_layout? + element :todos_shortcut_button, required: !QA::Runtime::Env.mobile_layout? + end end view 'app/assets/javascripts/nav/components/top_nav_app.vue' do @@ -64,6 +73,10 @@ module QA element :global_new_project_link end + view 'app/assets/javascripts/nav/components/new_nav_toggle.vue' do + element :new_navigation_toggle + end + def go_to_groups within_groups_menu do click_element(:menu_item_link, title: 'View all groups') @@ -211,6 +224,13 @@ module QA has_element?(:canary_badge_link) end + def enable_new_navigation + Runtime::Logger.info("Enabling super sidebar!") + return Runtime::Logger.info("Super sidebar is already enabled") if has_css?('[data-testid="super-sidebar"]') + + within_user_menu { click_element(:new_navigation_toggle) } + end + private def within_top_menu(&block) diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index b53c2320537..3153c644b88 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -514,6 +514,10 @@ module QA ENV['DEFAULT_CHROME_DOWNLOAD_PATH'] || Dir.tmpdir end + def super_sidebar_enabled? + enabled?(ENV['QA_SUPER_SIDEBAR_ENABLED'], default: false) + end + def require_slack_env! missing_env = %i[slack_workspace slack_email slack_password].select do |method| ::QA::Runtime::Env.public_send(method).nil? diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index 8b9bcfdeaba..ab858f3b999 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -43,7 +43,7 @@ RSpec.describe 'Database schema', feature_category: :database do ci_builds: %w[erased_by_id trigger_request_id partition_id], ci_builds_runner_session: %w[partition_id build_id], p_ci_builds_metadata: %w[partition_id], - ci_job_artifacts: %w[partition_id], + ci_job_artifacts: %w[partition_id job_id], ci_job_variables: %w[partition_id], ci_namespace_monthly_usages: %w[namespace_id], ci_pending_builds: %w[partition_id], |