Skip to content
代码片段 群组 项目
未验证 提交 05f6ebfe 编辑于 作者: Jacques Erasmus's avatar Jacques Erasmus 提交者: GitLab
浏览文件

Merge branch '388129-ui-update' into 'master'

Adjust Branch Rules Settings UI to new designs

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/148696



Merged-by: default avatarJacques Erasmus <jerasmus@gitlab.com>
Approved-by: default avatarMichael Le <mle@gitlab.com>
Approved-by: default avatarTomas Vik <tvik@gitlab.com>
Approved-by: default avatarJacques Erasmus <jerasmus@gitlab.com>
Reviewed-by: default avatarJacques Erasmus <jerasmus@gitlab.com>
Co-authored-by: default avatarpsjakubowska <psedlak-jakubowska@gitlab.com>
No related branches found
No related tags found
1 合并请求!2419Fix TanukiBot spec relying on outdated code
...@@ -5,8 +5,8 @@ export const I18N = { ...@@ -5,8 +5,8 @@ export const I18N = {
deleteRule: s__('BranchRules|Delete rule'), deleteRule: s__('BranchRules|Delete rule'),
manageProtectionsLinkTitle: s__('BranchRules|Manage in protected branches'), manageProtectionsLinkTitle: s__('BranchRules|Manage in protected branches'),
targetBranch: s__('BranchRules|Target branch'), targetBranch: s__('BranchRules|Target branch'),
ruleTarget: s__('BranchRules|Rule target'),
branchNameOrPattern: s__('BranchRules|Branch name or pattern'), branchNameOrPattern: s__('BranchRules|Branch name or pattern'),
branch: s__('BranchRules|Target branch'),
allBranches: s__('BranchRules|All branches'), allBranches: s__('BranchRules|All branches'),
matchingBranchesLinkTitle: s__('BranchRules|%{total} matching %{subject}'), matchingBranchesLinkTitle: s__('BranchRules|%{total} matching %{subject}'),
protectBranchTitle: s__('BranchRules|Protect branch'), protectBranchTitle: s__('BranchRules|Protect branch'),
...@@ -45,7 +45,6 @@ export const I18N = { ...@@ -45,7 +45,6 @@ export const I18N = {
'BranchRules|Are you sure you want to delete this branch rule? This action cannot be undone.', 'BranchRules|Are you sure you want to delete this branch rule? This action cannot be undone.',
), ),
deleteRuleModalDeleteText: s__('BranchRules|Delete branch rule'), deleteRuleModalDeleteText: s__('BranchRules|Delete branch rule'),
targetRule: s__('BranchRules|Target branch'),
updateTargetRule: s__('BranchRules|Update target branch'), updateTargetRule: s__('BranchRules|Update target branch'),
update: s__('BranchRules|Update'), update: s__('BranchRules|Update'),
edit: s__('BranchRules|Edit'), edit: s__('BranchRules|Edit'),
......
...@@ -162,14 +162,6 @@ export default { ...@@ -162,14 +162,6 @@ export default {
allBranches() { allBranches() {
return this.branch === ALL_BRANCHES_WILDCARD; return this.branch === ALL_BRANCHES_WILDCARD;
}, },
allBranchesLabel() {
return this.$options.i18n.allBranches;
},
branchTitle() {
return this.allBranches
? this.$options.i18n.targetBranch
: this.$options.i18n.branchNameOrPattern;
},
matchingBranchesLinkHref() { matchingBranchesLinkHref() {
return mergeUrlParams({ state: 'all', search: `^${this.branch}$` }, this.branchesPath); return mergeUrlParams({ state: 'all', search: `^${this.branch}$` }, this.branchesPath);
}, },
...@@ -237,42 +229,45 @@ export default { ...@@ -237,42 +229,45 @@ export default {
<template> <template>
<div> <div>
<div class="gl-display-flex gl-justify-content-space-between gl-align-items-center"> <div class="gl-display-flex gl-justify-content-space-between gl-align-items-center">
<h3 class="gl-mb-5">{{ $options.i18n.pageTitle }}</h3> <h1 class="h3 gl-mb-5">{{ $options.i18n.pageTitle }}</h1>
<gl-button <gl-button
v-if="glFeatures.editBranchRules && branchRule" v-if="glFeatures.editBranchRules && branchRule"
v-gl-modal="$options.deleteModalId" v-gl-modal="$options.deleteModalId"
data-testid="delete-rule-button" data-testid="delete-rule-button"
category="secondary" category="secondary"
variant="danger" variant="danger"
:disabled="$apollo.loading"
>{{ $options.i18n.deleteRule }} >{{ $options.i18n.deleteRule }}
</gl-button> </gl-button>
</div> </div>
<gl-loading-icon v-if="$apollo.loading" /> <gl-loading-icon v-if="$apollo.loading" size="lg" />
<div v-else-if="!branchRule">{{ $options.i18n.noData }}</div> <div v-else-if="!branchRule">{{ $options.i18n.noData }}</div>
<div v-else> <div v-else>
<gl-card> <gl-card
class="gl-new-card"
header-class="gl-new-card-header"
body-class="gl-new-card-body gl-p-5"
>
<template #header> <template #header>
<div class="gl-display-flex gl-justify-content-space-between"> <strong>{{ $options.i18n.ruleTarget }}</strong>
<strong>{{ $options.i18n.targetRule }}</strong> <gl-button
<gl-button v-if="glFeatures.addBranchRule || glFeatures.editBranchRules"
v-if="glFeatures.addBranchRule || glFeatures.editBranchRules" v-gl-modal="$options.editModalId"
v-gl-modal="$options.editModalId" data-testid="edit-rule-button"
data-testid="edit-rule-button" size="small"
size="small" >{{ $options.i18n.edit }}</gl-button
>{{ $options.i18n.edit }}</gl-button >
>
</div>
</template> </template>
<div v-if="allBranches" class="gl-mt-2" data-testid="all-branches"> <div v-if="allBranches" class="gl-mt-2" data-testid="all-branches">
{{ allBranchesLabel }} {{ $options.i18n.allBranches }}
</div> </div>
<code v-else class="gl-mt-2" data-testid="branch">{{ branch }}</code> <code v-else class="gl-bg-none p-0 gl-font-base" data-testid="branch">{{ branch }}</code>
<p v-if="matchingBranchesCount" class="gl-mt-3 gl-mb-0"> <p v-if="matchingBranchesCount" class="gl-mt-3 gl-mb-0">
<gl-link :href="matchingBranchesLinkHref">{{ matchingBranchesLinkTitle }}</gl-link> <gl-link :href="matchingBranchesLinkHref">{{ matchingBranchesLinkTitle }}</gl-link>
</p> </p>
</gl-card> </gl-card>
<h4 class="gl-mb-1 gl-mt-5">{{ $options.i18n.protectBranchTitle }}</h4> <h2 class="h4 gl-mb-1 gl-mt-5">{{ $options.i18n.protectBranchTitle }}</h2>
<gl-sprintf :message="$options.i18n.protectBranchDescription"> <gl-sprintf :message="$options.i18n.protectBranchDescription">
<template #link="{ content }"> <template #link="{ content }">
<gl-link :href="$options.protectedBranchesHelpDocLink"> <gl-link :href="$options.protectedBranchesHelpDocLink">
...@@ -280,121 +275,121 @@ export default { ...@@ -280,121 +275,121 @@ export default {
</gl-link> </gl-link>
</template> </template>
</gl-sprintf> </gl-sprintf>
</div>
<!-- Allowed to push -->
<protection
class="gl-mt-3"
:header="allowedToPushHeader"
:header-link-title="$options.i18n.manageProtectionsLinkTitle"
:header-link-href="protectedBranchesPath"
:roles="pushAccessLevels.roles"
:users="pushAccessLevels.users"
:groups="pushAccessLevels.groups"
data-testid="allowed-to-push-content"
/>
<!-- Allowed to merge --> <!-- Allowed to push -->
<protection <protection
:header="allowedToMergeHeader" class="gl-mt-3"
:header-link-title="$options.i18n.manageProtectionsLinkTitle" :header="allowedToPushHeader"
:header-link-href="protectedBranchesPath" :header-link-title="$options.i18n.manageProtectionsLinkTitle"
:roles="mergeAccessLevels.roles" :header-link-href="protectedBranchesPath"
:users="mergeAccessLevels.users" :roles="pushAccessLevels.roles"
:groups="mergeAccessLevels.groups" :users="pushAccessLevels.users"
data-testid="allowed-to-merge-content" :groups="pushAccessLevels.groups"
/> data-testid="allowed-to-push-content"
<!-- Force push -->
<div class="gl-display-flex gl-align-items-center">
<gl-icon
:size="14"
data-testid="force-push-icon"
:name="forcePushAttributes.icon"
:class="forcePushAttributes.iconClass"
/> />
<strong class="gl-ml-2">{{ forcePushAttributes.title }}</strong>
</div>
<div class="gl-text-gray-400 gl-mb-2">{{ $options.i18n.forcePushDescription }}</div> <!-- Allowed to merge -->
<protection
:header="allowedToMergeHeader"
:header-link-title="$options.i18n.manageProtectionsLinkTitle"
:header-link-href="protectedBranchesPath"
:roles="mergeAccessLevels.roles"
:users="mergeAccessLevels.users"
:groups="mergeAccessLevels.groups"
data-testid="allowed-to-merge-content"
/>
<!-- EE start --> <!-- Force push -->
<!-- Code Owners -->
<div v-if="showCodeOwners">
<div class="gl-display-flex gl-align-items-center"> <div class="gl-display-flex gl-align-items-center">
<gl-icon <gl-icon
data-testid="code-owners-icon"
:size="14" :size="14"
:name="codeOwnersApprovalAttributes.icon" data-testid="force-push-icon"
:class="codeOwnersApprovalAttributes.iconClass" :name="forcePushAttributes.icon"
:class="forcePushAttributes.iconClass"
/> />
<strong class="gl-ml-2">{{ codeOwnersApprovalAttributes.title }}</strong> <strong class="gl-ml-2">{{ forcePushAttributes.title }}</strong>
</div> </div>
<div class="gl-text-gray-400">{{ codeOwnersApprovalAttributes.description }}</div> <div class="gl-text-gray-400 gl-mb-2">{{ $options.i18n.forcePushDescription }}</div>
</div>
<!-- Approvals --> <!-- EE start -->
<template v-if="showApprovers"> <!-- Code Owners -->
<h4 class="gl-mb-1 gl-mt-5">{{ $options.i18n.approvalsTitle }}</h4> <div v-if="showCodeOwners">
<gl-sprintf :message="$options.i18n.approvalsDescription"> <div class="gl-display-flex gl-align-items-center">
<template #link="{ content }"> <gl-icon
<gl-link :href="$options.approvalsHelpDocLink"> data-testid="code-owners-icon"
{{ content }} :size="14"
</gl-link> :name="codeOwnersApprovalAttributes.icon"
</template> :class="codeOwnersApprovalAttributes.iconClass"
</gl-sprintf> />
<strong class="gl-ml-2">{{ codeOwnersApprovalAttributes.title }}</strong>
</div>
<approval-rules-app <div class="gl-text-gray-400">{{ codeOwnersApprovalAttributes.description }}</div>
:is-mr-edit="false" </div>
:is-branch-rules-edit="true"
@submitted="$apollo.queries.project.refetch()"
>
<template #rules>
<project-rules :is-branch-rules-edit="true" />
</template>
</approval-rules-app>
</template>
<!-- Status checks --> <!-- Approvals -->
<template v-if="showStatusChecks"> <template v-if="showApprovers">
<h4 class="gl-mb-1 gl-mt-5">{{ $options.i18n.statusChecksTitle }}</h4> <h2 class="h4 gl-mb-1 gl-mt-5">{{ $options.i18n.approvalsTitle }}</h2>
<gl-sprintf :message="$options.i18n.statusChecksDescription"> <gl-sprintf :message="$options.i18n.approvalsDescription">
<template #link="{ content }"> <template #link="{ content }">
<gl-link :href="$options.statusChecksHelpDocLink"> <gl-link :href="$options.approvalsHelpDocLink">
{{ content }} {{ content }}
</gl-link> </gl-link>
</template> </template>
</gl-sprintf> </gl-sprintf>
<protection <approval-rules-app
class="gl-mt-3" :is-mr-edit="false"
:header="statusChecksHeader" :is-branch-rules-edit="true"
:header-link-title="$options.i18n.statusChecksLinkTitle" @submitted="$apollo.queries.project.refetch()"
:header-link-href="statusChecksPath" >
:status-checks="statusChecks" <template #rules>
/> <project-rules :is-branch-rules-edit="true" />
</template> </template>
<!-- EE end --> </approval-rules-app>
<gl-modal </template>
v-if="glFeatures.editBranchRules"
:ref="$options.deleteModalId" <!-- Status checks -->
:modal-id="$options.deleteModalId" <template v-if="showStatusChecks">
:title="$options.i18n.deleteRuleModalTitle" <h2 class="h4 gl-mb-1 gl-mt-5">{{ $options.i18n.statusChecksTitle }}</h2>
:ok-title="$options.i18n.deleteRuleModalDeleteText" <gl-sprintf :message="$options.i18n.statusChecksDescription">
ok-variant="danger" <template #link="{ content }">
@ok="deleteBranchRule" <gl-link :href="$options.statusChecksHelpDocLink">
> {{ content }}
<p>{{ $options.i18n.deleteRuleModalText }}</p> </gl-link>
</gl-modal> </template>
</gl-sprintf>
<protection
class="gl-mt-3"
:header="statusChecksHeader"
:header-link-title="$options.i18n.statusChecksLinkTitle"
:header-link-href="statusChecksPath"
:status-checks="statusChecks"
/>
</template>
<!-- EE end -->
<gl-modal
v-if="glFeatures.editBranchRules"
:ref="$options.deleteModalId"
:modal-id="$options.deleteModalId"
:title="$options.i18n.deleteRuleModalTitle"
:ok-title="$options.i18n.deleteRuleModalDeleteText"
ok-variant="danger"
@ok="deleteBranchRule"
>
<p>{{ $options.i18n.deleteRuleModalText }}</p>
</gl-modal>
<branch-rule-modal <branch-rule-modal
v-if="glFeatures.editBranchRules" v-if="glFeatures.editBranchRules"
:id="$options.editModalId" :id="$options.editModalId"
:ref="$options.editModalId" :ref="$options.editModalId"
:title="$options.i18n.updateTargetRule" :title="$options.i18n.updateTargetRule"
:action-primary-text="$options.i18n.update" :action-primary-text="$options.i18n.update"
@primary="editBranchRule({ name: $event })" @primary="editBranchRule({ name: $event })"
/> />
</div>
</div> </div>
</template> </template>
...@@ -64,12 +64,14 @@ export default { ...@@ -64,12 +64,14 @@ export default {
</script> </script>
<template> <template>
<gl-card class="gl-mb-5" body-class="gl-py-0"> <gl-card
class="gl-new-card gl-mb-5"
header-class="gl-new-card-header"
body-class="gl-new-card-body gl-px-5"
>
<template #header> <template #header>
<div class="gl-display-flex gl-justify-content-space-between"> <strong>{{ header }}</strong>
<strong>{{ header }}</strong> <gl-link :href="headerLinkHref">{{ headerLinkTitle }}</gl-link>
<gl-link :href="headerLinkHref">{{ headerLinkTitle }}</gl-link>
</div>
</template> </template>
<!-- Roles --> <!-- Roles -->
......
...@@ -94,7 +94,12 @@ export default { ...@@ -94,7 +94,12 @@ export default {
:href="avatar.webUrl" :href="avatar.webUrl"
:title="avatar.name" :title="avatar.name"
> >
<gl-avatar :src="avatar.avatarUrl" :label="avatar.name" :size="$options.AVATAR_SIZE" /> <gl-avatar
:src="avatar.avatarUrl"
:label="avatar.name"
:alt="avatar.name"
:size="$options.AVATAR_SIZE"
/>
</gl-avatar-link> </gl-avatar-link>
</template> </template>
</gl-avatars-inline> </gl-avatars-inline>
......
...@@ -9037,6 +9037,9 @@ msgstr "" ...@@ -9037,6 +9037,9 @@ msgstr ""
msgid "BranchRules|Roles" msgid "BranchRules|Roles"
msgstr "" msgstr ""
   
msgid "BranchRules|Rule target"
msgstr ""
msgid "BranchRules|Select Branch or create wildcard" msgid "BranchRules|Select Branch or create wildcard"
msgstr "" msgstr ""
   
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册