From ce45319cdcec4e1dc2c05399563f77e74982e3ae Mon Sep 17 00:00:00 2001 From: Fanna Lautenbach <lautenbach@astron.nl> Date: Thu, 14 Sep 2023 16:34:10 +0200 Subject: [PATCH] set project filter multi select options to only include the selected statuses of the project --- .../src/routes/Timeline/components/toolbar/Filters.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/toolbar/Filters.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/toolbar/Filters.js index 99820cc6804..5a5d1dccbf9 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/toolbar/Filters.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/toolbar/Filters.js @@ -85,6 +85,7 @@ export default function Filters(props) { const [schedulingUnitFilter, setSchedulingUnitFilter] = useState(timelineStore.schedulingUnitFilter) const [projectFilter, setProjectFilter] = useState(timelineStore.projectFilter) + const [projectAllOptionsWithStatus, setProjectAllOptionsWithStatus] = useState([]) const [projectStatusFilter, setProjectStatusFilter] = useState(timelineStore.projectStatusFilter ?? ["active"]) @@ -103,6 +104,7 @@ export default function Filters(props) { } const filteredProjectsOnState = multiSelectAllOptions.projectNamesWithState.filter(project => projectStatusFilter.includes(project.project_state_value)) + setProjectAllOptionsWithStatus(filteredProjectsOnState) setProjectFilter(filteredProjectsOnState.map(project => project.name)) }, [multiSelectAllOptions]) @@ -111,6 +113,7 @@ export default function Filters(props) { ["projectStatusFilter"]: projectStatusFilter, }) const filteredProjectsOnState = multiSelectAllOptions.projectNamesWithState.filter(project => projectStatusFilter.includes(project.project_state_value)) + setProjectAllOptionsWithStatus(filteredProjectsOnState) setProjectFilter(filteredProjectsOnState.map(project => project.name)) }, [projectStatusFilter]) @@ -238,7 +241,7 @@ export default function Filters(props) { tooltip="Select Project Name(s)" tooltipOptions={{position: 'left'}} value={projectFilter} - options={multiSelectAllOptions.projectNamesWithState} + options={projectAllOptionsWithStatus} maxSelectedLabels="1" filter filterBy="name" -- GitLab