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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

88 lines
2.3 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
2023-04-23 21:23:45 +05:30
import { TYPE_ISSUE } from '~/issues/constants';
2021-01-03 14:25:43 +05:30
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,
2023-04-23 21:23:45 +05:30
default: TYPE_ISSUE,
2021-01-03 14:25:43 +05:30
},
},
computed: {
hasNoUsers() {
return !this.users.length;
},
sortedReviewers() {
2022-08-27 11:52:29 +05:30
const canMergeUsers = this.users.filter((user) => user.mergeRequestInteraction?.canMerge);
const canNotMergeUsers = this.users.filter((user) => !user.mergeRequestInteraction?.canMerge);
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-01-03 14:25:43 +05:30
},
};
</script>
<template>
<div>
<collapsed-reviewer-list :users="sortedReviewers" :issuable-type="issuableType" />
<div class="value hide-collapsed">
2023-03-04 22:38:38 +05:30
<span v-if="hasNoUsers" class="no-value" data-testid="no-value">
{{ __('None') }}
<template v-if="editable">
-
<button
type="button"
class="gl-button btn-link gl-reset-color!"
data-testid="assign-yourself"
data-qa-selector="assign_yourself_button"
@click="assignSelf"
>
{{ __('assign yourself') }}
</button>
</template>
</span>
2021-01-03 14:25:43 +05:30
<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-01-03 14:25:43 +05:30
/>
</div>
</div>
</template>