Commit 416c0477 authored by Florie Guibert's avatar Florie Guibert

Fix negated iteration filter for boards

parent a97ed09f
......@@ -151,10 +151,10 @@ export default {
});
}
if (this.filterParams['not[iteration_id]']) {
if (this.filterParams['not[iterationId]']) {
filteredSearchValue.push({
type: 'iteration_id',
value: { data: this.filterParams['not[iteration_id]'], operator: '!=' },
type: 'iteration',
value: { data: this.filterParams['not[iterationId]'], operator: '!=' },
});
}
......
......@@ -10,5 +10,6 @@ export const gqlClient = createDefaultClient(
return object.__typename === 'BoardList' ? object.iid : defaultDataIdFromObject(object);
},
},
batchMax: 2,
},
);
......@@ -97,8 +97,14 @@ export default () => {
}
});
const { releasesFetchPath } = $boardApp.dataset;
initBoardsFilteredSearch(apolloProvider, isLoggedIn(), releasesFetchPath);
const { releasesFetchPath, epicFeatureAvailable, iterationFeatureAvailable } = $boardApp.dataset;
initBoardsFilteredSearch(
apolloProvider,
isLoggedIn(),
releasesFetchPath,
parseBoolean(epicFeatureAvailable),
parseBoolean(iterationFeatureAvailable),
);
mountBoardApp($boardApp);
......
......@@ -4,7 +4,13 @@ import store from '~/boards/stores';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { queryToObject } from '~/lib/utils/url_utility';
export default (apolloProvider, isSignedIn, releasesFetchPath) => {
export default (
apolloProvider,
isSignedIn,
releasesFetchPath,
epicFeatureAvailable,
iterationFeatureAvailable,
) => {
const el = document.getElementById('js-issue-board-filtered-search');
const rawFilterParams = queryToObject(window.location.search, { gatherArrays: true });
......@@ -23,6 +29,8 @@ export default (apolloProvider, isSignedIn, releasesFetchPath) => {
initialFilterParams,
isSignedIn,
releasesFetchPath,
epicFeatureAvailable,
iterationFeatureAvailable,
},
store, // TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/324094
apolloProvider,
......
......@@ -2,7 +2,7 @@ import {
FiltersInfo as FiltersInfoCE,
formatIssueInput as formatIssueInputCe,
} from '~/boards/boards_util';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import { getIdFromGraphQLId, isGid } from '~/graphql_shared/utils';
import { objectToQuery, queryToObject } from '~/lib/utils/url_utility';
import {
EPIC_LANE_BASE_HEIGHT,
......@@ -43,6 +43,10 @@ function fullIterationId(id) {
return null;
}
if (isGid(id)) {
return id;
}
if (id === IterationIDs.CURRENT) {
return 'CURRENT';
}
......@@ -232,6 +236,7 @@ export const FiltersInfo = {
},
iterationId: {
negatedSupport: true,
transform: (iterationId) => fullIterationId(iterationId),
remap: (k, v) => {
return v.endsWith(IterationFilterType.any) ||
v.endsWith(IterationFilterType.none) ||
......
......@@ -22,6 +22,7 @@ export default {
weight: __('Weight'),
},
mixins: [glFeatureFlagMixin()],
inject: ['epicFeatureAvailable', 'iterationFeatureAvailable'],
computed: {
isGroupBoard() {
return this.boardType === BoardType.group;
......@@ -36,26 +37,34 @@ export default {
const tokens = [
...this.tokensCE,
{
type: 'epic',
title: epic,
icon: 'epic',
token: EpicToken,
unique: true,
symbol: '&',
idProperty: 'id',
useIdValue: true,
fullPath: this.epicsGroupPath,
},
{
icon: 'iteration',
title: iteration,
type: 'iteration',
operators: OPERATOR_IS_AND_IS_NOT,
token: IterationToken,
unique: true,
fetchIterations: this.fetchIterations,
},
...(this.epicFeatureAvailable
? [
{
type: 'epic',
title: epic,
icon: 'epic',
token: EpicToken,
unique: true,
symbol: '&',
idProperty: 'id',
useIdValue: true,
fullPath: this.epicsGroupPath,
},
]
: []),
...(this.iterationFeatureAvailable
? [
{
icon: 'iteration',
title: iteration,
type: 'iteration',
operators: OPERATOR_IS_AND_IS_NOT,
token: IterationToken,
unique: true,
fetchIterations: this.fetchIterations,
},
]
: []),
{
type: 'weight',
title: weight,
......
......@@ -32,7 +32,6 @@ RSpec.describe 'User visits issue boards', :js do
shared_examples "visiting board path" do
before do
stub_const('GitlabSchema::DEFAULT_MAX_COMPLEXITY', 300)
visit board_path
wait_for_requests
......
......@@ -16,6 +16,8 @@ describe('IssueBoardFilter', () => {
provide: {
isSignedIn: true,
releasesFetchPath: '/releases',
epicFeatureAvailable: true,
iterationFeatureAvailable: true,
},
});
};
......
......@@ -70,7 +70,7 @@ describe('setFilters', () => {
filterVariables: {
weight: 3,
not: {
iterationId: '1',
iterationId: 'gid://gitlab/Iteration/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