1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-09 13:47:13 +02:00

feat: add lifecycle stage filter to project feature toggles (#10448)

Backend API is already implemented and ready to be used.

[issue/CTO-244](https://linear.app/unleash/issue/CTO-244/filter-by-lifecycle-on-project-page)
This commit is contained in:
Tymoteusz Czech 2025-08-01 10:22:32 +02:00 committed by GitHub
parent 3338ea4300
commit ddd503952b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 46 additions and 0 deletions

View File

@ -207,3 +207,34 @@ test('Project is not onboarded', async () => {
);
await screen.findByText('Welcome to your project');
});
test('renders lifecycle filters', async () => {
setupApi();
render(
<Routes>
<Route
path={'/projects/:projectId'}
element={
<ProjectFeatureToggles
environments={['development', 'production']}
/>
}
/>
</Routes>,
{
route: '/projects/default',
},
);
const addFilter = await screen.findByText('Filter');
fireEvent.click(addFilter);
const lifecycleFilter = await screen.findByText('Lifecycle stage');
fireEvent.click(lifecycleFilter);
await screen.findByText('Define');
await screen.findByText('Develop');
await screen.findByText('Rollout production');
await screen.findByText('Cleanup');
});

View File

@ -113,6 +113,7 @@ export const ProjectFeatureToggles = ({
state: tableState.state,
createdBy: tableState.createdBy,
archived: tableState.archived,
lifecycle: tableState.lifecycle,
};
const { favorite, unfavorite } = useFavoriteFeaturesApi();

View File

@ -111,6 +111,19 @@ export const ProjectOverviewFilters: VFC<IProjectOverviewFilters> = ({
singularOperators: ['IS'],
pluralOperators: ['IS_ANY_OF'],
},
{
label: 'Lifecycle stage',
icon: 'model_training',
options: [
{ label: 'Define', value: 'initial' },
{ label: 'Develop', value: 'pre-live' },
{ label: 'Rollout production', value: 'live' },
{ label: 'Cleanup', value: 'completed' },
],
filterKey: 'lifecycle',
singularOperators: ['IS', 'IS_NOT'],
pluralOperators: ['IS_ANY_OF', 'IS_NONE_OF'],
},
];
setAvailableFilters(availableFilters);

View File

@ -41,6 +41,7 @@ export const useProjectFeatureSearch = (
type: FilterItemParam,
createdBy: FilterItemParam,
archived: FilterItemParam,
lifecycle: FilterItemParam,
};
const [tableState, setTableState] = usePersistentTableState(
`${storageKey}-${projectId}`,