Commit 2a001df3 authored by Clement Ho's avatar Clement Ho

[skip ci] use is:component

parent 93d1895b
export default { export default {
name: 'SingleAssignee', name: 'SingleAssignee',
props: { props: {
user: { type: Object, required: true }, assignees: { type: Object, required: true },
},
computed: {
user() {
return this.assignees.users[0];
},
}, },
template: ` template: `
<div class="value hide-collapsed"> <div class="value hide-collapsed">
......
...@@ -31,6 +31,19 @@ const sidebarAssigneesOptions = () => ({ ...@@ -31,6 +31,19 @@ const sidebarAssigneesOptions = () => ({
service, service,
}; };
}, },
computed: {
componentName() {
const numberOfAssignees = this.assignees.users.length;
if (numberOfAssignees === 0) {
return 'no-assignee';
} else if (numberOfAssignees === 1) {
return 'single-assignee';
} else {
return 'multiple-assignees';
}
},
},
components: { components: {
'no-assignee': NoAssignee, 'no-assignee': NoAssignee,
'single-assignee': SingleAssignee, 'single-assignee': SingleAssignee,
...@@ -40,9 +53,7 @@ const sidebarAssigneesOptions = () => ({ ...@@ -40,9 +53,7 @@ const sidebarAssigneesOptions = () => ({
template: ` template: `
<div class="sidebar-assignees"> <div class="sidebar-assignees">
<assignee-title :numberOfAssignees="assignees.users.length" /> <assignee-title :numberOfAssignees="assignees.users.length" />
<no-assignee v-if="assignees.users.length === 0" :service="service" :assignees="assignees" /> <component :is="componentName" :assignees="assignees" :service="service"></component>
<single-assignee v-else-if="assignees.users.length === 1" :user="assignees.users[0]" />
<multiple-assignees v-else :assignees="assignees" />
</div> </div>
`, `,
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment