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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

125 lines
3.5 KiB
Vue
Raw Normal View History

2022-06-21 17:19:12 +05:30
<script>
import BoardAddNewColumnTrigger from '~/boards/components/board_add_new_column_trigger.vue';
import BoardsSelector from 'ee_else_ce/boards/components/boards_selector.vue';
import IssueBoardFilteredSearch from 'ee_else_ce/boards/components/issue_board_filtered_search.vue';
2023-04-23 21:23:45 +05:30
import { getBoardQuery } from 'ee_else_ce/boards/boards_util';
2022-06-21 17:19:12 +05:30
import ConfigToggle from './config_toggle.vue';
import NewBoardButton from './new_board_button.vue';
import ToggleFocus from './toggle_focus.vue';
export default {
components: {
BoardAddNewColumnTrigger,
BoardsSelector,
IssueBoardFilteredSearch,
ConfigToggle,
NewBoardButton,
ToggleFocus,
ToggleLabels: () => import('ee_component/boards/components/toggle_labels.vue'),
ToggleEpicsSwimlanes: () => import('ee_component/boards/components/toggle_epics_swimlanes.vue'),
EpicBoardFilteredSearch: () =>
import('ee_component/boards/components/epic_filtered_search.vue'),
},
2023-04-23 21:23:45 +05:30
inject: [
'swimlanesFeatureAvailable',
'canAdminList',
'isSignedIn',
'isIssueBoard',
'fullPath',
'boardType',
'isEpicBoard',
'isApolloBoard',
],
props: {
boardId: {
type: String,
required: true,
},
2023-05-27 22:25:52 +05:30
isSwimlanesOn: {
type: Boolean,
required: true,
},
2023-04-23 21:23:45 +05:30
},
data() {
return {
board: {},
};
},
apollo: {
board: {
query() {
return getBoardQuery(this.boardType, this.isEpicBoard);
},
variables() {
return {
fullPath: this.fullPath,
boardId: this.boardId,
};
},
skip() {
return !this.isApolloBoard;
},
update(data) {
2023-05-27 22:25:52 +05:30
const { board } = data.workspace;
return {
...board,
labels: board.labels?.nodes,
};
2023-04-23 21:23:45 +05:30
},
},
},
2023-05-27 22:25:52 +05:30
computed: {
hasScope() {
if (this.board.labels?.length > 0) {
return true;
}
let hasScope = false;
['assignee', 'iterationCadence', 'iteration', 'milestone', 'weight'].forEach((attr) => {
if (this.board[attr] !== null && this.board[attr] !== undefined) {
hasScope = true;
}
});
return hasScope;
},
},
2022-06-21 17:19:12 +05:30
};
</script>
<template>
<div class="issues-filters">
<div
class="issues-details-filters filtered-search-block gl-display-flex gl-flex-direction-column gl-lg-flex-direction-row row-content-block second-block"
>
<div
2022-07-16 23:28:13 +05:30
class="gl-display-flex gl-flex-direction-column gl-md-flex-direction-row gl-flex-grow-1 gl-lg-mb-0 gl-mb-3 gl-w-full"
2022-06-21 17:19:12 +05:30
>
2023-04-23 21:23:45 +05:30
<boards-selector :board-apollo="board" @switchBoard="$emit('switchBoard', $event)" />
2022-06-21 17:19:12 +05:30
<new-board-button />
2023-05-27 22:25:52 +05:30
<issue-board-filtered-search
v-if="isIssueBoard"
:board="board"
@setFilters="$emit('setFilters', $event)"
/>
<epic-board-filtered-search
v-else
:board="board"
@setFilters="$emit('setFilters', $event)"
/>
2022-06-21 17:19:12 +05:30
</div>
<div
2022-07-16 23:28:13 +05:30
class="filter-dropdown-container gl-md-display-flex gl-flex-direction-column gl-md-flex-direction-row gl-align-items-flex-start"
2022-06-21 17:19:12 +05:30
>
<toggle-labels />
2023-05-27 22:25:52 +05:30
<toggle-epics-swimlanes
v-if="swimlanesFeatureAvailable && isSignedIn"
:is-swimlanes-on="isSwimlanesOn"
@toggleSwimlanes="$emit('toggleSwimlanes', $event)"
/>
<config-toggle :board-has-scope="hasScope" />
2022-06-21 17:19:12 +05:30
<board-add-new-column-trigger v-if="canAdminList" />
<toggle-focus />
</div>
</div>
</div>
</template>