diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-16 06:09:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-16 06:09:46 +0300 |
commit | 6aaf8cf6f4a561152e9b08b4a6470ad88195cd2f (patch) | |
tree | 9f7f10bb03e3f71e9bdce6c07631a17cd2152aca /app/assets/javascripts/boards | |
parent | eba30e2ad821f653970486c4122fcca22cee27d9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/boards')
9 files changed, 54 insertions, 49 deletions
diff --git a/app/assets/javascripts/boards/boards_util.js b/app/assets/javascripts/boards/boards_util.js index 634313f666b..e5ff41dab74 100644 --- a/app/assets/javascripts/boards/boards_util.js +++ b/app/assets/javascripts/boards/boards_util.js @@ -130,6 +130,11 @@ export function isListDraggable(list) { return list.listType !== ListType.backlog && list.listType !== ListType.closed; } +// EE-specific feature. Find the implementation in the `ee/`-folder +export function transformBoardConfig() { + return ''; +} + export default { getMilestone, formatIssue, diff --git a/app/assets/javascripts/boards/components/board_list_new.vue b/app/assets/javascripts/boards/components/board_list_new.vue index ada80e6913c..92a381a8f57 100644 --- a/app/assets/javascripts/boards/components/board_list_new.vue +++ b/app/assets/javascripts/boards/components/board_list_new.vue @@ -7,7 +7,6 @@ import { sortableStart, sortableEnd } from '~/boards/mixins/sortable_default_opt import BoardNewIssue from './board_new_issue_new.vue'; import BoardCard from './board_card.vue'; import eventHub from '../eventhub'; -import boardsStore from '../stores/boards_store'; import { sprintf, __ } from '~/locale'; export default { @@ -44,7 +43,6 @@ export default { data() { return { scrollOffset: 250, - filters: boardsStore.state.filters, showCount: false, showIssueForm: false, }; @@ -94,12 +92,6 @@ export default { }, }, watch: { - filters: { - handler() { - this.listRef.scrollTop = 0; - }, - deep: true, - }, issues() { this.$nextTick(() => { this.showCount = this.scrollHeight() > Math.ceil(this.listHeight()); diff --git a/app/assets/javascripts/boards/components/modal/filters.js b/app/assets/javascripts/boards/components/modal/filters.js index 41f09a1895f..56a0fde5a91 100644 --- a/app/assets/javascripts/boards/components/modal/filters.js +++ b/app/assets/javascripts/boards/components/modal/filters.js @@ -1,6 +1,5 @@ import FilteredSearchBoards from '../../filtered_search_boards'; import FilteredSearchContainer from '../../../filtered_search/container'; -import vuexstore from '~/boards/stores'; export default { name: 'modal-filters', @@ -13,7 +12,7 @@ export default { mounted() { FilteredSearchContainer.container = this.$el; - this.filteredSearch = new FilteredSearchBoards(this.store, vuexstore); + this.filteredSearch = new FilteredSearchBoards(this.store); this.filteredSearch.setup(); this.filteredSearch.removeTokens(); this.filteredSearch.handleInputPlaceholder(); diff --git a/app/assets/javascripts/boards/filtered_search_boards.js b/app/assets/javascripts/boards/filtered_search_boards.js index 9e857bbfad2..1667dcc9f2e 100644 --- a/app/assets/javascripts/boards/filtered_search_boards.js +++ b/app/assets/javascripts/boards/filtered_search_boards.js @@ -1,10 +1,13 @@ import IssuableFilteredSearchTokenKeys from 'ee_else_ce/filtered_search/issuable_filtered_search_token_keys'; import FilteredSearchManager from 'ee_else_ce/filtered_search/filtered_search_manager'; +import { transformBoardConfig } from 'ee_else_ce/boards/boards_util'; import FilteredSearchContainer from '../filtered_search/container'; import boardsStore from './stores/boards_store'; +import vuexstore from './stores'; +import { updateHistory } from '~/lib/utils/url_utility'; export default class FilteredSearchBoards extends FilteredSearchManager { - constructor(store, vuexstore, updateUrl = false, cantEdit = []) { + constructor(store, updateUrl = false, cantEdit = []) { super({ page: 'boards', isGroupDecendent: true, @@ -23,16 +26,26 @@ export default class FilteredSearchBoards extends FilteredSearchManager { this.cantEdit = cantEdit.filter(i => typeof i === 'string'); this.cantEditWithValue = cantEdit.filter(i => typeof i === 'object'); - this.vuexstore = vuexstore; + if (vuexstore.getters.shouldUseGraphQL && vuexstore.state.boardConfig) { + const boardConfigPath = transformBoardConfig(vuexstore.state.boardConfig); + if (boardConfigPath !== '') { + const filterPath = window.location.search ? `${window.location.search}&` : '?'; + updateHistory({ + url: `${filterPath}${transformBoardConfig(vuexstore.state.boardConfig)}`, + }); + } + } } updateObject(path) { const groupByParam = new URLSearchParams(window.location.search).get('group_by'); this.store.path = `${path.substr(1)}${groupByParam ? `&group_by=${groupByParam}` : ''}`; - if (this.vuexstore.getters.shouldUseGraphQL) { - boardsStore.updateFiltersUrl(); - boardsStore.performSearch(); + if (vuexstore.getters.shouldUseGraphQL) { + updateHistory({ + url: `?${path.substr(1)}${groupByParam ? `&group_by=${groupByParam}` : ''}`, + }); + vuexstore.dispatch('performSearch'); } else if (this.updateUrl) { boardsStore.updateFiltersUrl(); } diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js index a58afa759fb..64a4f246735 100644 --- a/app/assets/javascripts/boards/index.js +++ b/app/assets/javascripts/boards/index.js @@ -40,7 +40,6 @@ import { NavigationType, convertObjectPropsToCamelCase, parseBoolean, - urlParamsToObject, } from '~/lib/utils/common_utils'; import mountMultipleBoardsSwitcher from './mount_multiple_boards_switcher'; @@ -112,7 +111,7 @@ export default () => { }; }, computed: { - ...mapGetters(['isSwimlanesOn', 'shouldUseGraphQL']), + ...mapGetters(['shouldUseGraphQL']), detailIssueVisible() { return Object.keys(this.detailIssue.issue).length; }, @@ -130,6 +129,17 @@ export default () => { ...endpoints, boardType: this.parent, disabled: this.disabled, + boardConfig: { + milestoneId: parseInt($boardApp.dataset.boardMilestoneId, 10), + milestoneTitle: $boardApp.dataset.boardMilestoneTitle || '', + iterationId: parseInt($boardApp.dataset.boardIterationId, 10), + iterationTitle: $boardApp.dataset.boardIterationTitle || '', + assigneeUsername: $boardApp.dataset.boardAssigneeUsername, + labels: $boardApp.dataset.labels ? JSON.parse($boardApp.dataset.labels || []) : [], + weight: $boardApp.dataset.boardWeight + ? parseInt($boardApp.dataset.boardWeight, 10) + : null, + }, }); boardsStore.setEndpoints(endpoints); boardsStore.rootPath = this.boardsEndpoint; @@ -138,7 +148,6 @@ export default () => { eventHub.$on('newDetailIssue', this.updateDetailIssue); eventHub.$on('clearDetailIssue', this.clearDetailIssue); sidebarEventHub.$on('toggleSubscription', this.toggleSubscription); - eventHub.$on('performSearch', this.performSearch); eventHub.$on('initialBoardLoad', this.initialBoardLoad); }, beforeDestroy() { @@ -146,16 +155,10 @@ export default () => { eventHub.$off('newDetailIssue', this.updateDetailIssue); eventHub.$off('clearDetailIssue', this.clearDetailIssue); sidebarEventHub.$off('toggleSubscription', this.toggleSubscription); - eventHub.$off('performSearch', this.performSearch); eventHub.$off('initialBoardLoad', this.initialBoardLoad); }, mounted() { - this.filterManager = new FilteredSearchBoards( - boardsStore.filter, - store, - true, - boardsStore.cantEdit, - ); + this.filterManager = new FilteredSearchBoards(boardsStore.filter, true, boardsStore.cantEdit); this.filterManager.setup(); this.performSearch(); @@ -167,14 +170,7 @@ export default () => { } }, methods: { - ...mapActions([ - 'setInitialBoardData', - 'setFilters', - 'fetchEpicsSwimlanes', - 'resetIssues', - 'resetEpics', - 'fetchLists', - ]), + ...mapActions(['setInitialBoardData', 'performSearch']), initialBoardLoad() { boardsStore .all() @@ -190,17 +186,6 @@ export default () => { updateTokens() { this.filterManager.updateTokens(); }, - performSearch() { - this.setFilters(convertObjectPropsToCamelCase(urlParamsToObject(window.location.search))); - if (this.isSwimlanesOn) { - this.resetEpics(); - this.resetIssues(); - this.fetchEpicsSwimlanes({}); - } else if (gon.features.graphqlBoardLists) { - this.fetchLists(); - this.resetIssues(); - } - }, updateDetailIssue(newIssue, multiSelect = false) { const { sidebarInfoEndpoint } = newIssue; if (sidebarInfoEndpoint && newIssue.subscribed === undefined) { diff --git a/app/assets/javascripts/boards/stores/actions.js b/app/assets/javascripts/boards/stores/actions.js index b4c646b0223..59b97eba9fe 100644 --- a/app/assets/javascripts/boards/stores/actions.js +++ b/app/assets/javascripts/boards/stores/actions.js @@ -3,6 +3,7 @@ import { pick } from 'lodash'; import boardListsQuery from 'ee_else_ce/boards/graphql/board_lists.query.graphql'; import createGqClient, { fetchPolicies } from '~/lib/graphql'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; +import { convertObjectPropsToCamelCase, urlParamsToObject } from '~/lib/utils/common_utils'; import { BoardType, ListType, inactiveId } from '~/boards/constants'; import * as types from './mutation_types'; import { @@ -64,6 +65,18 @@ export default { commit(types.SET_FILTERS, filterParams); }, + performSearch({ dispatch }) { + dispatch( + 'setFilters', + convertObjectPropsToCamelCase(urlParamsToObject(window.location.search)), + ); + + if (gon.features.graphqlBoardLists) { + dispatch('fetchLists'); + dispatch('resetIssues'); + } + }, + fetchLists: ({ commit, state, dispatch }) => { const { endpoints, boardType, filterParams } = state; const { fullPath, boardId } = endpoints; diff --git a/app/assets/javascripts/boards/stores/boards_store.js b/app/assets/javascripts/boards/stores/boards_store.js index 90ca4851a4c..36702b6ca5f 100644 --- a/app/assets/javascripts/boards/stores/boards_store.js +++ b/app/assets/javascripts/boards/stores/boards_store.js @@ -492,10 +492,6 @@ const boardsStore = { eventHub.$emit('updateTokens'); }, - performSearch() { - eventHub.$emit('performSearch'); - }, - setListDetail(newList) { this.detail.list = newList; }, diff --git a/app/assets/javascripts/boards/stores/mutations.js b/app/assets/javascripts/boards/stores/mutations.js index b58564e358e..8c4e514710f 100644 --- a/app/assets/javascripts/boards/stores/mutations.js +++ b/app/assets/javascripts/boards/stores/mutations.js @@ -32,10 +32,11 @@ export const addIssueToList = ({ state, listId, issueId, moveBeforeId, moveAfter export default { [mutationTypes.SET_INITIAL_BOARD_DATA](state, data) { - const { boardType, disabled, ...endpoints } = data; + const { boardType, disabled, boardConfig, ...endpoints } = data; state.endpoints = endpoints; state.boardType = boardType; state.disabled = disabled; + state.boardConfig = boardConfig; }, [mutationTypes.RECEIVE_BOARD_LISTS_SUCCESS]: (state, lists) => { diff --git a/app/assets/javascripts/boards/stores/state.js b/app/assets/javascripts/boards/stores/state.js index a2f026862df..573e98e56e0 100644 --- a/app/assets/javascripts/boards/stores/state.js +++ b/app/assets/javascripts/boards/stores/state.js @@ -14,6 +14,7 @@ export default () => ({ pageInfoByListId: {}, issues: {}, filterParams: {}, + boardConfig: {}, error: undefined, // TODO: remove after ce/ee split of board_content.vue isShowingEpicsSwimlanes: false, |