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

77 lines
1.8 KiB
Vue
Raw Normal View History

2018-03-27 19:54:05 +05:30
<script>
2020-05-24 23:13:21 +05:30
import CollapsedAssigneeList from './collapsed_assignee_list.vue';
import UncollapsedAssigneeList from './uncollapsed_assignee_list.vue';
2018-10-15 14:42:47 +05:30
2018-03-27 19:54:05 +05:30
export default {
2019-10-12 21:52:04 +05:30
// name: 'Assignees' is a false positive: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26#possible-false-positives
2020-04-22 19:07:51 +05:30
// eslint-disable-next-line @gitlab/require-i18n-strings
2018-03-27 19:54:05 +05:30
name: 'Assignees',
2019-12-04 20:38:33 +05:30
components: {
CollapsedAssigneeList,
UncollapsedAssigneeList,
2018-10-15 14:42:47 +05:30
},
2018-03-27 19:54:05 +05:30
props: {
rootPath: {
type: String,
required: true,
},
users: {
type: Array,
required: true,
},
editable: {
type: Boolean,
required: true,
},
2018-10-15 14:42:47 +05:30
issuableType: {
type: String,
2019-12-04 20:38:33 +05:30
required: false,
2018-10-15 14:42:47 +05:30
default: 'issue',
},
2018-03-27 19:54:05 +05:30
},
computed: {
hasNoUsers() {
return !this.users.length;
},
2019-12-04 20:38:33 +05:30
sortedAssigness() {
const canMergeUsers = this.users.filter(user => user.can_merge);
const canNotMergeUsers = this.users.filter(user => !user.can_merge);
2018-03-27 19:54:05 +05:30
2019-12-04 20:38:33 +05:30
return [...canMergeUsers, ...canNotMergeUsers];
2019-07-31 22:56:46 +05:30
},
2018-03-27 19:54:05 +05:30
},
methods: {
assignSelf() {
this.$emit('assign-self');
},
},
};
</script>
<template>
<div>
2019-12-04 20:38:33 +05:30
<collapsed-assignee-list :users="sortedAssigness" :issuable-type="issuableType" />
2018-03-27 19:54:05 +05:30
<div class="value hide-collapsed">
<template v-if="hasNoUsers">
2019-07-31 22:56:46 +05:30
<span class="assign-yourself no-value qa-assign-yourself">
2019-09-30 21:07:59 +05:30
{{ __('None') }}
2018-03-27 19:54:05 +05:30
<template v-if="editable">
2019-09-30 21:07:59 +05:30
-
<button type="button" class="btn-link" @click="assignSelf">
{{ __('assign yourself') }}
</button>
2018-03-27 19:54:05 +05:30
</template>
</span>
</template>
2019-12-04 20:38:33 +05:30
<uncollapsed-assignee-list
v-else
:users="sortedAssigness"
:root-path="rootPath"
:issuable-type="issuableType"
/>
2018-03-27 19:54:05 +05:30
</div>
</div>
</template>