Commit 64a052f6 authored by Florie Guibert's avatar Florie Guibert Committed by Simon Knox

Fix bug - Swimlanes do not show all issues

parent 39a42292
......@@ -111,7 +111,7 @@ export default {
handler() {
Promise.all(
this.lists.map((list) => {
return this.fetchItemsForList({ listId: list.id });
return this.fetchItemsForList({ listId: list.id, forSwimlanes: true });
}),
)
.then(() => this.doneLoadingSwimlanesItems())
......
......@@ -304,7 +304,7 @@ export default {
fetchItemsForList: (
{ state, commit, getters },
{ listId, fetchNext = false, noEpicIssues = false },
{ listId, fetchNext = false, noEpicIssues = false, forSwimlanes = false },
) => {
commit(types.REQUEST_ITEMS_FOR_LIST, { listId, fetchNext });
......@@ -312,6 +312,9 @@ export default {
if (noEpicIssues && epicId !== undefined) {
return null;
}
if (forSwimlanes && epicId === undefined && filterParams.epicWildcardId === undefined) {
filterParams.epicWildcardId = EpicFilterType.any.toUpperCase();
}
const variables = {
id: listId,
......@@ -319,7 +322,7 @@ export default {
? { ...filterParams, epicWildcardId: EpicFilterType.none.toUpperCase() }
: { ...filterParams, epicId },
after: fetchNext ? state.pageInfoByListId[listId].endCursor : undefined,
first: 20,
first: forSwimlanes ? undefined : 20,
};
if (getters.isEpicBoard) {
......
......@@ -9,8 +9,9 @@ import * as types from 'ee/boards/stores/mutation_types';
import mutations from 'ee/boards/stores/mutations';
import { TEST_HOST } from 'helpers/test_constants';
import testAction from 'helpers/vuex_action_helper';
import { formatBoardLists } from '~/boards/boards_util';
import { formatBoardLists, formatListIssues } from '~/boards/boards_util';
import { issuableTypes } from '~/boards/constants';
import listsIssuesQuery from '~/boards/graphql/lists_issues.query.graphql';
import * as typesCE from '~/boards/stores/mutation_types';
import * as commonUtils from '~/lib/utils/common_utils';
import { mergeUrlParams, removeParams } from '~/lib/utils/url_utility';
......@@ -19,6 +20,7 @@ import {
mockLists,
mockIssue,
mockIssue2,
mockIssues,
mockEpic,
rawIssue,
mockMilestones,
......@@ -322,6 +324,89 @@ describe('fetchEpicsSwimlanes', () => {
});
});
describe('fetchItemsForList', () => {
const listId = mockLists[0].id;
const state = {
fullPath: 'gitlab-org',
boardId: '1',
filterParams: {},
boardType: 'group',
};
const mockIssuesNodes = mockIssues.map((issue) => ({ node: issue }));
const pageInfo = {
endCursor: '',
hasNextPage: false,
};
const queryResponse = {
data: {
group: {
board: {
lists: {
nodes: [
{
id: listId,
issues: {
edges: mockIssuesNodes,
pageInfo,
},
},
],
},
},
},
},
};
const formattedIssues = formatListIssues(queryResponse.data.group.board.lists);
const listPageInfo = {
[listId]: pageInfo,
};
it('add epicWildcardId with ANY as value when forSwimlanes is true', () => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
testAction(
actions.fetchItemsForList,
{ listId, forSwimlanes: true },
state,
[
{
type: types.REQUEST_ITEMS_FOR_LIST,
payload: { listId, fetchNext: false },
},
{
type: types.RECEIVE_ITEMS_FOR_LIST_SUCCESS,
payload: { listItems: formattedIssues, listPageInfo, listId, noEpicIssues: false },
},
],
[],
() => {
expect(gqlClient.query).toHaveBeenCalledWith({
query: listsIssuesQuery,
variables: {
boardId: 'gid://gitlab/Board/1',
filters: {
epicWildcardId: 'ANY',
},
fullPath: 'gitlab-org',
id: 'gid://gitlab/List/1',
isGroup: true,
isProject: false,
},
context: {
isSingleRequest: true,
},
});
},
);
});
});
describe('updateBoardEpicUserPreferences', () => {
const state = {
boardId: 1,
......
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