Commit e75579b5 authored by Amy Troschinetz's avatar Amy Troschinetz Committed by Paul Slaughter

Hide inoperable group search Releases filter

- **app/assets/javascripts/filtered_search/
filtered_search_token_keys.js:**
- **ee/app/assets/javascripts/filtered_search/
issuable_filtered_search_token_keys.js:**

Allow removal of specific filters.

- **app/assets/javascripts/pages/groups/issues/index.js:**

Don't show release filter.

- **changelogs/unreleased/remove-group-release-filter.yml:**

Changelog.

- **spec/frontend/filtered_search/
issues_filtered_search_token_keys_spec.js**:

Unit test.
parent a7b9628b
...@@ -93,4 +93,13 @@ export default class FilteredSearchTokenKeys { ...@@ -93,4 +93,13 @@ export default class FilteredSearchTokenKeys {
this.tokenKeys.push(confidentialToken); this.tokenKeys.push(confidentialToken);
this.tokenKeysWithAlternative.push(confidentialToken); this.tokenKeysWithAlternative.push(confidentialToken);
} }
removeTokensForKeys(...keys) {
const keysSet = new Set(keys);
this.tokenKeys = this.tokenKeys.filter(({ key }) => !keysSet.has(key));
this.tokenKeysWithAlternative = this.tokenKeysWithAlternative.filter(
({ key }) => !keysSet.has(key),
);
}
} }
...@@ -9,6 +9,7 @@ import initManualOrdering from '~/manual_ordering'; ...@@ -9,6 +9,7 @@ import initManualOrdering from '~/manual_ordering';
const ISSUE_BULK_UPDATE_PREFIX = 'issue_'; const ISSUE_BULK_UPDATE_PREFIX = 'issue_';
IssuableFilteredSearchTokenKeys.addExtraTokensForIssues(); IssuableFilteredSearchTokenKeys.addExtraTokensForIssues();
IssuableFilteredSearchTokenKeys.removeTokensForKeys('release');
issuableInitBulkUpdateSidebar.init(ISSUE_BULK_UPDATE_PREFIX); issuableInitBulkUpdateSidebar.init(ISSUE_BULK_UPDATE_PREFIX);
initIssuablesList(); initIssuablesList();
......
---
title: Hide inoperable group search Releases filter
merge_request: 50010
author:
type: fixed
...@@ -145,18 +145,11 @@ class IssuesFilteredSearchTokenKeysEE extends FilteredSearchTokenKeys { ...@@ -145,18 +145,11 @@ class IssuesFilteredSearchTokenKeysEE extends FilteredSearchTokenKeys {
} }
removeEpicToken() { removeEpicToken() {
this.removeToken(epicTokenKey); this.removeTokensForKeys(epicTokenKey.key);
} }
removeIterationToken() { removeIterationToken() {
this.removeToken(iterationTokenKey); this.removeTokensForKeys(iterationTokenKey.key);
}
removeToken(tokenKey) {
const index = this.tokenKeys.findIndex((token) => token.key === tokenKey.key);
if (index >= 0) {
this.tokenKeys.splice(index, 1);
}
} }
} }
......
...@@ -145,4 +145,25 @@ describe('Issues Filtered Search Token Keys', () => { ...@@ -145,4 +145,25 @@ describe('Issues Filtered Search Token Keys', () => {
expect(result).toEqual(conditions[0]); expect(result).toEqual(conditions[0]);
}); });
}); });
describe('removeTokensForKeys', () => {
let initTokenKeys;
beforeEach(() => {
initTokenKeys = [...IssuableFilteredSearchTokenKeys.get()];
});
it('should remove the tokenKeys corresponding to the given keys', () => {
const [firstTokenKey, secondTokenKey, ...restTokens] = initTokenKeys;
IssuableFilteredSearchTokenKeys.removeTokensForKeys(firstTokenKey.key, secondTokenKey.key);
expect(IssuableFilteredSearchTokenKeys.get()).toEqual(restTokens);
});
it('should do nothing when key is not found', () => {
IssuableFilteredSearchTokenKeys.removeTokensForKeys('bogus');
expect(IssuableFilteredSearchTokenKeys.get()).toEqual(initTokenKeys);
});
});
}); });
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