diff options
Diffstat (limited to 'app/assets/javascripts/boards/stores/mutations.js')
-rw-r--r-- | app/assets/javascripts/boards/stores/mutations.js | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/app/assets/javascripts/boards/stores/mutations.js b/app/assets/javascripts/boards/stores/mutations.js index a32a100fa11..668a3dbaa7e 100644 --- a/app/assets/javascripts/boards/stores/mutations.js +++ b/app/assets/javascripts/boards/stores/mutations.js @@ -1,7 +1,7 @@ -import { pull, union } from 'lodash'; +import { cloneDeep, pull, union } from 'lodash'; import Vue from 'vue'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; -import { s__ } from '~/locale'; +import { s__, __ } from '~/locale'; import { formatIssue } from '../boards_util'; import { issuableTypes } from '../constants'; import * as mutationTypes from './mutation_types'; @@ -103,15 +103,12 @@ export default { Vue.set(state.boardLists, list.id, list); }, - [mutationTypes.MOVE_LIST]: (state, { movedList, listAtNewIndex }) => { - const { boardLists } = state; - Vue.set(boardLists, movedList.id, movedList); - Vue.set(boardLists, listAtNewIndex.id, listAtNewIndex); - }, - - [mutationTypes.UPDATE_LIST_FAILURE]: (state, backupList) => { - state.error = s__('Boards|An error occurred while updating the list. Please try again.'); - Vue.set(state, 'boardLists', backupList); + [mutationTypes.MOVE_LISTS]: (state, movedLists) => { + const updatedBoardList = movedLists.reduce((acc, { listId, position }) => { + acc[listId].position = position; + return acc; + }, cloneDeep(state.boardLists)); + Vue.set(state, 'boardLists', updatedBoardList); }, [mutationTypes.TOGGLE_LIST_COLLAPSED]: (state, { listId, collapsed }) => { @@ -136,6 +133,20 @@ export default { Vue.set(state.listsFlags, listId, { [fetchNext ? 'isLoadingMore' : 'isLoading']: true }); }, + [mutationTypes.RECEIVE_MILESTONES_SUCCESS](state, milestones) { + state.milestones = milestones; + state.milestonesLoading = false; + }, + + [mutationTypes.RECEIVE_MILESTONES_REQUEST](state) { + state.milestonesLoading = true; + }, + + [mutationTypes.RECEIVE_MILESTONES_FAILURE](state) { + state.milestonesLoading = false; + state.error = __('Failed to load milestones.'); + }, + [mutationTypes.RECEIVE_ITEMS_FOR_LIST_SUCCESS]: (state, { listItems, listPageInfo, listId }) => { const { listData, boardItems } = listItems; Vue.set(state, 'boardItems', { ...state.boardItems, ...boardItems }); |