Skip to content

Commit 31f5ca7

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 52fa21d commit 31f5ca7

File tree

55 files changed

+870
-234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+870
-234
lines changed

app/assets/javascripts/ci/runner/components/runner_list_header.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
};
1010
</script>
1111
<template>
12-
<page-heading>
12+
<page-heading class="gl-mb-0">
1313
<template #heading>
1414
<slot name="title"></slot>
1515
</template>

app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,10 @@ export default {
11101110
name="project[project_setting_attributes][duo_features_enabled]"
11111111
data-testid="duo_features_enabled_toggle"
11121112
/>
1113-
<div class="project-feature-setting-group gl-flex gl-flex-col gl-gap-5 gl-pl-5 md:gl-pl-7">
1113+
<div
1114+
v-if="amazonQAvailable"
1115+
class="project-feature-setting-group gl-flex gl-flex-col gl-gap-5 gl-pl-5 md:gl-pl-7"
1116+
>
11141117
<project-setting-row
11151118
:label="s__('AI|Enable Auto Review')"
11161119
class="gl-mt-5"

app/assets/javascripts/repository/components/header_area/blob_controls.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ export default {
282282
v-if="glFeatures.filterBlobPath"
283283
:project-path="projectPath"
284284
:blob-path="filePath"
285+
class="!gl-ml-auto"
285286
/>
286287
<gl-button
287288
v-gl-tooltip.html="findFileTooltip"
@@ -324,7 +325,7 @@ export default {
324325
<web-ide-link
325326
v-if="glFeatures.blobOverflowMenu && showWebIdeLink"
326327
:show-edit-button="!isBinaryFileType"
327-
class="!gl-ml-auto gl-mr-0"
328+
class="!gl-m-0"
328329
:edit-url="blobInfo.editBlobPath"
329330
:web-ide-url="blobInfo.ideEditPath"
330331
:needs-to-fork="shouldShowSingleFileEditorForkSuggestion"
Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
<script>
2-
import { GlBadge, GlIcon } from '@gitlab/ui';
2+
import { GlIcon, GlAvatar, GlAvatarsInline, GlTooltipDirective } from '@gitlab/ui';
33
import { getTimeago } from '~/lib/utils/datetime/timeago_utility';
4+
import { n__ } from '~/locale';
45
56
export default {
67
name: 'MergeRequestListItem',
78
components: {
8-
GlBadge,
99
GlIcon,
10+
GlAvatar,
11+
GlAvatarsInline,
1012
},
13+
directives: { GlTooltip: GlTooltipDirective },
1114
props: {
1215
mergeRequest: {
1316
type: Object,
@@ -18,40 +21,53 @@ export default {
1821
formattedTime() {
1922
return getTimeago().format(this.mergeRequest.createdAt);
2023
},
21-
mrMetaInfo() {
22-
return `${this.mergeRequest.project.fullPath} !${this.mergeRequest.iid}`;
24+
assignees() {
25+
const assignees = this.mergeRequest.assignees?.nodes;
26+
return assignees.length ? assignees : [this.mergeRequest.author];
27+
},
28+
assigneesBadgeSrOnlyText() {
29+
return n__(
30+
'%d additional assignee',
31+
'%d additional assignees',
32+
this.assignees.length - this.$options.MAX_VISIBLE_ASSIGNEES,
33+
);
2334
},
2435
},
36+
MAX_VISIBLE_ASSIGNEES: 3,
2537
};
2638
</script>
2739
2840
<template>
29-
<div class="gl-flex gl-flex-col gl-gap-1 gl-p-2">
30-
<div class="gl-flex gl-items-center gl-justify-between">
31-
<div class="gl-inline-flex gl-items-center gl-gap-2">
32-
<gl-badge class="gl-mr-2" variant="success">
33-
<gl-icon name="merge-request" />
34-
{{ s__('OpenMrBadge|Open') }}
35-
</gl-badge>
36-
<span class="gl-text-subtle">
41+
<div class="gl-flex">
42+
<div class="gl-flex">
43+
<gl-icon name="merge-request" class="gl-mr-3 gl-flex-shrink-0" />
44+
<div class="gl-flex-grow">
45+
<div class="gl-mb-1 gl-mr-2 gl-line-clamp-2">
46+
{{ mergeRequest.title }}
47+
</div>
48+
<span class="gl-text-sm gl-text-secondary">
3749
{{ s__('OpenMrBadge|Opened') }} <time v-text="formattedTime"></time
3850
></span>
3951
</div>
4052
</div>
41-
<h5 class="my-2">{{ mergeRequest.title }}</h5>
42-
<div class="gl-flex gl-flex-col gl-gap-1 gl-text-subtle" data-testid="project-info">
43-
<div class="gl-flex gl-gap-1"><gl-icon name="project" />{{ mrMetaInfo }}</div>
44-
<div
45-
v-for="assignee in mergeRequest.assignees.nodes"
46-
:key="assignee.id"
47-
class="gl-flex gl-gap-1"
48-
data-testid="assignee-info"
53+
<div class="gl-ml-auto">
54+
<gl-avatars-inline
55+
:avatars="assignees"
56+
:collapsed="true"
57+
:avatar-size="24"
58+
:max-visible="$options.MAX_VISIBLE_ASSIGNEES"
59+
:badge-sr-only-text="assigneesBadgeSrOnlyText"
4960
>
50-
<gl-icon name="user" />{{ assignee.name }}
51-
</div>
52-
<div class="gl-flex gl-gap-1" data-testid="source-branch-info">
53-
<gl-icon name="branch" />{{ mergeRequest.sourceBranch }}
54-
</div>
61+
<template #avatar="{ avatar }">
62+
<gl-avatar
63+
v-gl-tooltip
64+
:size="24"
65+
:src="avatar.avatarUrl"
66+
:alt="avatar.name"
67+
:title="avatar.name"
68+
/>
69+
</template>
70+
</gl-avatars-inline>
5571
</div>
5672
</div>
5773
</template>

app/assets/javascripts/repository/components/header_area/open_mr_badge.vue

Lines changed: 70 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
<script>
2-
import { GlBadge, GlPopover, GlSkeletonLoader } from '@gitlab/ui';
2+
import {
3+
GlBadge,
4+
GlDisclosureDropdown,
5+
GlDisclosureDropdownItem,
6+
GlSkeletonLoader,
7+
GlTooltipDirective,
8+
} from '@gitlab/ui';
39
import { sprintf, s__ } from '~/locale';
10+
import { visitUrl } from '~/lib/utils/url_utility';
411
import getOpenMrCountForBlobPath from '~/repository/queries/open_mr_count.query.graphql';
512
import getOpenMrsForBlobPath from '~/repository/queries/open_mrs.query.graphql';
613
import { nDaysBefore } from '~/lib/utils/datetime/date_calculation_utility';
@@ -14,10 +21,12 @@ const OPEN_MR_AGE_LIMIT_DAYS = 30;
1421
export default {
1522
components: {
1623
GlBadge,
17-
GlPopover,
24+
GlDisclosureDropdown,
25+
GlDisclosureDropdownItem,
1826
GlSkeletonLoader,
1927
MergeRequestListItem,
2028
},
29+
directives: { GlTooltip: GlTooltipDirective },
2130
inject: ['currentRef'],
2231
props: {
2332
projectPath: {
@@ -33,12 +42,17 @@ export default {
3342
return {
3443
openMrsCount: null,
3544
openMrs: [],
36-
isPopoverOpen: false,
45+
isDropdownOpen: false,
3746
};
3847
},
3948
computed: {
49+
badgeTitle() {
50+
return s__(
51+
'OpenMrBadge|Open merge requests created in the past 30 days that target this branch and modify this file.',
52+
);
53+
},
4054
openMRsCountText() {
41-
return sprintf(s__('OpenMrBadge|%{count} open'), { count: this.openMrsCount });
55+
return sprintf(s__('OpenMrBadge|%{count} Open'), { count: this.openMrsCount });
4256
},
4357
createdAfter() {
4458
const lookbackDate = nDaysBefore(new Date(), OPEN_MR_AGE_LIMIT_DAYS - 1, { utc: true });
@@ -82,7 +96,7 @@ export default {
8296
return this.queryVariables;
8397
},
8498
skip() {
85-
return !this.isPopoverOpen;
99+
return !this.isDropdownOpen;
86100
},
87101
update: (data) => data?.project?.mergeRequests?.nodes || [],
88102
error(error) {
@@ -94,34 +108,62 @@ export default {
94108
},
95109
},
96110
},
111+
methods: {
112+
handleMergeRequestClick(webUrl) {
113+
visitUrl(webUrl);
114+
},
115+
},
97116
};
98117
</script>
99118
100119
<template>
101-
<div id="open-mr-badge">
102-
<gl-badge v-if="showBadge" variant="success" icon="merge-request">
103-
{{ openMRsCountText }}
104-
</gl-badge>
105-
<gl-popover
106-
target="open-mr-badge"
107-
boundary="viewport"
108-
placement="bottomleft"
109-
@show.once="isPopoverOpen = true"
110-
@hide.once="isPopoverOpen = false"
111-
>
112-
<gl-skeleton-loader v-if="!openMrs.length || isLoading" :height="15">
120+
<gl-disclosure-dropdown
121+
v-if="showBadge"
122+
:aria-label="openMRsCountText"
123+
:fluid-width="true"
124+
:loading="isLoading"
125+
placement="bottom-end"
126+
@shown="isDropdownOpen = true"
127+
@hidden="isDropdownOpen = false"
128+
>
129+
<template #toggle>
130+
<button class="gl-rounded-pill gl-border-none gl-bg-transparent gl-p-0 gl-leading-0">
131+
<gl-badge
132+
v-gl-tooltip
133+
data-testid="open-mr-badge"
134+
variant="success"
135+
icon="merge-request"
136+
class="gl-h-full"
137+
:title="badgeTitle"
138+
:aria-label="badgeTitle"
139+
>
140+
{{ openMRsCountText }}
141+
</gl-badge>
142+
</button>
143+
</template>
144+
145+
<template #header>
146+
<div class="gl-border-b-1 gl-border-gray-100 gl-p-4 gl-font-bold gl-border-b-solid">
147+
{{ s__('OpenMrBadge|Open merge requests') }}
148+
<gl-badge>{{ openMrsCount }}</gl-badge>
149+
</div>
150+
</template>
151+
152+
<div v-if="!openMrs.length || isLoading" class="gl-w-34 gl-px-5 gl-py-3 md:gl-w-48">
153+
<gl-skeleton-loader :height="15">
113154
<rect width="250" height="15" rx="4" />
114155
</gl-skeleton-loader>
115-
<ul v-else class="flex-column gl-m-0 gl-flex gl-list-none gl-gap-4 gl-p-0">
116-
<li
117-
v-for="(mergeRequest, index) in openMrs"
118-
:key="mergeRequest.iid"
119-
class="gl-p-0"
120-
:class="{ 'gl-border-t gl-pt-4': index !== 0 }"
121-
>
156+
</div>
157+
<ul v-else class="gl-m-0 gl-w-34 gl-p-0 md:gl-w-48">
158+
<gl-disclosure-dropdown-item
159+
v-for="mergeRequest in openMrs"
160+
:key="mergeRequest.iid"
161+
@action="handleMergeRequestClick(mergeRequest.webUrl)"
162+
>
163+
<template #list-item>
122164
<merge-request-list-item :merge-request="mergeRequest" />
123-
</li>
124-
</ul>
125-
</gl-popover>
126-
</div>
165+
</template>
166+
</gl-disclosure-dropdown-item>
167+
</ul>
168+
</gl-disclosure-dropdown>
127169
</template>

app/assets/javascripts/repository/queries/open_mrs.query.graphql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ query getOpenMrsForBlobPath(
1818
id
1919
iid
2020
title
21+
webUrl
2122
createdAt
23+
author {
24+
...User
25+
}
2226
assignees {
2327
nodes {
2428
...User

app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ export default {
6363
actions() {
6464
const actions = [];
6565
66-
if (this.mr.canRevertInCurrentMR) {
66+
if (this.mr.revertInForkPath) {
6767
actions.push({
6868
text: this.revertLabel,
6969
tooltipText: this.revertTitle,
70+
href: this.mr.revertInForkPath,
7071
testId: 'revert-button',
71-
onClick: () => this.openRevertModal(),
72+
dataMethod: 'post',
7273
});
73-
} else if (this.mr.revertInForkPath) {
74+
} else {
7475
actions.push({
7576
text: this.revertLabel,
7677
tooltipText: this.revertTitle,
77-
href: this.mr.revertInForkPath,
7878
testId: 'revert-button',
79-
dataMethod: 'post',
79+
onClick: () => this.openRevertModal(),
8080
});
8181
}
8282

app/assets/javascripts/vue_shared/components/page_heading.vue

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,29 @@ export default {
1616
</script>
1717

1818
<template>
19-
<div>
20-
<div class="gl-my-5 gl-flex gl-flex-wrap gl-items-center gl-justify-between gl-gap-y-3">
19+
<div class="gl-my-5 gl-flex gl-flex-wrap gl-items-center gl-justify-between gl-gap-y-3">
20+
<div
21+
class="gl-flex gl-w-full gl-flex-wrap gl-justify-between gl-gap-x-5 gl-gap-y-3 md:gl-flex-nowrap"
22+
>
23+
<h1 class="gl-heading-1 !gl-m-0" data-testid="page-heading">
24+
<slot name="heading"></slot>
25+
<template v-if="!$scopedSlots.heading">{{ heading }}</template>
26+
</h1>
2127
<div
22-
class="gl-flex gl-w-full gl-flex-wrap gl-justify-between gl-gap-x-5 gl-gap-y-3 md:gl-flex-nowrap"
28+
v-if="$scopedSlots.actions"
29+
class="page-heading-actions gl-flex gl-shrink-0 gl-flex-wrap gl-items-center gl-gap-3 md:gl-mt-1 lg:gl-mt-2"
30+
:class="{ 'gl-w-full sm:gl-w-auto': !inlineActions, 'gl-w-auto': inlineActions }"
31+
data-testid="page-heading-actions"
2332
>
24-
<h1 class="gl-heading-1 !gl-m-0" data-testid="page-heading">
25-
<slot name="heading"></slot>
26-
<template v-if="!$scopedSlots.heading">{{ heading }}</template>
27-
</h1>
28-
<div
29-
v-if="$scopedSlots.actions"
30-
class="page-heading-actions gl-flex gl-shrink-0 gl-flex-wrap gl-items-center gl-gap-3 md:gl-mt-1 lg:gl-mt-2"
31-
:class="{ 'gl-w-full sm:gl-w-auto': !inlineActions, 'gl-w-auto': inlineActions }"
32-
data-testid="page-heading-actions"
33-
>
34-
<slot name="actions"></slot>
35-
</div>
36-
</div>
37-
<div
38-
v-if="$scopedSlots.description"
39-
class="gl-w-full gl-text-subtle"
40-
data-testid="page-heading-description"
41-
>
42-
<slot name="description"></slot>
33+
<slot name="actions"></slot>
4334
</div>
4435
</div>
36+
<div
37+
v-if="$scopedSlots.description"
38+
class="gl-w-full gl-text-subtle"
39+
data-testid="page-heading-description"
40+
>
41+
<slot name="description"></slot>
42+
</div>
4543
</div>
4644
</template>

app/controllers/concerns/creates_commit.rb

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def create_commit(service, success_path:, failure_path:, failure_view: nil, succ
4242
format.json { render json: { message: _("success"), filePath: success_path } }
4343
end
4444
else
45-
flash[:alert] = format_flash_notice(result[:message])
45+
flash[:alert] = flash_message(result, @project, @branch_name, @commit_params)
46+
4647
failure_path = failure_path.call if failure_path.respond_to?(:call)
4748

4849
respond_to do |format|
@@ -77,6 +78,21 @@ def format_flash_notice(message)
7778

7879
private
7980

81+
def flash_message(result, project, branch_name, commit_params)
82+
if result[:status] == :error && commit_params[:revert]
83+
{
84+
message: format_flash_notice(result[:message]),
85+
button_text: _('Create merge request'),
86+
button_path: project_new_merge_request_path(
87+
project,
88+
merge_request: { source_branch: branch_name }
89+
)
90+
}
91+
else
92+
format_flash_notice(result[:message])
93+
end
94+
end
95+
8096
def update_flash_notice(success_notice, success_path)
8197
changes_link = ActionController::Base.helpers.link_to _('changes'), success_path, class: 'gl-link'
8298

0 commit comments

Comments
 (0)