diff options
Diffstat (limited to 'app/assets/javascripts/boards')
11 files changed, 27 insertions, 11 deletions
diff --git a/app/assets/javascripts/boards/components/board_form.vue b/app/assets/javascripts/boards/components/board_form.vue index 34560560756..c0df8b72095 100644 --- a/app/assets/javascripts/boards/components/board_form.vue +++ b/app/assets/javascripts/boards/components/board_form.vue @@ -133,7 +133,7 @@ export default { if (this.board.name.length === 0) return; this.isLoading = true; if (this.isDeleteForm) { - gl.boardService + boardsStore .deleteBoard(this.currentBoard) .then(() => { visitUrl(boardsStore.rootPath); @@ -143,7 +143,7 @@ export default { this.isLoading = false; }); } else { - gl.boardService + boardsStore .createBoard(this.board) .then(resp => resp.data) .then(data => { diff --git a/app/assets/javascripts/boards/components/board_list.vue b/app/assets/javascripts/boards/components/board_list.vue index 1273fcc6a91..b8439bc8741 100644 --- a/app/assets/javascripts/boards/components/board_list.vue +++ b/app/assets/javascripts/boards/components/board_list.vue @@ -84,7 +84,8 @@ export default { this.$nextTick(() => { if ( this.scrollHeight() <= this.listHeight() && - this.list.issuesSize > this.list.issues.length + this.list.issuesSize > this.list.issues.length && + this.list.isExpanded ) { this.list.page += 1; this.list.getIssues(false).catch(() => { diff --git a/app/assets/javascripts/boards/components/boards_selector.vue b/app/assets/javascripts/boards/components/boards_selector.vue index 334c162954e..32491dfbcb6 100644 --- a/app/assets/javascripts/boards/components/boards_selector.vue +++ b/app/assets/javascripts/boards/components/boards_selector.vue @@ -168,7 +168,7 @@ export default { } const recentBoardsPromise = new Promise((resolve, reject) => - gl.boardService + boardsStore .recentBoards() .then(resolve) .catch(err => { @@ -184,7 +184,7 @@ export default { }), ); - Promise.all([gl.boardService.allBoards(), recentBoardsPromise]) + Promise.all([boardsStore.allBoards(), recentBoardsPromise]) .then(([allBoards, recentBoards]) => [allBoards.data, recentBoards.data]) .then(([allBoardsJson, recentBoardsJson]) => { this.loading = false; diff --git a/app/assets/javascripts/boards/components/issue_card_inner.vue b/app/assets/javascripts/boards/components/issue_card_inner.vue index 40d75d53f75..d37e49bab46 100644 --- a/app/assets/javascripts/boards/components/issue_card_inner.vue +++ b/app/assets/javascripts/boards/components/issue_card_inner.vue @@ -1,5 +1,6 @@ <script> import _ from 'underscore'; +import { mapState } from 'vuex'; import { GlTooltipDirective } from '@gitlab/ui'; import { sprintf, __ } from '~/locale'; import Icon from '~/vue_shared/components/icon.vue'; @@ -63,6 +64,7 @@ export default { }; }, computed: { + ...mapState(['isShowingLabels']), numberOverLimit() { return this.issue.assignees.length - this.limitBeforeCounter; }, @@ -92,7 +94,7 @@ export default { return false; }, showLabelFooter() { - return this.issue.labels.find(l => this.showLabel(l)) !== undefined; + return this.isShowingLabels && this.issue.labels.find(this.showLabel); }, issueReferencePath() { const { referencePath, groupId } = this.issue; diff --git a/app/assets/javascripts/boards/components/modal/index.vue b/app/assets/javascripts/boards/components/modal/index.vue index defa1f75ba2..618c2ada1f8 100644 --- a/app/assets/javascripts/boards/components/modal/index.vue +++ b/app/assets/javascripts/boards/components/modal/index.vue @@ -1,6 +1,7 @@ <script> /* global ListIssue */ import { urlParamsToObject } from '~/lib/utils/common_utils'; +import boardsStore from '~/boards/stores/boards_store'; import ModalHeader from './header.vue'; import ModalList from './list.vue'; import ModalFooter from './footer.vue'; @@ -109,7 +110,7 @@ export default { loadIssues(clearIssues = false) { if (!this.showAddIssuesModal) return false; - return gl.boardService + return boardsStore .getBacklog({ ...urlParamsToObject(this.filter.path), page: this.page, diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js index befca70eeae..e76e2341dfd 100644 --- a/app/assets/javascripts/boards/index.js +++ b/app/assets/javascripts/boards/index.js @@ -13,6 +13,7 @@ import 'ee_else_ce/boards/models/issue'; import 'ee_else_ce/boards/models/list'; import '~/boards/models/milestone'; import '~/boards/models/project'; +import store from '~/boards/stores'; import boardsStore from '~/boards/stores/boards_store'; import ModalStore from '~/boards/stores/modal_store'; import BoardService from 'ee_else_ce/boards/services/board_service'; @@ -29,6 +30,7 @@ import { } from '~/lib/utils/common_utils'; import boardConfigToggle from 'ee_else_ce/boards/config_toggle'; import toggleFocusMode from 'ee_else_ce/boards/toggle_focus'; +import toggleLabels from 'ee_else_ce/boards/toggle_labels'; import { setPromotionState, setWeigthFetchingState, @@ -67,6 +69,7 @@ export default () => { BoardSidebar, BoardAddIssuesModal, }, + store, data: { state: boardsStore.state, loading: true, @@ -314,5 +317,6 @@ export default () => { } toggleFocusMode(ModalStore, boardsStore, $boardApp); + toggleLabels(); mountMultipleBoardsSwitcher(); }; diff --git a/app/assets/javascripts/boards/models/list.js b/app/assets/javascripts/boards/models/list.js index 1e213c324eb..bb8c8e68297 100644 --- a/app/assets/javascripts/boards/models/list.js +++ b/app/assets/javascripts/boards/models/list.js @@ -50,8 +50,8 @@ class List { this.page = 1; this.loading = true; this.loadingMore = false; - this.issues = []; - this.issuesSize = 0; + this.issues = obj.issues || []; + this.issuesSize = obj.issuesSize ? obj.issuesSize : 0; this.defaultAvatar = defaultAvatar; if (obj.label) { diff --git a/app/assets/javascripts/boards/stores/getters.js b/app/assets/javascripts/boards/stores/getters.js new file mode 100644 index 00000000000..4de1576099d --- /dev/null +++ b/app/assets/javascripts/boards/stores/getters.js @@ -0,0 +1,3 @@ +export default { + getLabelToggleState: state => (state.isShowingLabels ? 'on' : 'off'), +}; diff --git a/app/assets/javascripts/boards/stores/index.js b/app/assets/javascripts/boards/stores/index.js index f70395a3771..471b952a212 100644 --- a/app/assets/javascripts/boards/stores/index.js +++ b/app/assets/javascripts/boards/stores/index.js @@ -1,14 +1,18 @@ import Vue from 'vue'; import Vuex from 'vuex'; import state from 'ee_else_ce/boards/stores/state'; +import getters from 'ee_else_ce/boards/stores/getters'; import actions from 'ee_else_ce/boards/stores/actions'; import mutations from 'ee_else_ce/boards/stores/mutations'; Vue.use(Vuex); -export default () => +export const createStore = () => new Vuex.Store({ state, + getters, actions, mutations, }); + +export default createStore(); diff --git a/app/assets/javascripts/boards/stores/state.js b/app/assets/javascripts/boards/stores/state.js index dd16abb01a5..24f44dc5629 100644 --- a/app/assets/javascripts/boards/stores/state.js +++ b/app/assets/javascripts/boards/stores/state.js @@ -1,3 +1,3 @@ export default () => ({ - // ... + isShowingLabels: true, }); diff --git a/app/assets/javascripts/boards/toggle_labels.js b/app/assets/javascripts/boards/toggle_labels.js new file mode 100644 index 00000000000..2d1ec238274 --- /dev/null +++ b/app/assets/javascripts/boards/toggle_labels.js @@ -0,0 +1 @@ +export default () => {}; |