diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-24 18:11:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-24 18:11:29 +0300 |
commit | cb9b55e662d4164d913ef7031adc135d3ea4d9f0 (patch) | |
tree | 0da3d639eb5f981cc73f3c72648351e56fedd971 /app/assets/javascripts/projects | |
parent | d5f67e75b6ef8ebc1b304589005ccd91ea6674ff (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/projects')
3 files changed, 29 insertions, 6 deletions
diff --git a/app/assets/javascripts/projects/settings/repository/branch_rules/app.vue b/app/assets/javascripts/projects/settings/repository/branch_rules/app.vue index 94793a535cc..ea4b657fe80 100644 --- a/app/assets/javascripts/projects/settings/repository/branch_rules/app.vue +++ b/app/assets/javascripts/projects/settings/repository/branch_rules/app.vue @@ -50,7 +50,12 @@ export default { <template> <div class="settings-content"> - <branch-rule v-for="rule in branchRules" :key="rule.name" :name="rule.name" /> + <branch-rule + v-for="rule in branchRules" + :key="rule.name" + :name="rule.name" + :branch-protection="rule.branchProtection" + /> <span v-if="!branchRules.length" data-testid="empty">{{ $options.i18n.emptyState }}</span> </div> diff --git a/app/assets/javascripts/projects/settings/repository/branch_rules/components/branch_rule.vue b/app/assets/javascripts/projects/settings/repository/branch_rules/components/branch_rule.vue index 2b88f8561d7..cdf8c36d52c 100644 --- a/app/assets/javascripts/projects/settings/repository/branch_rules/components/branch_rule.vue +++ b/app/assets/javascripts/projects/settings/repository/branch_rules/components/branch_rule.vue @@ -6,6 +6,8 @@ export const i18n = { defaultLabel: s__('BranchRules|default'), protectedLabel: s__('BranchRules|protected'), detailsButtonLabel: s__('BranchRules|Details'), + allowForcePush: s__('BranchRules|Allowed to force push'), + codeOwnerApprovalRequired: s__('BranchRules|Requires CODEOWNERS approval'), }; export default { @@ -35,19 +37,29 @@ export default { required: false, default: false, }, - approvalDetails: { - type: Array, + branchProtection: { + type: Object, required: false, - default: () => [], + default: () => {}, }, }, computed: { hasApprovalDetails() { - return this.approvalDetails && this.approvalDetails.length; + return this.approvalDetails.length; }, detailsPath() { return `${this.branchRulesPath}?branch=${this.name}`; }, + approvalDetails() { + const approvalDetails = []; + if (this.branchProtection.allowForcePush) { + approvalDetails.push(this.$options.i18n.allowForcePush); + } + if (this.branchProtection.codeOwnerApprovalRequired) { + approvalDetails.push(this.$options.i18n.codeOwnerApprovalRequired); + } + return approvalDetails; + }, }, }; </script> @@ -69,6 +81,8 @@ export default { <li v-for="(detail, index) in approvalDetails" :key="index">{{ detail }}</li> </ul> </div> - <gl-button :href="detailsPath"> {{ $options.i18n.detailsButtonLabel }}</gl-button> + <gl-button class="gl-align-self-start" :href="detailsPath"> + {{ $options.i18n.detailsButtonLabel }}</gl-button + > </div> </template> diff --git a/app/assets/javascripts/projects/settings/repository/branch_rules/graphql/queries/branch_rules.query.graphql b/app/assets/javascripts/projects/settings/repository/branch_rules/graphql/queries/branch_rules.query.graphql index 104a0c25a80..20b99702f68 100644 --- a/app/assets/javascripts/projects/settings/repository/branch_rules/graphql/queries/branch_rules.query.graphql +++ b/app/assets/javascripts/projects/settings/repository/branch_rules/graphql/queries/branch_rules.query.graphql @@ -4,6 +4,10 @@ query getBranchRules($projectPath: ID!) { branchRules { nodes { name + branchProtection { + allowForcePush + codeOwnerApprovalRequired + } } } } |