2021-01-03 14:25:43 +05:30
|
|
|
import { pick } from 'lodash';
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
import boardListsQuery from 'ee_else_ce/boards/graphql/board_lists.query.graphql';
|
2021-01-03 14:25:43 +05:30
|
|
|
import createGqClient, { fetchPolicies } from '~/lib/graphql';
|
2020-11-24 15:15:51 +05:30
|
|
|
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
|
2021-02-22 17:27:13 +05:30
|
|
|
import { convertObjectPropsToCamelCase, urlParamsToObject } from '~/lib/utils/common_utils';
|
|
|
|
import { BoardType, ListType, inactiveId } from '~/boards/constants';
|
2020-11-24 15:15:51 +05:30
|
|
|
import * as types from './mutation_types';
|
2021-01-03 14:25:43 +05:30
|
|
|
import {
|
|
|
|
formatBoardLists,
|
|
|
|
formatListIssues,
|
|
|
|
fullBoardId,
|
|
|
|
formatListsPageInfo,
|
2021-01-29 00:20:46 +05:30
|
|
|
formatIssue,
|
2021-01-03 14:25:43 +05:30
|
|
|
} from '../boards_util';
|
2021-02-22 17:27:13 +05:30
|
|
|
import createFlash from '~/flash';
|
|
|
|
import { __ } from '~/locale';
|
|
|
|
import updateAssigneesMutation from '~/vue_shared/components/sidebar/queries/updateAssignees.mutation.graphql';
|
|
|
|
import listsIssuesQuery from '../graphql/lists_issues.query.graphql';
|
|
|
|
import boardLabelsQuery from '../graphql/board_labels.query.graphql';
|
|
|
|
import createBoardListMutation from '../graphql/board_list_create.mutation.graphql';
|
|
|
|
import updateBoardListMutation from '../graphql/board_list_update.mutation.graphql';
|
|
|
|
import issueMoveListMutation from '../graphql/issue_move_list.mutation.graphql';
|
|
|
|
import destroyBoardListMutation from '../graphql/board_list_destroy.mutation.graphql';
|
|
|
|
import issueCreateMutation from '../graphql/issue_create.mutation.graphql';
|
|
|
|
import issueSetLabelsMutation from '../graphql/issue_set_labels.mutation.graphql';
|
|
|
|
import issueSetDueDateMutation from '../graphql/issue_set_due_date.mutation.graphql';
|
|
|
|
import issueSetSubscriptionMutation from '../graphql/issue_set_subscription.mutation.graphql';
|
|
|
|
import issueSetMilestoneMutation from '../graphql/issue_set_milestone.mutation.graphql';
|
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!');
|
|
|
|
};
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
export const gqlClient = createGqClient(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
fetchPolicy: fetchPolicies.NO_CACHE,
|
|
|
|
},
|
|
|
|
);
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
export default {
|
2020-10-24 23:57:45 +05:30
|
|
|
setInitialBoardData: ({ commit }, data) => {
|
|
|
|
commit(types.SET_INITIAL_BOARD_DATA, data);
|
|
|
|
},
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
setActiveId({ commit }, { id, sidebarType }) {
|
|
|
|
commit(types.SET_ACTIVE_ID, { id, sidebarType });
|
2019-09-04 21:01:54 +05:30
|
|
|
},
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
unsetActiveId({ dispatch }) {
|
|
|
|
dispatch('setActiveId', { id: inactiveId, sidebarType: '' });
|
2019-09-04 21:01:54 +05:30
|
|
|
},
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
setFilters: ({ commit }, filters) => {
|
|
|
|
const filterParams = pick(filters, [
|
|
|
|
'assigneeUsername',
|
|
|
|
'authorUsername',
|
|
|
|
'labelName',
|
|
|
|
'milestoneTitle',
|
|
|
|
'releaseTag',
|
|
|
|
'search',
|
|
|
|
]);
|
|
|
|
commit(types.SET_FILTERS, filterParams);
|
|
|
|
},
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
performSearch({ dispatch }) {
|
|
|
|
dispatch(
|
|
|
|
'setFilters',
|
|
|
|
convertObjectPropsToCamelCase(urlParamsToObject(window.location.search)),
|
|
|
|
);
|
|
|
|
|
|
|
|
if (gon.features.graphqlBoardLists) {
|
|
|
|
dispatch('fetchLists');
|
|
|
|
dispatch('resetIssues');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
fetchLists: ({ commit, state, dispatch }) => {
|
2021-01-03 14:25:43 +05:30
|
|
|
const { endpoints, boardType, filterParams } = state;
|
2020-11-24 15:15:51 +05:30
|
|
|
const { fullPath, boardId } = endpoints;
|
|
|
|
|
|
|
|
const variables = {
|
|
|
|
fullPath,
|
|
|
|
boardId: fullBoardId(boardId),
|
2021-01-03 14:25:43 +05:30
|
|
|
filters: filterParams,
|
|
|
|
isGroup: boardType === BoardType.group,
|
|
|
|
isProject: boardType === BoardType.project,
|
2020-11-24 15:15:51 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
return gqlClient
|
|
|
|
.query({
|
2021-01-03 14:25:43 +05:30
|
|
|
query: boardListsQuery,
|
2020-11-24 15:15:51 +05:30
|
|
|
variables,
|
|
|
|
})
|
|
|
|
.then(({ data }) => {
|
2021-01-03 14:25:43 +05:30
|
|
|
const { lists, hideBacklogList } = data[boardType]?.board;
|
|
|
|
commit(types.RECEIVE_BOARD_LISTS_SUCCESS, formatBoardLists(lists));
|
|
|
|
// Backlog list needs to be created if it doesn't exist and it's not hidden
|
|
|
|
if (!lists.nodes.find(l => l.listType === ListType.backlog) && !hideBacklogList) {
|
2020-11-24 15:15:51 +05:30
|
|
|
dispatch('createList', { backlog: true });
|
|
|
|
}
|
|
|
|
})
|
2021-01-03 14:25:43 +05:30
|
|
|
.catch(() => commit(types.RECEIVE_BOARD_LISTS_FAILURE));
|
2020-11-24 15:15:51 +05:30
|
|
|
},
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
createList: ({ state, commit, dispatch }, { backlog, labelId, milestoneId, assigneeId }) => {
|
2020-11-24 15:15:51 +05:30
|
|
|
const { boardId } = state.endpoints;
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
gqlClient
|
|
|
|
.mutate({
|
|
|
|
mutation: createBoardListMutation,
|
|
|
|
variables: {
|
|
|
|
boardId: fullBoardId(boardId),
|
|
|
|
backlog,
|
2021-01-03 14:25:43 +05:30
|
|
|
labelId,
|
|
|
|
milestoneId,
|
|
|
|
assigneeId,
|
2020-11-24 15:15:51 +05:30
|
|
|
},
|
|
|
|
})
|
|
|
|
.then(({ data }) => {
|
|
|
|
if (data?.boardListCreate?.errors.length) {
|
|
|
|
commit(types.CREATE_LIST_FAILURE);
|
|
|
|
} else {
|
|
|
|
const list = data.boardListCreate?.list;
|
|
|
|
dispatch('addList', list);
|
|
|
|
}
|
|
|
|
})
|
2021-01-03 14:25:43 +05:30
|
|
|
.catch(() => commit(types.CREATE_LIST_FAILURE));
|
2020-11-24 15:15:51 +05:30
|
|
|
},
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
addList: ({ commit }, list) => {
|
2021-02-22 17:27:13 +05:30
|
|
|
commit(types.RECEIVE_ADD_LIST_SUCCESS, list);
|
2020-11-24 15:15:51 +05:30
|
|
|
},
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
fetchLabels: ({ state, commit }, searchTerm) => {
|
|
|
|
const { endpoints, boardType } = state;
|
|
|
|
const { fullPath } = endpoints;
|
|
|
|
|
|
|
|
const variables = {
|
|
|
|
fullPath,
|
|
|
|
searchTerm,
|
|
|
|
isGroup: boardType === BoardType.group,
|
|
|
|
isProject: boardType === BoardType.project,
|
|
|
|
};
|
|
|
|
|
|
|
|
return gqlClient
|
|
|
|
.query({
|
|
|
|
query: boardLabelsQuery,
|
|
|
|
variables,
|
|
|
|
})
|
|
|
|
.then(({ data }) => {
|
|
|
|
const labels = data[boardType]?.labels;
|
|
|
|
return labels.nodes;
|
|
|
|
})
|
|
|
|
.catch(() => commit(types.RECEIVE_LABELS_FAILURE));
|
|
|
|
},
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
moveList: (
|
|
|
|
{ state, commit, dispatch },
|
|
|
|
{ listId, replacedListId, newIndex, adjustmentValue },
|
|
|
|
) => {
|
2021-02-22 17:27:13 +05:30
|
|
|
if (listId === replacedListId) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
const { boardLists } = state;
|
2021-01-03 14:25:43 +05:30
|
|
|
const backupList = { ...boardLists };
|
|
|
|
const movedList = boardLists[listId];
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
const newPosition = newIndex - 1;
|
2021-01-03 14:25:43 +05:30
|
|
|
const listAtNewIndex = boardLists[replacedListId];
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
movedList.position = newPosition;
|
|
|
|
listAtNewIndex.position += adjustmentValue;
|
|
|
|
commit(types.MOVE_LIST, {
|
|
|
|
movedList,
|
|
|
|
listAtNewIndex,
|
|
|
|
});
|
|
|
|
|
|
|
|
dispatch('updateList', { listId, position: newPosition, backupList });
|
2019-09-04 21:01:54 +05:30
|
|
|
},
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
updateList: ({ commit }, { listId, position, collapsed, backupList }) => {
|
|
|
|
gqlClient
|
|
|
|
.mutate({
|
|
|
|
mutation: updateBoardListMutation,
|
|
|
|
variables: {
|
|
|
|
listId,
|
|
|
|
position,
|
|
|
|
collapsed,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.then(({ data }) => {
|
|
|
|
if (data?.updateBoardList?.errors.length) {
|
|
|
|
commit(types.UPDATE_LIST_FAILURE, backupList);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
commit(types.UPDATE_LIST_FAILURE, backupList);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
},
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
removeList: ({ state, commit }, listId) => {
|
|
|
|
const listsBackup = { ...state.boardLists };
|
|
|
|
|
|
|
|
commit(types.REMOVE_LIST, listId);
|
|
|
|
|
|
|
|
return gqlClient
|
|
|
|
.mutate({
|
|
|
|
mutation: destroyBoardListMutation,
|
|
|
|
variables: {
|
|
|
|
listId,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.then(({ data: { destroyBoardList: { errors } } }) => {
|
|
|
|
if (errors.length > 0) {
|
|
|
|
commit(types.REMOVE_LIST_FAILURE, listsBackup);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
commit(types.REMOVE_LIST_FAILURE, listsBackup);
|
|
|
|
});
|
2019-09-04 21:01:54 +05:30
|
|
|
},
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
fetchIssuesForList: ({ state, commit }, { listId, fetchNext = false }) => {
|
|
|
|
commit(types.REQUEST_ISSUES_FOR_LIST, { listId, fetchNext });
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
const { endpoints, boardType, filterParams } = state;
|
|
|
|
const { fullPath, boardId } = endpoints;
|
|
|
|
|
|
|
|
const variables = {
|
|
|
|
fullPath,
|
|
|
|
boardId: fullBoardId(boardId),
|
|
|
|
id: listId,
|
|
|
|
filters: filterParams,
|
|
|
|
isGroup: boardType === BoardType.group,
|
|
|
|
isProject: boardType === BoardType.project,
|
2021-01-03 14:25:43 +05:30
|
|
|
first: 20,
|
|
|
|
after: fetchNext ? state.pageInfoByListId[listId].endCursor : undefined,
|
2020-11-24 15:15:51 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
return gqlClient
|
|
|
|
.query({
|
|
|
|
query: listsIssuesQuery,
|
|
|
|
context: {
|
|
|
|
isSingleRequest: true,
|
|
|
|
},
|
|
|
|
variables,
|
|
|
|
})
|
|
|
|
.then(({ data }) => {
|
|
|
|
const { lists } = data[boardType]?.board;
|
|
|
|
const listIssues = formatListIssues(lists);
|
2021-01-03 14:25:43 +05:30
|
|
|
const listPageInfo = formatListsPageInfo(lists);
|
|
|
|
commit(types.RECEIVE_ISSUES_FOR_LIST_SUCCESS, { listIssues, listPageInfo, listId });
|
2020-11-24 15:15:51 +05:30
|
|
|
})
|
|
|
|
.catch(() => commit(types.RECEIVE_ISSUES_FOR_LIST_FAILURE, listId));
|
2019-09-04 21:01:54 +05:30
|
|
|
},
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
resetIssues: ({ commit }) => {
|
|
|
|
commit(types.RESET_ISSUES);
|
2020-10-24 23:57:45 +05:30
|
|
|
},
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
moveIssue: (
|
|
|
|
{ state, commit },
|
|
|
|
{ issueId, issueIid, issuePath, fromListId, toListId, moveBeforeId, moveAfterId },
|
|
|
|
) => {
|
|
|
|
const originalIssue = state.issues[issueId];
|
|
|
|
const fromList = state.issuesByListId[fromListId];
|
|
|
|
const originalIndex = fromList.indexOf(Number(issueId));
|
|
|
|
commit(types.MOVE_ISSUE, { originalIssue, fromListId, toListId, moveBeforeId, moveAfterId });
|
|
|
|
|
|
|
|
const { boardId } = state.endpoints;
|
|
|
|
const [fullProjectPath] = issuePath.split(/[#]/);
|
|
|
|
|
|
|
|
gqlClient
|
|
|
|
.mutate({
|
|
|
|
mutation: issueMoveListMutation,
|
|
|
|
variables: {
|
|
|
|
projectPath: fullProjectPath,
|
|
|
|
boardId: fullBoardId(boardId),
|
|
|
|
iid: issueIid,
|
|
|
|
fromListId: getIdFromGraphQLId(fromListId),
|
|
|
|
toListId: getIdFromGraphQLId(toListId),
|
|
|
|
moveBeforeId,
|
|
|
|
moveAfterId,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.then(({ data }) => {
|
|
|
|
if (data?.issueMoveList?.errors.length) {
|
|
|
|
commit(types.MOVE_ISSUE_FAILURE, { originalIssue, fromListId, toListId, originalIndex });
|
|
|
|
} else {
|
|
|
|
const issue = data.issueMoveList?.issue;
|
|
|
|
commit(types.MOVE_ISSUE_SUCCESS, { issue });
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(() =>
|
|
|
|
commit(types.MOVE_ISSUE_FAILURE, { originalIssue, fromListId, toListId, originalIndex }),
|
|
|
|
);
|
2019-09-04 21:01:54 +05:30
|
|
|
},
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
setAssignees: ({ commit, getters }, assigneeUsernames) => {
|
2021-02-22 17:27:13 +05:30
|
|
|
commit(types.SET_ASSIGNEE_LOADING, true);
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
return gqlClient
|
|
|
|
.mutate({
|
2021-02-22 17:27:13 +05:30
|
|
|
mutation: updateAssigneesMutation,
|
2021-01-29 00:20:46 +05:30
|
|
|
variables: {
|
|
|
|
iid: getters.activeIssue.iid,
|
|
|
|
projectPath: getters.activeIssue.referencePath.split('#')[0],
|
|
|
|
assigneeUsernames,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.then(({ data }) => {
|
2021-02-22 17:27:13 +05:30
|
|
|
const { nodes } = data.issueSetAssignees?.issue?.assignees || [];
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
commit('UPDATE_ISSUE_BY_ID', {
|
|
|
|
issueId: getters.activeIssue.id,
|
|
|
|
prop: 'assignees',
|
2021-02-22 17:27:13 +05:30
|
|
|
value: nodes,
|
2021-01-29 00:20:46 +05:30
|
|
|
});
|
2021-02-22 17:27:13 +05:30
|
|
|
|
|
|
|
return nodes;
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
createFlash({ message: __('An error occurred while updating assignees.') });
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
commit(types.SET_ASSIGNEE_LOADING, false);
|
2021-01-29 00:20:46 +05:30
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
setActiveIssueMilestone: async ({ commit, getters }, input) => {
|
|
|
|
const { activeIssue } = getters;
|
|
|
|
const { data } = await gqlClient.mutate({
|
|
|
|
mutation: issueSetMilestoneMutation,
|
|
|
|
variables: {
|
|
|
|
input: {
|
|
|
|
iid: String(activeIssue.iid),
|
|
|
|
milestoneId: getIdFromGraphQLId(input.milestoneId),
|
|
|
|
projectPath: input.projectPath,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
if (data.updateIssue.errors?.length > 0) {
|
|
|
|
throw new Error(data.updateIssue.errors);
|
|
|
|
}
|
|
|
|
|
|
|
|
commit(types.UPDATE_ISSUE_BY_ID, {
|
|
|
|
issueId: activeIssue.id,
|
|
|
|
prop: 'milestone',
|
|
|
|
value: data.updateIssue.issue.milestone,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
createNewIssue: ({ commit, state }, issueInput) => {
|
|
|
|
const input = issueInput;
|
|
|
|
const { boardType, endpoints } = state;
|
|
|
|
if (boardType === BoardType.project) {
|
|
|
|
input.projectPath = endpoints.fullPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
return gqlClient
|
|
|
|
.mutate({
|
|
|
|
mutation: issueCreateMutation,
|
|
|
|
variables: { input },
|
|
|
|
})
|
|
|
|
.then(({ data }) => {
|
|
|
|
if (data.createIssue.errors.length) {
|
|
|
|
commit(types.CREATE_ISSUE_FAILURE);
|
|
|
|
} else {
|
|
|
|
return data.createIssue?.issue;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
})
|
|
|
|
.catch(() => commit(types.CREATE_ISSUE_FAILURE));
|
2019-09-04 21:01:54 +05:30
|
|
|
},
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
addListIssue: ({ commit }, { list, issue, position }) => {
|
|
|
|
commit(types.ADD_ISSUE_TO_LIST, { list, issue, position });
|
|
|
|
},
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
addListNewIssue: ({ commit, dispatch }, { issueInput, list }) => {
|
|
|
|
const issue = formatIssue({ ...issueInput, id: 'tmp' });
|
|
|
|
commit(types.ADD_ISSUE_TO_LIST, { list, issue, position: 0 });
|
|
|
|
|
|
|
|
dispatch('createNewIssue', issueInput)
|
|
|
|
.then(res => {
|
|
|
|
commit(types.ADD_ISSUE_TO_LIST, {
|
|
|
|
list,
|
|
|
|
issue: formatIssue({ ...res, id: getIdFromGraphQLId(res.id) }),
|
|
|
|
});
|
|
|
|
commit(types.REMOVE_ISSUE_FROM_LIST, { list, issue });
|
|
|
|
})
|
|
|
|
.catch(() => commit(types.ADD_ISSUE_TO_LIST_FAILURE, { list, issueId: issueInput.id }));
|
2020-11-24 15:15:51 +05:30
|
|
|
},
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
setActiveIssueLabels: async ({ commit, getters }, input) => {
|
2021-01-29 00:20:46 +05:30
|
|
|
const { activeIssue } = getters;
|
2021-01-03 14:25:43 +05:30
|
|
|
const { data } = await gqlClient.mutate({
|
2021-02-22 17:27:13 +05:30
|
|
|
mutation: issueSetLabelsMutation,
|
2021-01-03 14:25:43 +05:30
|
|
|
variables: {
|
|
|
|
input: {
|
|
|
|
iid: String(activeIssue.iid),
|
|
|
|
addLabelIds: input.addLabelIds ?? [],
|
|
|
|
removeLabelIds: input.removeLabelIds ?? [],
|
|
|
|
projectPath: input.projectPath,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
if (data.updateIssue?.errors?.length > 0) {
|
|
|
|
throw new Error(data.updateIssue.errors);
|
|
|
|
}
|
|
|
|
|
|
|
|
commit(types.UPDATE_ISSUE_BY_ID, {
|
|
|
|
issueId: activeIssue.id,
|
|
|
|
prop: 'labels',
|
|
|
|
value: data.updateIssue.issue.labels.nodes,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
setActiveIssueDueDate: async ({ commit, getters }, input) => {
|
|
|
|
const { activeIssue } = getters;
|
|
|
|
const { data } = await gqlClient.mutate({
|
2021-02-22 17:27:13 +05:30
|
|
|
mutation: issueSetDueDateMutation,
|
2021-01-29 00:20:46 +05:30
|
|
|
variables: {
|
|
|
|
input: {
|
|
|
|
iid: String(activeIssue.iid),
|
|
|
|
projectPath: input.projectPath,
|
|
|
|
dueDate: input.dueDate,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
if (data.updateIssue?.errors?.length > 0) {
|
|
|
|
throw new Error(data.updateIssue.errors);
|
|
|
|
}
|
|
|
|
|
|
|
|
commit(types.UPDATE_ISSUE_BY_ID, {
|
|
|
|
issueId: activeIssue.id,
|
|
|
|
prop: 'dueDate',
|
|
|
|
value: data.updateIssue.issue.dueDate,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
setActiveIssueSubscribed: async ({ commit, getters }, input) => {
|
|
|
|
const { data } = await gqlClient.mutate({
|
|
|
|
mutation: issueSetSubscriptionMutation,
|
|
|
|
variables: {
|
|
|
|
input: {
|
|
|
|
iid: String(getters.activeIssue.iid),
|
|
|
|
projectPath: input.projectPath,
|
|
|
|
subscribedState: input.subscribed,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
if (data.issueSetSubscription?.errors?.length > 0) {
|
|
|
|
throw new Error(data.issueSetSubscription.errors);
|
|
|
|
}
|
|
|
|
|
|
|
|
commit(types.UPDATE_ISSUE_BY_ID, {
|
|
|
|
issueId: getters.activeIssue.id,
|
|
|
|
prop: 'subscribed',
|
|
|
|
value: data.issueSetSubscription.issue.subscribed,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
fetchBacklog: () => {
|
|
|
|
notImplemented();
|
|
|
|
},
|
|
|
|
|
|
|
|
bulkUpdateIssues: () => {
|
|
|
|
notImplemented();
|
|
|
|
},
|
|
|
|
|
|
|
|
fetchIssue: () => {
|
|
|
|
notImplemented();
|
|
|
|
},
|
|
|
|
|
|
|
|
toggleIssueSubscription: () => {
|
|
|
|
notImplemented();
|
|
|
|
},
|
|
|
|
|
|
|
|
showPage: () => {
|
|
|
|
notImplemented();
|
|
|
|
},
|
|
|
|
|
|
|
|
toggleEmptyState: () => {
|
|
|
|
notImplemented();
|
|
|
|
},
|
|
|
|
};
|