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

Fix negated iteration filter for boards

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