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

board_top_bar.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: 31664c28831b2ebd1b3dedf4803b2f8a7dfe0abf (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
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
<script>
import BoardAddNewColumnTrigger from '~/boards/components/board_add_new_column_trigger.vue';
import { s__ } from '~/locale';
import BoardsSelector from 'ee_else_ce/boards/components/boards_selector.vue';
import IssueBoardFilteredSearch from 'ee_else_ce/boards/components/issue_board_filtered_search.vue';
import { getBoardQuery } from 'ee_else_ce/boards/boards_util';
import ToggleLabels from '~/vue_shared/components/toggle_labels.vue';
import { setError } from '../graphql/cache_updates';
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,
    ToggleEpicsSwimlanes: () => import('ee_component/boards/components/toggle_epics_swimlanes.vue'),
    EpicBoardFilteredSearch: () =>
      import('ee_component/boards/components/epic_filtered_search.vue'),
  },
  inject: [
    'swimlanesFeatureAvailable',
    'canAdminList',
    'isSignedIn',
    'isIssueBoard',
    'fullPath',
    'boardType',
    'isEpicBoard',
    'isApolloBoard',
  ],
  props: {
    boardId: {
      type: String,
      required: true,
    },
    addColumnFormVisible: {
      type: Boolean,
      required: true,
    },
    isSwimlanesOn: {
      type: Boolean,
      required: true,
    },
  },
  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) {
        const { board } = data.workspace;
        return {
          ...board,
          labels: board.labels?.nodes,
        };
      },
      error(error) {
        setError({
          error,
          message: s__('Boards|An error occurred while fetching board details. Please try again.'),
        });
      },
    },
  },
  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;
    },
    isLoading() {
      return this.$apollo.queries.board.loading;
    },
  },
};
</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
        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 gl-min-w-0"
      >
        <boards-selector
          :board-apollo="board"
          :is-current-board-loading="isLoading"
          @switchBoard="$emit('switchBoard', $event)"
        />
        <new-board-button />
        <issue-board-filtered-search
          v-if="isIssueBoard"
          :board="board"
          :is-swimlanes-on="isSwimlanesOn"
          @setFilters="$emit('setFilters', $event)"
        />
        <epic-board-filtered-search
          v-else
          :board="board"
          @setFilters="$emit('setFilters', $event)"
        />
      </div>
      <div
        class="filter-dropdown-container gl-md-display-flex gl-flex-direction-column gl-md-flex-direction-row gl-align-items-flex-start"
      >
        <toggle-labels />
        <toggle-epics-swimlanes
          v-if="swimlanesFeatureAvailable && isSignedIn"
          :is-swimlanes-on="isSwimlanesOn"
          @toggleSwimlanes="$emit('toggleSwimlanes', $event)"
        />
        <config-toggle :board-has-scope="hasScope" />
        <board-add-new-column-trigger
          v-if="canAdminList"
          :is-new-list-showing="addColumnFormVisible"
          @setAddColumnFormVisibility="$emit('setAddColumnFormVisibility', $event)"
        />
        <toggle-focus />
      </div>
    </div>
  </div>
</template>