Welcome to mirror list, hosted at ThFree Co, Russian Federation.

board_card.vue « components « boards « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e60093436268f6279141281739a4293bbdad1abd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<script>
import sidebarEventHub from '~/sidebar/event_hub';
import eventHub from '../eventhub';
import boardsStore from '../stores/boards_store';
import BoardCardLayout from './board_card_layout.vue';
import BoardCardLayoutDeprecated from './board_card_layout_deprecated.vue';

export default {
  name: 'BoardsIssueCard',
  components: {
    BoardCardLayout: gon.features?.graphqlBoardLists ? BoardCardLayout : BoardCardLayoutDeprecated,
  },
  props: {
    list: {
      type: Object,
      default: () => ({}),
      required: false,
    },
    issue: {
      type: Object,
      default: () => ({}),
      required: false,
    },
  },
  methods: {
    // These are methods instead of computed's, because boardsStore is not reactive.
    isActive() {
      return this.getActiveId() === this.issue.id;
    },
    getActiveId() {
      return boardsStore.detail?.issue?.id;
    },
    showIssue({ isMultiSelect }) {
      // If no issues are opened, close all sidebars first
      if (!this.getActiveId()) {
        sidebarEventHub.$emit('sidebar.closeAll');
      }
      if (this.isActive()) {
        eventHub.$emit('clearDetailIssue', isMultiSelect);

        if (isMultiSelect) {
          eventHub.$emit('newDetailIssue', this.issue, isMultiSelect);
        }
      } else {
        eventHub.$emit('newDetailIssue', this.issue, isMultiSelect);
        boardsStore.setListDetail(this.list);
      }
    },
  },
};
</script>

<template>
  <board-card-layout
    data-qa-selector="board_card"
    :issue="issue"
    :list="list"
    :is-active="isActive()"
    v-bind="$attrs"
    @show="showIssue"
  />
</template>