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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/boards/stores/actions.js')
-rw-r--r--app/assets/javascripts/boards/stores/actions.js51
1 files changed, 41 insertions, 10 deletions
diff --git a/app/assets/javascripts/boards/stores/actions.js b/app/assets/javascripts/boards/stores/actions.js
index a7cf1e9e647..b8d84899782 100644
--- a/app/assets/javascripts/boards/stores/actions.js
+++ b/app/assets/javascripts/boards/stores/actions.js
@@ -1,6 +1,12 @@
import { pick } from 'lodash';
import boardListsQuery from 'ee_else_ce/boards/graphql/board_lists.query.graphql';
-import { BoardType, ListType, inactiveId, flashAnimationDuration } from '~/boards/constants';
+import {
+ BoardType,
+ ListType,
+ inactiveId,
+ flashAnimationDuration,
+ ISSUABLE,
+} from '~/boards/constants';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import createGqClient, { fetchPolicies } from '~/lib/graphql';
import { convertObjectPropsToCamelCase, urlParamsToObject } from '~/lib/utils/common_utils';
@@ -79,7 +85,11 @@ export default {
}
},
- fetchLists: ({ commit, state, dispatch }) => {
+ fetchLists: ({ dispatch }) => {
+ dispatch('fetchIssueLists');
+ },
+
+ fetchIssueLists: ({ commit, state, dispatch }) => {
const { boardType, filterParams, fullPath, boardId } = state;
const variables = {
@@ -253,8 +263,8 @@ export default {
});
},
- fetchIssuesForList: ({ state, commit }, { listId, fetchNext = false }) => {
- commit(types.REQUEST_ISSUES_FOR_LIST, { listId, fetchNext });
+ fetchItemsForList: ({ state, commit }, { listId, fetchNext = false }) => {
+ commit(types.REQUEST_ITEMS_FOR_LIST, { listId, fetchNext });
const { fullPath, boardId, boardType, filterParams } = state;
@@ -279,11 +289,11 @@ export default {
})
.then(({ data }) => {
const { lists } = data[boardType]?.board;
- const listIssues = formatListIssues(lists);
+ const listItems = formatListIssues(lists);
const listPageInfo = formatListsPageInfo(lists);
- commit(types.RECEIVE_ISSUES_FOR_LIST_SUCCESS, { listIssues, listPageInfo, listId });
+ commit(types.RECEIVE_ITEMS_FOR_LIST_SUCCESS, { listItems, listPageInfo, listId });
})
- .catch(() => commit(types.RECEIVE_ISSUES_FOR_LIST_FAILURE, listId));
+ .catch(() => commit(types.RECEIVE_ITEMS_FOR_LIST_FAILURE, listId));
},
resetIssues: ({ commit }) => {
@@ -294,8 +304,8 @@ export default {
{ state, commit },
{ issueId, issueIid, issuePath, fromListId, toListId, moveBeforeId, moveAfterId },
) => {
- const originalIssue = state.issues[issueId];
- const fromList = state.issuesByListId[fromListId];
+ const originalIssue = state.boardItems[issueId];
+ const fromList = state.boardItemsByListId[fromListId];
const originalIndex = fromList.indexOf(Number(issueId));
commit(types.MOVE_ISSUE, { originalIssue, fromListId, toListId, moveBeforeId, moveAfterId });
@@ -532,10 +542,17 @@ export default {
commit(types.SET_SELECTED_PROJECT, project);
},
- toggleBoardItemMultiSelection: ({ commit, state }, boardItem) => {
+ toggleBoardItemMultiSelection: ({ commit, state, dispatch, getters }, boardItem) => {
const { selectedBoardItems } = state;
const index = selectedBoardItems.indexOf(boardItem);
+ // If user already selected an item (activeIssue) without using mult-select,
+ // include that item in the selection and unset state.ActiveId to hide the sidebar.
+ if (getters.activeIssue) {
+ commit(types.ADD_BOARD_ITEM_TO_SELECTION, getters.activeIssue);
+ dispatch('unsetActiveId');
+ }
+
if (index === -1) {
commit(types.ADD_BOARD_ITEM_TO_SELECTION, boardItem);
} else {
@@ -547,6 +564,20 @@ export default {
commit(types.SET_ADD_COLUMN_FORM_VISIBLE, visible);
},
+ resetBoardItemMultiSelection: ({ commit }) => {
+ commit(types.RESET_BOARD_ITEM_SELECTION);
+ },
+
+ toggleBoardItem: ({ state, dispatch }, { boardItem, sidebarType = ISSUABLE }) => {
+ dispatch('resetBoardItemMultiSelection');
+
+ if (boardItem.id === state.activeId) {
+ dispatch('unsetActiveId');
+ } else {
+ dispatch('setActiveId', { id: boardItem.id, sidebarType });
+ }
+ },
+
fetchBacklog: () => {
notImplemented();
},