2017-11-14 01:05:40 -05:00
|
|
|
<script>
|
2020-04-09 08:09:24 -04:00
|
|
|
import sidebarEventHub from '~/sidebar/event_hub';
|
2021-02-01 10:08:56 -05:00
|
|
|
import eventHub from '../eventhub';
|
2018-10-30 16:28:31 -04:00
|
|
|
import boardsStore from '../stores/boards_store';
|
2021-02-01 10:08:56 -05:00
|
|
|
import BoardCardLayout from './board_card_layout.vue';
|
|
|
|
import BoardCardLayoutDeprecated from './board_card_layout_deprecated.vue';
|
2017-02-23 10:27:01 -05:00
|
|
|
|
2018-10-30 16:28:31 -04:00
|
|
|
export default {
|
|
|
|
name: 'BoardsIssueCard',
|
|
|
|
components: {
|
2021-01-22 04:08:53 -05:00
|
|
|
BoardCardLayout: gon.features?.graphqlBoardLists ? BoardCardLayout : BoardCardLayoutDeprecated,
|
2018-10-30 16:28:31 -04:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
list: {
|
|
|
|
type: Object,
|
|
|
|
default: () => ({}),
|
2020-03-18 11:09:45 -04:00
|
|
|
required: false,
|
2018-01-04 14:07:28 -05:00
|
|
|
},
|
2018-10-30 16:28:31 -04:00
|
|
|
issue: {
|
|
|
|
type: Object,
|
|
|
|
default: () => ({}),
|
2020-03-18 11:09:45 -04:00
|
|
|
required: false,
|
2018-01-04 14:07:28 -05:00
|
|
|
},
|
2018-10-30 16:28:31 -04:00
|
|
|
},
|
|
|
|
methods: {
|
2020-08-25 02:10:18 -04:00
|
|
|
// These are methods instead of computed's, because boardsStore is not reactive.
|
|
|
|
isActive() {
|
|
|
|
return this.getActiveId() === this.issue.id;
|
2018-10-30 16:28:31 -04:00
|
|
|
},
|
2020-08-25 02:10:18 -04:00
|
|
|
getActiveId() {
|
|
|
|
return boardsStore.detail?.issue?.id;
|
2018-10-30 16:28:31 -04:00
|
|
|
},
|
2020-08-25 02:10:18 -04:00
|
|
|
showIssue({ isMultiSelect }) {
|
2020-04-09 08:09:24 -04:00
|
|
|
// If no issues are opened, close all sidebars first
|
2020-08-25 02:10:18 -04:00
|
|
|
if (!this.getActiveId()) {
|
2020-04-09 08:09:24 -04:00
|
|
|
sidebarEventHub.$emit('sidebar.closeAll');
|
|
|
|
}
|
2020-08-25 02:10:18 -04:00
|
|
|
if (this.isActive()) {
|
|
|
|
eventHub.$emit('clearDetailIssue', isMultiSelect);
|
2020-04-09 08:09:24 -04:00
|
|
|
|
2020-08-25 02:10:18 -04:00
|
|
|
if (isMultiSelect) {
|
2020-06-22 20:08:58 -04:00
|
|
|
eventHub.$emit('newDetailIssue', this.issue, isMultiSelect);
|
2017-02-23 10:27:01 -05:00
|
|
|
}
|
2020-08-25 02:10:18 -04:00
|
|
|
} else {
|
|
|
|
eventHub.$emit('newDetailIssue', this.issue, isMultiSelect);
|
|
|
|
boardsStore.setListDetail(this.list);
|
2018-10-30 16:28:31 -04:00
|
|
|
}
|
2017-02-23 10:49:12 -05:00
|
|
|
},
|
2018-10-30 16:28:31 -04:00
|
|
|
},
|
|
|
|
};
|
2017-11-14 01:05:40 -05:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2020-08-25 02:10:18 -04:00
|
|
|
<board-card-layout
|
2019-08-15 10:38:46 -04:00
|
|
|
data-qa-selector="board_card"
|
2020-08-25 02:10:18 -04:00
|
|
|
:issue="issue"
|
|
|
|
:list="list"
|
|
|
|
:is-active="isActive()"
|
|
|
|
v-bind="$attrs"
|
|
|
|
@show="showIssue"
|
|
|
|
/>
|
2017-11-14 01:05:40 -05:00
|
|
|
</template>
|