diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-26 03:10:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-26 03:10:08 +0300 |
commit | dac3263909b0bc570d58b4385c2a56e5351222e3 (patch) | |
tree | d587db1580054a82296f48eaf31ae1f50b4810b0 | |
parent | 1c61faf876f0da721dde9dc52fb28ab0e7330c6d (diff) |
Add latest changes from gitlab-org/gitlab@master
21 files changed, 135 insertions, 61 deletions
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 6abc624dd52..e8930c74a81 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -531d5205acec6b5160d862ea687c157c07cbcff1 +fd84a0041b7bde87c4173989cdb70a8b1d2ca1f2 diff --git a/app/assets/javascripts/ci/pipeline_editor/components/header/pipeline_status.vue b/app/assets/javascripts/ci/pipeline_editor/components/header/pipeline_status.vue index 58b5c0004e0..e33ce66ca66 100644 --- a/app/assets/javascripts/ci/pipeline_editor/components/header/pipeline_status.vue +++ b/app/assets/javascripts/ci/pipeline_editor/components/header/pipeline_status.vue @@ -7,7 +7,7 @@ import getPipelineQuery from '~/ci/pipeline_editor/graphql/queries/pipeline.quer import getPipelineEtag from '~/ci/pipeline_editor/graphql/queries/client/pipeline_etag.query.graphql'; import { getQueryHeaders, toggleQueryPollingByVisibility } from '~/ci/pipeline_details/graph/utils'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import CiIcon from '~/vue_shared/components/ci_icon.vue'; +import CiBadgeLink from '~/vue_shared/components/ci_badge_link.vue'; import PipelineMiniGraph from '~/ci/pipeline_mini_graph/pipeline_mini_graph.vue'; import PipelineEditorMiniGraph from './pipeline_editor_mini_graph.vue'; @@ -25,7 +25,7 @@ export const i18n = { export default { i18n, components: { - CiIcon, + CiBadgeLink, GlButton, GlIcon, GlLink, @@ -156,7 +156,12 @@ export default { <template v-else> <div class="gl-text-truncate gl-md-max-w-50p gl-mr-1"> <a :href="status.detailsPath" class="gl-mr-auto"> - <ci-icon :status="status" :size="16" data-testid="pipeline-status-icon" class="gl-mr-2" /> + <ci-badge-link + :status="status" + badge-size="md" + :show-text="false" + data-testid="pipeline-status-icon" + /> </a> <span class="gl-font-weight-bold"> <gl-sprintf :message="$options.i18n.pipelineInfo"> diff --git a/app/assets/javascripts/projects/commit_box/info/components/commit_box_pipeline_status.vue b/app/assets/javascripts/projects/commit_box/info/components/commit_box_pipeline_status.vue index ccecc914cf1..8072116e2f5 100644 --- a/app/assets/javascripts/projects/commit_box/info/components/commit_box_pipeline_status.vue +++ b/app/assets/javascripts/projects/commit_box/info/components/commit_box_pipeline_status.vue @@ -1,6 +1,6 @@ <script> -import { GlLoadingIcon, GlLink } from '@gitlab/ui'; -import CiIcon from '~/vue_shared/components/ci_icon.vue'; +import { GlLoadingIcon } from '@gitlab/ui'; +import CiBadgeLink from '~/vue_shared/components/ci_badge_link.vue'; import { createAlert } from '~/alert'; import { getQueryHeaders, toggleQueryPollingByVisibility } from '~/ci/pipeline_details/graph/utils'; import getLatestPipelineStatusQuery from '../graphql/queries/get_latest_pipeline_status.query.graphql'; @@ -9,9 +9,8 @@ import { COMMIT_BOX_POLL_INTERVAL, PIPELINE_STATUS_FETCH_ERROR } from '../consta export default { PIPELINE_STATUS_FETCH_ERROR, components: { - CiIcon, + CiBadgeLink, GlLoadingIcon, - GlLink, }, inject: { fullPath: { @@ -64,8 +63,12 @@ export default { <template> <div class="gl-display-inline-block gl-vertical-align-middle gl-mr-2"> <gl-loading-icon v-if="loading" /> - <gl-link v-else :href="pipelineStatus.detailsPath"> - <ci-icon :status="pipelineStatus" :size="24" /> - </gl-link> + <ci-badge-link + v-else + :status="pipelineStatus" + :details-path="pipelineStatus.detailsPath" + badge-size="md" + :show-text="false" + /> </div> </template> diff --git a/app/assets/javascripts/repository/components/last_commit.vue b/app/assets/javascripts/repository/components/last_commit.vue index ff6acd5239d..05d4d9e1f81 100644 --- a/app/assets/javascripts/repository/components/last_commit.vue +++ b/app/assets/javascripts/repository/components/last_commit.vue @@ -120,7 +120,6 @@ export default { :status="commit.pipeline.detailedStatus" :details-path="commit.pipeline.detailedStatus.detailsPath" :aria-label="statusTitle" - size="lg" :show-text="false" class="js-commit-pipeline" /> diff --git a/app/assets/javascripts/vue_shared/components/ci_badge_link.vue b/app/assets/javascripts/vue_shared/components/ci_badge_link.vue index 101ebcd1c48..036c03a9a1e 100644 --- a/app/assets/javascripts/vue_shared/components/ci_badge_link.vue +++ b/app/assets/javascripts/vue_shared/components/ci_badge_link.vue @@ -59,8 +59,8 @@ export default { }, }, computed: { - isSmallBadgeSize() { - return this.size === badgeSizeOptions.sm; + isNotLargeBadgeSize() { + return this.badgeSize !== badgeSizeOptions.lg; }, title() { return !this.showText ? this.status?.text : ''; @@ -121,7 +121,7 @@ export default { <template> <gl-badge v-gl-tooltip - :class="{ 'gl-pl-2': isSmallBadgeSize, 'gl-p-2!': !showText }" + :class="{ 'gl-px-2': !showText && isNotLargeBadgeSize }" :title="title" :href="detailsPath" :size="size" diff --git a/app/helpers/ci/status_helper.rb b/app/helpers/ci/status_helper.rb index 5d526a6abb6..b7ada82c5a4 100644 --- a/app/helpers/ci/status_helper.rb +++ b/app/helpers/ci/status_helper.rb @@ -72,20 +72,19 @@ module Ci status, path, tooltip_placement: tooltip_placement, - icon_size: 24) + icon_size: 16) end def render_status_with_link(status, path = nil, type: _('pipeline'), tooltip_placement: 'left', cssclass: '', container: 'body', icon_size: 16) - klass = "ci-status-link #{ci_icon_class_for_status(status)} d-inline-flex #{cssclass}" + variant = badge_variant(status) + klass = "ci-status-link #{ci_icon_class_for_status(status)} d-inline-flex gl-line-height-1 #{cssclass}" title = "#{type.titleize}: #{ci_label_for_status(status)}" data = { toggle: 'tooltip', placement: tooltip_placement, container: container } + badge_classes = 'gl-px-2 gl-ml-3' - if path - link_to ci_icon_for_status(status, size: icon_size), path, - class: klass, title: title, data: data - else + gl_badge_tag(variant: variant, size: :md, href: path, class: badge_classes, title: title, data: data) do content_tag :span, ci_icon_for_status(status, size: icon_size), - class: klass, title: title, data: data + class: klass end end @@ -118,5 +117,24 @@ module Ci translation = "CiStatusLabel|#{label}" s_(translation) end + + def badge_variant(status) + variant = detailed_status?(status) ? status.group : status.dasherize + + case variant + when 'success' + :success + when 'success-with-warnings', 'pending' + :warning + when 'failed' + :danger + when 'running' + :info + when 'canceled', 'manual' + :neutral + else + :muted + end + end end end diff --git a/app/models/namespace/detail.rb b/app/models/namespace/detail.rb index 36027d47591..f5e850830bc 100644 --- a/app/models/namespace/detail.rb +++ b/app/models/namespace/detail.rb @@ -1,11 +1,6 @@ # frozen_string_literal: true class Namespace::Detail < ApplicationRecord - include IgnorableColumns - - ignore_column :dashboard_notification_at, remove_with: '16.5', remove_after: '2023-08-22' - ignore_column :dashboard_enforcement_at, remove_with: '16.5', remove_after: '2023-08-22' - belongs_to :namespace, inverse_of: :namespace_details validates :namespace, presence: true validates :description, length: { maximum: 255 } diff --git a/app/views/ci/status/_icon.html.haml b/app/views/ci/status/_icon.html.haml index fdaacb732c7..b7fe8a56c2b 100644 --- a/app/views/ci/status/_icon.html.haml +++ b/app/views/ci/status/_icon.html.haml @@ -1,14 +1,10 @@ - status = local_assigns.fetch(:status) -- size = local_assigns.fetch(:size, 16) - tooltip_placement = local_assigns.fetch(:tooltip_placement, "left") - path = local_assigns.fetch(:path, status.has_details? ? status.details_path : nil) - option_css_classes = local_assigns.fetch(:option_css_classes, '') -- css_classes = "ci-status-link ci-status-icon ci-status-icon-#{status.group} has-tooltip #{option_css_classes}" -- title = s_("PipelineStatusTooltip|Pipeline: %{ci_status}") % {ci_status: status.label} +- css_classes = "gl-px-2 #{option_css_classes}" +- ci_css_classes = "ci-status-link ci-status-icon ci-status-icon-#{status.group} gl-line-height-1" +- title = s_("PipelineStatusTooltip|Pipeline: %{ci_status}") % {ci_status: status.label} -- if path - = link_to path, class: css_classes, title: title, data: { placement: tooltip_placement } do - = sprite_icon(status.icon, size: size) -- else - %span{ class: css_classes, title: title, data: { placement: tooltip_placement } } - = sprite_icon(status.icon, size: size) += gl_badge_tag(variant: badge_variant(status), size: :md, href: path, class: css_classes, title: title, data: { toggle: 'tooltip', placement: tooltip_placement }) do + = content_tag :span, sprite_icon(status.icon, size: 16), class: ci_css_classes diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index 7c52350f101..61961172eb2 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -28,7 +28,7 @@ .pipeline-status.d-none.d-md-block< - if commit_status - = render 'ci/status/icon', size: 16, status: commit_status, option_css_classes: 'gl-display-inline-flex gl-vertical-align-middle gl-mr-3' + = render 'ci/status/icon', size: 16, status: commit_status - elsif show_commit_status .gl-display-inline-flex.gl-vertical-align-middle.gl-mr-3 %svg.s16 diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index 4a7aa9a86ab..21a74d30ba5 100644 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -43,7 +43,7 @@ = link_to_label(label, type: :merge_request, small: true) .issuable-meta - %ul.controls.d-flex.align-items-end + %ul.controls.d-flex.align-items-center - if merge_request.merged? - merged_at = merge_request.merged_at ? l(merge_request.merged_at.to_time) : _("Merge date & time could not be determined") %li.d-none.d-sm-flex diff --git a/doc/administration/postgresql/multiple_databases.md b/doc/administration/postgresql/multiple_databases.md index 9e5e34d930c..aa5c9cf5693 100644 --- a/doc/administration/postgresql/multiple_databases.md +++ b/doc/administration/postgresql/multiple_databases.md @@ -43,6 +43,10 @@ copy the database across. ### Existing self-compiled installation +1. [Disable background migrations](../../development/database/batched_background_migrations.md#enable-or-disable-background-migrations) + +1. [Ensure all background migrations are finished](../../update/background_migrations.md#check-the-status-of-batched-background-migrations) + 1. Stop GitLab, except for PostgreSQL: ```shell @@ -67,6 +71,10 @@ copy the database across. ### Existing Linux package installations +1. [Disable background migrations](../../development/database/batched_background_migrations.md#enable-or-disable-background-migrations) + +1. [Ensure all background migrations are finished](../../update/background_migrations.md#check-the-status-of-batched-background-migrations) + 1. Stop GitLab, except for PostgreSQL: ```shell @@ -152,6 +160,8 @@ the other way around. sudo service gitlab restart ``` +1. [Enable background migrations](../../development/database/batched_background_migrations.md#enable-or-disable-background-migrations) + ### Linux package installations 1. For existing installations, @@ -204,6 +214,8 @@ the other way around. sudo gitlab-ctl restart ``` +1. [Enable background migrations](../../development/database/batched_background_migrations.md#enable-or-disable-background-migrations) + ## Further information For more information on multiple databases, see [issue 6168](https://gitlab.com/groups/gitlab-org/-/epics/6168). diff --git a/lib/banzai/filter/references/reference_filter.rb b/lib/banzai/filter/references/reference_filter.rb index caec808ef04..e7fa287ae06 100644 --- a/lib/banzai/filter/references/reference_filter.rb +++ b/lib/banzai/filter/references/reference_filter.rb @@ -153,6 +153,7 @@ module Banzai @ignore_ancestor_query ||= begin parents = %w[pre code a style] parents << 'blockquote' if context[:ignore_blockquotes] + parents << 'span[contains(concat(" ", @class, " "), " idiff ")]' parents.map { |n| "ancestor::#{n}" }.join(' or ') end diff --git a/lib/banzai/pipeline/gfm_pipeline.rb b/lib/banzai/pipeline/gfm_pipeline.rb index 1d6269c704d..168149af089 100644 --- a/lib/banzai/pipeline/gfm_pipeline.rb +++ b/lib/banzai/pipeline/gfm_pipeline.rb @@ -32,11 +32,11 @@ module Banzai Filter::ExternalLinkFilter, Filter::SuggestionFilter, Filter::FootnoteFilter, + Filter::InlineDiffFilter, *reference_filters, Filter::EmojiFilter, Filter::CustomEmojiFilter, Filter::TaskListFilter, - Filter::InlineDiffFilter, Filter::InlineObservabilityFilter, Filter::SetDirectionFilter, Filter::SyntaxHighlightFilter # this filter should remain at the end diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index 50df7bb7ca5..de805820de6 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -299,7 +299,7 @@ RSpec.describe 'Branches', feature_category: :groups_and_projects do it 'shows pipeline status when available' do page.within first('.all-branches li') do - expect(page).to have_css 'a.ci-status-icon-success' + expect(page).to have_css 'a.gl-badge .ci-status-icon-success' end end diff --git a/spec/frontend/ci/pipeline_editor/components/header/pipeline_status_spec.js b/spec/frontend/ci/pipeline_editor/components/header/pipeline_status_spec.js index 1a2ed60a6f4..9bb0618b758 100644 --- a/spec/frontend/ci/pipeline_editor/components/header/pipeline_status_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/header/pipeline_status_spec.js @@ -1,4 +1,4 @@ -import { GlIcon, GlLink, GlLoadingIcon, GlSprintf } from '@gitlab/ui'; +import { GlIcon, GlLoadingIcon, GlSprintf } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import Vue from 'vue'; import VueApollo from 'vue-apollo'; @@ -43,7 +43,7 @@ describe('Pipeline Status', () => { }, projectFullPath: mockProjectFullPath, }, - stubs: { GlLink, GlSprintf }, + stubs: { GlSprintf }, }); }; diff --git a/spec/frontend/commit/components/commit_box_pipeline_status_spec.js b/spec/frontend/commit/components/commit_box_pipeline_status_spec.js index 80b75a0a65e..844a2d81832 100644 --- a/spec/frontend/commit/components/commit_box_pipeline_status_spec.js +++ b/spec/frontend/commit/components/commit_box_pipeline_status_spec.js @@ -1,11 +1,11 @@ -import { GlLoadingIcon, GlLink } from '@gitlab/ui'; +import { GlLoadingIcon } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import { createAlert } from '~/alert'; -import CiIcon from '~/vue_shared/components/ci_icon.vue'; +import CiBadgeLink from '~/vue_shared/components/ci_badge_link.vue'; import CommitBoxPipelineStatus from '~/projects/commit_box/info/components/commit_box_pipeline_status.vue'; import { COMMIT_BOX_POLL_INTERVAL, @@ -32,8 +32,7 @@ describe('Commit box pipeline status', () => { const failedHandler = jest.fn().mockRejectedValue(new Error('GraphQL error')); const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon); - const findStatusIcon = () => wrapper.findComponent(CiIcon); - const findPipelineLink = () => wrapper.findComponent(GlLink); + const findCiBadgeLink = () => wrapper.findComponent(CiBadgeLink); const advanceToNextFetch = () => { jest.advanceTimersByTime(COMMIT_BOX_POLL_INTERVAL); @@ -50,6 +49,9 @@ describe('Commit box pipeline status', () => { provide: { ...mockProvide, }, + stubs: { + CiBadgeLink, + }, apolloProvider: createMockApolloProvider(handler), }); }; @@ -59,7 +61,7 @@ describe('Commit box pipeline status', () => { createComponent(); expect(findLoadingIcon().exists()).toBe(true); - expect(findStatusIcon().exists()).toBe(false); + expect(findCiBadgeLink().exists()).toBe(false); }); }); @@ -71,7 +73,7 @@ describe('Commit box pipeline status', () => { }); it('should display pipeline status after the query is resolved successfully', () => { - expect(findStatusIcon().exists()).toBe(true); + expect(findCiBadgeLink().exists()).toBe(true); expect(findLoadingIcon().exists()).toBe(false); expect(createAlert).toHaveBeenCalledTimes(0); @@ -88,7 +90,7 @@ describe('Commit box pipeline status', () => { }, } = mockPipelineStatusResponse; - expect(findPipelineLink().attributes('href')).toBe(detailsPath); + expect(findCiBadgeLink().attributes('href')).toBe(detailsPath); }); }); diff --git a/spec/frontend/repository/components/__snapshots__/last_commit_spec.js.snap b/spec/frontend/repository/components/__snapshots__/last_commit_spec.js.snap index e48041c1032..208af4ba24a 100644 --- a/spec/frontend/repository/components/__snapshots__/last_commit_spec.js.snap +++ b/spec/frontend/repository/components/__snapshots__/last_commit_spec.js.snap @@ -14,7 +14,7 @@ exports[`Repository last commit component renders commit widget 1`] = ` aria-label="Pipeline: failed" class="js-commit-pipeline" details-path="https://test.com/pipeline" - size="lg" + size="md" status="[object Object]" /> </div> diff --git a/spec/frontend/vue_shared/components/ci_badge_link_spec.js b/spec/frontend/vue_shared/components/ci_badge_link_spec.js index fa42e87ec70..46fe5a0a74e 100644 --- a/spec/frontend/vue_shared/components/ci_badge_link_spec.js +++ b/spec/frontend/vue_shared/components/ci_badge_link_spec.js @@ -150,9 +150,9 @@ describe('CI Badge Link Component', () => { expect(findBadge().props('size')).toBe('lg'); }); - it('should have class `gl-p-2!` when `showText` is false', () => { + it('should have class `gl-px-2` when `showText` is false', () => { createComponent({ status: statuses.success, size: 'lg', showText: false }); - expect(findBadge().classes()).toContain('gl-p-2!'); + expect(findBadge().classes()).toContain('gl-px-2'); }); }); diff --git a/spec/helpers/ci/status_helper_spec.rb b/spec/helpers/ci/status_helper_spec.rb index 66c821df8f1..17fe474b360 100644 --- a/spec/helpers/ci/status_helper_spec.rb +++ b/spec/helpers/ci/status_helper_spec.rb @@ -55,10 +55,6 @@ RSpec.describe Ci::StatusHelper do is_expected.to include("href=\"/commit-path\"") end - it "does not contain a span element" do - is_expected.not_to include("<span") - end - it "has 'Pipeline' as the status type in the title" do is_expected.to include("title=\"Pipeline: passed\"") end @@ -88,7 +84,8 @@ RSpec.describe Ci::StatusHelper do subject { helper.render_status_with_link("success", cssclass: "extra-class") } it "has appended extra class to icon classes" do - is_expected.to include("class=\"ci-status-link ci-status-icon-success d-inline-flex extra-class\"") + is_expected.to include('class="ci-status-link ci-status-icon-success d-inline-flex ' \ + 'gl-line-height-1 extra-class"') end end @@ -107,5 +104,44 @@ RSpec.describe Ci::StatusHelper do is_expected.to include("<svg class=\"s24\"") end end + + context "when status is success-with-warnings" do + subject { helper.render_status_with_link("success-with-warnings") } + + it "renders warning variant of gl-badge" do + is_expected.to include('gl-badge badge badge-pill badge-warning') + end + end + + context "when status is manual" do + subject { helper.render_status_with_link("manual") } + + it "renders neutral variant of gl-badge" do + is_expected.to include('gl-badge badge badge-pill badge-neutral') + end + end + end + + describe '#badge_variant' do + using RSpec::Parameterized::TableSyntax + + where(:status, :expected_badge_variant_class) do + 'success' | 'badge-success' + 'success-with-warnings' | 'badge-warning' + 'pending' | 'badge-warning' + 'failed' | 'badge-danger' + 'running' | 'badge-info' + 'canceled' | 'badge-neutral' + 'manual' | 'badge-neutral' + 'other-status' | 'badge-muted' + end + + with_them do + subject { helper.render_status_with_link(status) } + + it 'uses the correct badge variant classes for gl-badge' do + is_expected.to include("gl-badge badge badge-pill #{expected_badge_variant_class}") + end + end end end diff --git a/spec/lib/banzai/filter/references/reference_filter_spec.rb b/spec/lib/banzai/filter/references/reference_filter_spec.rb index b55b8fd41fa..a2aa4a33ed7 100644 --- a/spec/lib/banzai/filter/references/reference_filter_spec.rb +++ b/spec/lib/banzai/filter/references/reference_filter_spec.rb @@ -34,6 +34,13 @@ RSpec.describe Banzai::Filter::References::ReferenceFilter, feature_category: :t expect { |b| filter.each_node(&b) }.not_to yield_control end + + it 'skips text nodes in inline diff elements' do + document = Nokogiri::HTML.fragment('<span class="idiff">foo</span>') + filter = described_class.new(document, project: project) + + expect { |b| filter.each_node(&b) }.not_to yield_control + end end describe '#nodes' do diff --git a/spec/views/projects/tags/index.html.haml_spec.rb b/spec/views/projects/tags/index.html.haml_spec.rb index dfa27afb72f..01e8d23fb9f 100644 --- a/spec/views/projects/tags/index.html.haml_spec.rb +++ b/spec/views/projects/tags/index.html.haml_spec.rb @@ -91,14 +91,14 @@ RSpec.describe 'projects/tags/index.html.haml' do render - expect(page.find('.tags .content-list li', text: tag)).to have_css 'a.ci-status-icon-success' - expect(page.all('.tags .content-list li')).to all(have_css('svg.s24')) + expect(page.find('.tags .content-list li', text: tag)).to have_css '.gl-badge .ci-status-icon-success' + expect(page.all('.tags .content-list li')).to all(have_css('svg.s16')) end it 'shows no build status or placeholder when no pipelines present' do render - expect(page.all('.tags .content-list li')).not_to have_css 'svg.s24' + expect(page.all('.tags .content-list li')).not_to have_css 'svg.s16' end it 'shows no build status or placeholder when pipelines are private' do @@ -107,7 +107,7 @@ RSpec.describe 'projects/tags/index.html.haml' do render - expect(page.all('.tags .content-list li')).not_to have_css 'svg.s24' + expect(page.all('.tags .content-list li')).not_to have_css 'svg.s16' end end |