debian-mirror-gitlab/app/assets/javascripts/boards/components/board_column.vue

106 lines
2.6 KiB
Vue
Raw Normal View History

2020-04-22 19:07:51 +05:30
<script>
2021-01-29 00:20:46 +05:30
// This component is being replaced in favor of './board_column_new.vue' for GraphQL boards
2020-04-22 19:07:51 +05:30
import Sortable from 'sortablejs';
2020-10-24 23:57:45 +05:30
import BoardListHeader from 'ee_else_ce/boards/components/board_list_header.vue';
2020-04-22 19:07:51 +05:30
import BoardList from './board_list.vue';
import boardsStore from '../stores/boards_store';
import { getBoardSortableDefaultOptions, sortableEnd } from '../mixins/sortable_default_options';
export default {
components: {
2020-06-23 00:09:42 +05:30
BoardListHeader,
2021-01-29 00:20:46 +05:30
BoardList,
2020-04-22 19:07:51 +05:30
},
props: {
list: {
type: Object,
default: () => ({}),
required: false,
},
disabled: {
type: Boolean,
required: true,
},
canAdminList: {
type: Boolean,
required: false,
default: false,
},
2020-11-24 15:15:51 +05:30
},
inject: {
boardId: {
2021-01-03 14:25:43 +05:30
default: '',
2020-04-22 19:07:51 +05:30
},
},
data() {
return {
detailIssue: boardsStore.detail,
filter: boardsStore.filter,
};
},
computed: {
2020-11-24 15:15:51 +05:30
listIssues() {
2021-01-29 00:20:46 +05:30
return this.list.issues;
2020-11-24 15:15:51 +05:30
},
2020-04-22 19:07:51 +05:30
},
watch: {
filter: {
handler() {
2021-01-29 00:20:46 +05:30
this.list.page = 1;
this.list.getIssues(true).catch(() => {
// TODO: handle request error
});
2020-04-22 19:07:51 +05:30
},
deep: true,
},
},
mounted() {
const instance = this;
const sortableOptions = getBoardSortableDefaultOptions({
disabled: this.disabled,
group: 'boards',
draggable: '.is-draggable',
handle: '.js-board-handle',
onEnd(e) {
sortableEnd();
const sortable = this;
if (e.newIndex !== undefined && e.oldIndex !== e.newIndex) {
const order = sortable.toArray();
const list = boardsStore.findList('id', parseInt(e.item.dataset.id, 10));
instance.$nextTick(() => {
boardsStore.moveList(list, order);
});
}
},
});
Sortable.create(this.$el.parentNode, sortableOptions);
},
};
</script>
<template>
<div
:class="{
'is-draggable': !list.preset,
'is-expandable': list.isExpandable,
'is-collapsed': !list.isExpanded,
'board-type-assignee': list.type === 'assignee',
}"
:data-id="list.id"
2021-01-29 00:20:46 +05:30
class="board gl-display-inline-block gl-h-full gl-px-3 gl-vertical-align-top gl-white-space-normal"
2020-04-22 19:07:51 +05:30
data-qa-selector="board_list"
>
2020-06-23 00:09:42 +05:30
<div
class="board-inner gl-display-flex gl-flex-direction-column gl-relative gl-h-full gl-rounded-base"
>
2020-11-24 15:15:51 +05:30
<board-list-header :can-admin-list="canAdminList" :list="list" :disabled="disabled" />
2021-02-22 17:27:13 +05:30
<board-list ref="board-list" :disabled="disabled" :issues="listIssues" :list="list" />
2020-04-22 19:07:51 +05:30
</div>
</div>
</template>