diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/assets/javascripts/boards/stores/actions.js | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/assets/javascripts/boards/stores/actions.js')
-rw-r--r-- | app/assets/javascripts/boards/stores/actions.js | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/app/assets/javascripts/boards/stores/actions.js b/app/assets/javascripts/boards/stores/actions.js index 08fedb14dff..b4be7546252 100644 --- a/app/assets/javascripts/boards/stores/actions.js +++ b/app/assets/javascripts/boards/stores/actions.js @@ -1,4 +1,11 @@ import * as types from './mutation_types'; +import createDefaultClient from '~/lib/graphql'; +import { BoardType } from '~/boards/constants'; +import { formatListIssues } from '../boards_util'; +import groupListsIssuesQuery from '../queries/group_lists_issues.query.graphql'; +import projectListsIssuesQuery from '../queries/project_lists_issues.query.graphql'; + +const gqlClient = createDefaultClient(); const notImplemented = () => { /* eslint-disable-next-line @gitlab/require-i18n-strings */ @@ -6,8 +13,12 @@ const notImplemented = () => { }; export default { - setEndpoints: ({ commit }, endpoints) => { - commit(types.SET_ENDPOINTS, endpoints); + setInitialBoardData: ({ commit }, data) => { + commit(types.SET_INITIAL_BOARD_DATA, data); + }, + + setActiveId({ commit }, id) { + commit(types.SET_ACTIVE_ID, id); }, fetchLists: () => { @@ -34,6 +45,32 @@ export default { notImplemented(); }, + fetchIssuesForAllLists: ({ state, commit }) => { + commit(types.REQUEST_ISSUES_FOR_ALL_LISTS); + + const { endpoints, boardType } = state; + const { fullPath, boardId } = endpoints; + + const query = boardType === BoardType.group ? groupListsIssuesQuery : projectListsIssuesQuery; + + const variables = { + fullPath, + boardId: `gid://gitlab/Board/${boardId}`, + }; + + return gqlClient + .query({ + query, + variables, + }) + .then(({ data }) => { + const { lists } = data[boardType]?.board; + const listIssues = formatListIssues(lists); + commit(types.RECEIVE_ISSUES_FOR_ALL_LISTS_SUCCESS, listIssues); + }) + .catch(() => commit(types.RECEIVE_ISSUES_FOR_ALL_LISTS_FAILURE)); + }, + moveIssue: () => { notImplemented(); }, |