mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-08 01:15:49 +02:00
feat: add potentially stale filter to flags filter (#8798)
This PR adds the option to select potentially stale flags from the UI. It also updates the name we use for parsing from the API: instead of `potentiallyStale` we use `potentially-stale`. This follows the precedent set by "kill switch" (which we send as 'kill-switch'), the only other multi-word option that I could find in our filters.
This commit is contained in:
parent
8da201aed8
commit
b23dd940af
@ -44,6 +44,14 @@ export const ProjectOverviewFilters: VFC<IProjectOverviewFilters> = ({
|
|||||||
label: 'Stale',
|
label: 'Stale',
|
||||||
value: 'stale',
|
value: 'stale',
|
||||||
},
|
},
|
||||||
|
...(simplifyProjectOverview
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
label: 'Potentially stale',
|
||||||
|
value: 'potentially-stale',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
];
|
];
|
||||||
|
|
||||||
const availableFilters: IFilterItem[] = [
|
const availableFilters: IFilterItem[] = [
|
||||||
|
@ -577,7 +577,7 @@ const applyStaleConditions = (
|
|||||||
|
|
||||||
const { values, operator } = staleConditions;
|
const { values, operator } = staleConditions;
|
||||||
|
|
||||||
if (!values.includes('potentiallyStale')) {
|
if (!values.includes('potentially-stale')) {
|
||||||
applyGenericQueryParams(query, [
|
applyGenericQueryParams(query, [
|
||||||
{
|
{
|
||||||
...staleConditions,
|
...staleConditions,
|
||||||
@ -591,7 +591,7 @@ const applyStaleConditions = (
|
|||||||
|
|
||||||
const valueSet = new Set(
|
const valueSet = new Set(
|
||||||
values.filter((value) =>
|
values.filter((value) =>
|
||||||
['stale', 'active', 'potentiallyStale'].includes(value || ''),
|
['stale', 'active', 'potentially-stale'].includes(value || ''),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
const allSelected = valueSet.size === 3;
|
const allSelected = valueSet.size === 3;
|
||||||
|
@ -1000,42 +1000,42 @@ test('should search features by potentially stale', async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// single filters work
|
// single filters work
|
||||||
await check('IS:potentiallyStale', ['my_feature_c']);
|
await check('IS:potentially-stale', ['my_feature_c']);
|
||||||
// (stale or !potentiallyStale)
|
// (stale or !potentially-stale)
|
||||||
await check('IS_NOT:potentiallyStale', [
|
await check('IS_NOT:potentially-stale', [
|
||||||
'my_feature_a',
|
'my_feature_a',
|
||||||
'my_feature_b',
|
'my_feature_b',
|
||||||
'my_feature_d',
|
'my_feature_d',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// combo filters work
|
// combo filters work
|
||||||
await check('IS_ANY_OF:active,potentiallyStale', [
|
await check('IS_ANY_OF:active,potentially-stale', [
|
||||||
'my_feature_a',
|
'my_feature_a',
|
||||||
'my_feature_c',
|
'my_feature_c',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// (potentiallyStale OR stale)
|
// (potentially-stale OR stale)
|
||||||
await check('IS_ANY_OF:potentiallyStale,stale', [
|
await check('IS_ANY_OF:potentially-stale, stale', [
|
||||||
'my_feature_b',
|
'my_feature_b',
|
||||||
'my_feature_c',
|
'my_feature_c',
|
||||||
'my_feature_d',
|
'my_feature_d',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await check('IS_ANY_OF:active,potentiallyStale,stale', [
|
await check('IS_ANY_OF:active,potentially-stale,stale', [
|
||||||
'my_feature_a',
|
'my_feature_a',
|
||||||
'my_feature_b',
|
'my_feature_b',
|
||||||
'my_feature_c',
|
'my_feature_c',
|
||||||
'my_feature_d',
|
'my_feature_d',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await check('IS_NONE_OF:active,potentiallyStale,stale', []);
|
await check('IS_NONE_OF:active,potentially-stale,stale', []);
|
||||||
|
|
||||||
await check('IS_NONE_OF:active,potentiallyStale', [
|
await check('IS_NONE_OF:active,potentially-stale', [
|
||||||
'my_feature_b',
|
'my_feature_b',
|
||||||
'my_feature_d',
|
'my_feature_d',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await check('IS_NONE_OF:potentiallyStale,stale', ['my_feature_a']);
|
await check('IS_NONE_OF:potentially-stale,stale', ['my_feature_a']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should filter features by combined operators', async () => {
|
test('should filter features by combined operators', async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user