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

82 lines
2 KiB
Vue
Raw Normal View History

2020-06-23 00:09:42 +05:30
<script>
2020-11-24 15:15:51 +05:30
import { mapState, mapGetters, mapActions } from 'vuex';
2021-01-03 14:25:43 +05:30
import { sortBy } from 'lodash';
2020-06-23 00:09:42 +05:30
import BoardColumn from 'ee_else_ce/boards/components/board_column.vue';
2020-11-24 15:15:51 +05:30
import { GlAlert } from '@gitlab/ui';
2020-10-24 23:57:45 +05:30
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
2020-06-23 00:09:42 +05:30
export default {
components: {
BoardColumn,
2020-11-24 15:15:51 +05:30
BoardContentSidebar: () => import('ee_component/boards/components/board_content_sidebar.vue'),
EpicsSwimlanes: () => import('ee_component/boards/components/epics_swimlanes.vue'),
GlAlert,
2020-06-23 00:09:42 +05:30
},
mixins: [glFeatureFlagMixin()],
props: {
lists: {
type: Array,
required: true,
},
canAdminList: {
type: Boolean,
required: true,
},
disabled: {
type: Boolean,
required: true,
},
},
computed: {
2020-11-24 15:15:51 +05:30
...mapState(['boardLists', 'error']),
...mapGetters(['isSwimlanesOn']),
boardListsToUse() {
2021-01-03 14:25:43 +05:30
const lists =
this.glFeatures.graphqlBoardLists || this.isSwimlanesOn ? this.boardLists : this.lists;
return sortBy([...Object.values(lists)], 'position');
2020-06-23 00:09:42 +05:30
},
},
2020-11-24 15:15:51 +05:30
mounted() {
if (this.glFeatures.graphqlBoardLists) {
this.fetchLists();
this.showPromotionList();
}
},
methods: {
...mapActions(['fetchLists', 'showPromotionList']),
},
2020-06-23 00:09:42 +05:30
};
</script>
<template>
<div>
2020-11-24 15:15:51 +05:30
<gl-alert v-if="error" variant="danger" :dismissible="false">
{{ error }}
</gl-alert>
2020-06-23 00:09:42 +05:30
<div
v-if="!isSwimlanesOn"
2020-07-28 23:09:34 +05:30
class="boards-list gl-w-full gl-py-5 gl-px-3 gl-white-space-nowrap"
2020-06-23 00:09:42 +05:30
data-qa-selector="boards_list"
>
<board-column
2020-11-24 15:15:51 +05:30
v-for="list in boardListsToUse"
2020-06-23 00:09:42 +05:30
:key="list.id"
ref="board"
:can-admin-list="canAdminList"
:list="list"
:disabled="disabled"
/>
</div>
2020-11-24 15:15:51 +05:30
<template v-else>
<epics-swimlanes
ref="swimlanes"
2021-01-03 14:25:43 +05:30
:lists="boardListsToUse"
2020-11-24 15:15:51 +05:30
:can-admin-list="canAdminList"
:disabled="disabled"
/>
<board-content-sidebar />
</template>
2020-06-23 00:09:42 +05:30
</div>
</template>