debian-mirror-gitlab/app/assets/javascripts/sidebar/components/reviewers/reviewers.vue

81 lines
2 KiB
Vue
Raw Normal View History

2021-01-03 14:25:43 +05:30
<script>
// NOTE! For the first iteration, we are simply copying the implementation of Assignees
// It will soon be overhauled in Issue https://gitlab.com/gitlab-org/gitlab/-/issues/233736
import CollapsedReviewerList from './collapsed_reviewer_list.vue';
import UncollapsedReviewerList from './uncollapsed_reviewer_list.vue';
export default {
// name: 'Reviewers' is a false positive: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26#possible-false-positives
// eslint-disable-next-line @gitlab/require-i18n-strings
name: 'Reviewers',
components: {
CollapsedReviewerList,
UncollapsedReviewerList,
},
props: {
rootPath: {
type: String,
required: true,
},
users: {
type: Array,
required: true,
},
editable: {
type: Boolean,
required: true,
},
issuableType: {
type: String,
required: false,
default: 'issue',
},
},
computed: {
hasNoUsers() {
return !this.users.length;
},
sortedReviewers() {
2021-03-08 18:12:59 +05:30
const canMergeUsers = this.users.filter((user) => user.can_merge);
const canNotMergeUsers = this.users.filter((user) => !user.can_merge);
2021-01-03 14:25:43 +05:30
return [...canMergeUsers, ...canNotMergeUsers];
},
},
methods: {
assignSelf() {
this.$emit('assign-self');
},
2021-03-11 19:13:27 +05:30
requestReview(data) {
this.$emit('request-review', data);
},
2021-12-11 22:18:48 +05:30
toggleAttentionRequested(data) {
this.$emit('toggle-attention-requested', data);
},
2021-01-03 14:25:43 +05:30
},
};
</script>
<template>
<div>
<collapsed-reviewer-list :users="sortedReviewers" :issuable-type="issuableType" />
<div class="value hide-collapsed">
<template v-if="hasNoUsers">
2021-09-04 01:27:46 +05:30
<span class="no-value">
2021-01-03 14:25:43 +05:30
{{ __('None') }}
</span>
</template>
<uncollapsed-reviewer-list
v-else
:users="sortedReviewers"
:root-path="rootPath"
:issuable-type="issuableType"
2021-03-11 19:13:27 +05:30
@request-review="requestReview"
2021-12-11 22:18:48 +05:30
@toggle-attention-requested="toggleAttentionRequested"
2021-01-03 14:25:43 +05:30
/>
</div>
</div>
</template>