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