Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | 11x 83x 142x 142x 142x 83x 83x 83x 83x 83x 83x 2x 2x 2x 1x 1x 1x 1x 1x 1x 1x | <script> import Tracking from '~/tracking'; import setSelectedBoardItemsMutation from '~/boards/graphql/client/set_selected_board_items.mutation.graphql'; import unsetSelectedBoardItemsMutation from '~/boards/graphql/client/unset_selected_board_items.mutation.graphql'; import selectedBoardItemsQuery from '~/boards/graphql/client/selected_board_items.query.graphql'; import setActiveBoardItemMutation from 'ee_else_ce/boards/graphql/client/set_active_board_item.mutation.graphql'; import activeBoardItemQuery from 'ee_else_ce/boards/graphql/client/active_board_item.query.graphql'; import BoardCardInner from './board_card_inner.vue'; export default { name: 'BoardCard', components: { BoardCardInner, }, mixins: [Tracking.mixin()], inject: ['disabled', 'isIssueBoard'], props: { list: { type: Object, default: () => ({}), required: false, }, item: { type: Object, default: () => ({}), required: false, }, index: { type: Number, default: 0, required: false, }, showWorkItemTypeIcon: { type: Boolean, default: false, required: false, }, canAdmin: { type: Boolean, required: false, default: true, }, }, apollo: { activeBoardItem: { query: activeBoardItemQuery, variables() { return { isIssue: this.isIssueBoard, }; }, }, selectedBoardItems: { query: selectedBoardItemsQuery, }, }, computed: { activeItemId() { return this.activeBoardItem?.id; }, isActive() { return this.item.id === this.activeItemId; }, multiSelectVisible() { return !this.activeItemId && this.selectedBoardItems?.includes(this.item.id); }, isDisabled() { return this.disabled || !this.item.id || this.item.isLoading || !this.canAdmin; }, isDraggable() { return !this.isDisabled; }, cardStyle() { return this.isColorful && this.item.color ? { borderColor: this.item.color } : ''; }, isColorful() { return gon?.features?.epicColorHighlight; }, colorClass() { return this.isColorful ? 'gl-pl-4 gl-border-l-solid gl-border-4' : ''; }, formattedItem() { return { ...this.item, assignees: this.item.assignees?.nodes || [], labels: this.item.labels?.nodes || [], }; }, }, methods: { toggleIssue(e) { // Don't do anything if this happened on a no trigger element Iif (e.target.closest('.js-no-trigger')) return; const isMultiSelect = e.ctrlKey || e.metaKey; if (isMultiSelect && gon?.features?.boardMultiSelect) { this.toggleBoardItemMultiSelection(this.item); } else { this.toggleItem(); this.track('click_card', { label: 'right_sidebar' }); } }, async toggleItem() { await this.$apollo.mutate({ mutation: unsetSelectedBoardItemsMutation, }); this.$apollo.mutate({ mutation: setActiveBoardItemMutation, variables: { boardItem: this.isActive ? null : this.item, listId: this.list.id, isIssue: this.isActive ? undefined : this.isIssueBoard, }, }); }, async toggleBoardItemMultiSelection(item) { Iif (this.activeItemId) { await this.$apollo.mutate({ mutation: setSelectedBoardItemsMutation, variables: { itemId: this.activeItemId, }, }); await this.$apollo.mutate({ mutation: setActiveBoardItemMutation, variables: { boardItem: null, listId: null }, }); } this.$apollo.mutate({ mutation: setSelectedBoardItemsMutation, variables: { itemId: item.id, }, }); }, }, }; </script> <template> <li :class="[ { 'multi-select gl-bg-blue-50 gl-border-blue-200': multiSelectVisible, 'gl-cursor-grab': isDraggable, 'is-disabled': isDisabled, 'is-active gl-bg-blue-50': isActive, 'gl-cursor-not-allowed gl-bg-gray-10': item.isLoading, }, colorClass, ]" :index="index" :data-item-id="item.id" :data-item-iid="item.iid" :data-item-path="item.referencePath" :style="cardStyle" data-testid="board-card" class="board-card gl-p-5 gl-rounded-base gl-line-height-normal gl-relative gl-mb-3" @click="toggleIssue($event)" > <board-card-inner :list="list" :item="formattedItem" :update-filters="true" :index="index" :show-work-item-type-icon="showWorkItemTypeIcon" @setFilters="$emit('setFilters', $event)" > <slot></slot> </board-card-inner> </li> </template> |