debian-mirror-gitlab/app/assets/javascripts/boards/stores/actions.js

106 lines
2.2 KiB
JavaScript
Raw Normal View History

2020-06-23 00:09:42 +05:30
import * as types from './mutation_types';
2020-10-24 23:57:45 +05:30
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();
2020-06-23 00:09:42 +05:30
2019-09-04 21:01:54 +05:30
const notImplemented = () => {
2020-04-22 19:07:51 +05:30
/* eslint-disable-next-line @gitlab/require-i18n-strings */
2019-09-04 21:01:54 +05:30
throw new Error('Not implemented!');
};
export default {
2020-10-24 23:57:45 +05:30
setInitialBoardData: ({ commit }, data) => {
commit(types.SET_INITIAL_BOARD_DATA, data);
},
setActiveId({ commit }, id) {
commit(types.SET_ACTIVE_ID, id);
2019-09-04 21:01:54 +05:30
},
fetchLists: () => {
notImplemented();
},
generateDefaultLists: () => {
notImplemented();
},
createList: () => {
notImplemented();
},
updateList: () => {
notImplemented();
},
deleteList: () => {
notImplemented();
},
fetchIssuesForList: () => {
notImplemented();
},
2020-10-24 23:57:45 +05:30
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));
},
2019-09-04 21:01:54 +05:30
moveIssue: () => {
notImplemented();
},
createNewIssue: () => {
notImplemented();
},
fetchBacklog: () => {
notImplemented();
},
bulkUpdateIssues: () => {
notImplemented();
},
fetchIssue: () => {
notImplemented();
},
toggleIssueSubscription: () => {
notImplemented();
},
showPage: () => {
notImplemented();
},
toggleEmptyState: () => {
notImplemented();
},
};