Commit 5a19b0b5 authored by Florie Guibert's avatar Florie Guibert

Fetch lists for epic boards

Review feedback
parent 7b4f9e53
......@@ -20,11 +20,6 @@ export default {
GlAlert,
},
mixins: [glFeatureFlagMixin()],
inject: {
isEpicBoard: {
default: false,
},
},
props: {
lists: {
type: Array,
......@@ -41,7 +36,7 @@ export default {
},
},
computed: {
...mapState(['boardLists', 'error']),
...mapState(['boardLists', 'error', 'isEpicBoard']),
...mapGetters(['isSwimlanesOn']),
boardListsToUse() {
return this.glFeatures.graphqlBoardLists || this.isSwimlanesOn || this.isEpicBoard
......
import { sortBy } from 'lodash';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import { urlParamsToObject } from '~/lib/utils/common_utils';
import { objectToQuery } from '~/lib/utils/url_utility';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import {
IterationFilterType,
IterationIDs,
......
......@@ -30,14 +30,14 @@ import {
import { EpicFilterType, IterationFilterType, GroupByParamType } from '../constants';
import epicQuery from '../graphql/epic.query.graphql';
import epicBoardListsQuery from '../graphql/epic_board_lists.query.graphql';
import epicsSwimlanesQuery from '../graphql/epics_swimlanes.query.graphql';
import issueMoveListMutation from '../graphql/issue_move_list.mutation.graphql';
import issueSetEpicMutation from '../graphql/issue_set_epic.mutation.graphql';
import issueSetWeightMutation from '../graphql/issue_set_weight.mutation.graphql';
import listUpdateLimitMetricsMutation from '../graphql/list_update_limit_metrics.mutation.graphql';
import updateBoardEpicUserPreferencesMutation from '../graphql/updateBoardEpicUserPreferences.mutation.graphql';
import epicBoardListsQuery from '../graphql/epic_board_lists.query.graphql';
import listsEpicsQuery from '../graphql/lists_epics.query.graphql';
import updateBoardEpicUserPreferencesMutation from '../graphql/updateBoardEpicUserPreferences.mutation.graphql';
import boardsStoreEE from './boards_store_ee';
import * as types from './mutation_types';
......@@ -318,6 +318,7 @@ export default {
if (state.isEpicBoard) {
// This currently always fails. Epics will be loaded and displayed in the next iteration
// Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/233438
return fetchAndFormatListEpics(state, variables)
.then(({ listEpics, listPageInfo }) => {
commit(types.RECEIVE_ITEMS_FOR_LIST_SUCCESS, {
......
......@@ -61,7 +61,6 @@ export default () => {
? parseInt($boardApp.dataset.boardWeight, 10)
: null,
scopedLabelsAvailable: parseBoolean($boardApp.dataset.scopedLabels),
isEpicBoard: true,
},
store,
apolloProvider,
......
......@@ -136,16 +136,16 @@ describe('performSearch', () => {
});
describe('fetchLists', () => {
it('should dispatch fetchIssueLists action when isEpicBoard is false on state', () => {
testAction({
it('should dispatch fetchIssueLists action when isEpicBoard is false on state', async () => {
await testAction({
action: actions.fetchLists,
state: { isEpicBoard: false },
expectedActions: [{ type: 'fetchIssueLists' }],
});
});
it('should dispatch fetchEpicLists action when isEpicBoard is true on state', () => {
testAction({
it('should dispatch fetchEpicLists action when isEpicBoard is true on state', async () => {
await testAction({
action: actions.fetchLists,
state: { isEpicBoard: true },
expectedActions: [{ type: 'fetchEpicLists' }],
......@@ -174,39 +174,33 @@ describe('fetchEpicLists', () => {
const formattedLists = formatBoardLists(queryResponse.data.group.epicBoard.lists);
it('should commit mutations RECEIVE_BOARD_LISTS_SUCCESS on success', (done) => {
it('should commit mutations RECEIVE_BOARD_LISTS_SUCCESS on success', async () => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
testAction(
actions.fetchEpicLists,
{},
await testAction({
action: actions.fetchEpicLists,
state,
[
expectedMutations: [
{
type: types.RECEIVE_BOARD_LISTS_SUCCESS,
payload: formattedLists,
},
],
[],
done,
);
});
});
it('should commit mutations RECEIVE_BOARD_LISTS_FAILURE on failure', (done) => {
it('should commit mutations RECEIVE_BOARD_LISTS_FAILURE on failure', async () => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject());
testAction(
actions.fetchEpicLists,
{},
await testAction({
action: actions.fetchEpicLists,
state,
[
expectedMutations: [
{
type: types.RECEIVE_BOARD_LISTS_FAILURE,
},
],
[],
done,
);
});
});
});
......
......@@ -37,6 +37,7 @@ describe('Board Store Mutations', () => {
const boardConfig = {
milestoneTitle: 'Milestone 1',
};
const isEpicBoard = true;
mutations[types.SET_INITIAL_BOARD_DATA](state, {
boardId,
......@@ -44,6 +45,7 @@ describe('Board Store Mutations', () => {
boardType,
disabled,
boardConfig,
isEpicBoard,
});
expect(state.boardId).toEqual(boardId);
......@@ -51,6 +53,7 @@ describe('Board Store Mutations', () => {
expect(state.boardType).toEqual(boardType);
expect(state.disabled).toEqual(disabled);
expect(state.boardConfig).toEqual(boardConfig);
expect(state.isEpicBoard).toEqual(isEpicBoard);
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment