From 1aa91cf60fa8db467342875b51cc73de272f61a3 Mon Sep 17 00:00:00 2001 From: Alan Buscaglia Date: Fri, 10 Apr 2026 14:06:47 +0200 Subject: [PATCH] fix(ui): exclude service filter from finding group resources endpoint (#10652) --- ui/CHANGELOG.md | 1 + ui/actions/finding-groups/finding-groups.ts | 17 ++++++++++++++++- .../table/findings-group-drill-down.tsx | 4 +++- .../table/inline-resource-container.tsx | 4 +++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ui/CHANGELOG.md b/ui/CHANGELOG.md index 10e462695d..1ff580a49e 100644 --- a/ui/CHANGELOG.md +++ b/ui/CHANGELOG.md @@ -26,6 +26,7 @@ All notable changes to the **Prowler UI** are documented in this file. - Deleting the active organization now switches to the target org before deleting, preventing JWT rejection from the backend [(#10491)](https://github.com/prowler-cloud/prowler/pull/10491) - Clear Filters now resets all filters including muted findings and auto-applies, Clear all in pills only removes pill-visible sub-filters, and the discard icon is now an Undo text button [(#10446)](https://github.com/prowler-cloud/prowler/pull/10446) - Send to Jira modal now dynamically fetches and displays available issue types per project instead of hardcoding `"Task"`, fixing failures on non-English Jira instances [(#10534)](https://github.com/prowler-cloud/prowler/pull/10534) +- Exclude service filter from finding group resources endpoint to prevent empty results when a service filter is active [(#10652)](https://github.com/prowler-cloud/prowler/pull/10652) --- diff --git a/ui/actions/finding-groups/finding-groups.ts b/ui/actions/finding-groups/finding-groups.ts index e4549d08a9..e1fc2441f7 100644 --- a/ui/actions/finding-groups/finding-groups.ts +++ b/ui/actions/finding-groups/finding-groups.ts @@ -41,10 +41,25 @@ function splitCsvFilterValues(value: string | string[] | undefined): string[] { return []; } +/** + * Filters that belong to finding-groups but are NOT valid for the + * finding-group resources sub-endpoint. These must be stripped before + * calling the resources API to avoid empty results. + */ +const FINDING_GROUP_ONLY_FILTERS = ["filter[service__in]"] as const; + function normalizeFindingGroupResourceFilters( filters: Record, ): Record { - const normalized = { ...filters }; + const normalized = Object.fromEntries( + Object.entries(filters).filter( + ([key]) => + !FINDING_GROUP_ONLY_FILTERS.includes( + key as (typeof FINDING_GROUP_ONLY_FILTERS)[number], + ), + ), + ); + const exactStatusFilter = normalized["filter[status]"]; if (exactStatusFilter !== undefined) { diff --git a/ui/components/findings/table/findings-group-drill-down.tsx b/ui/components/findings/table/findings-group-drill-down.tsx index 611ada375c..fd01917f09 100644 --- a/ui/components/findings/table/findings-group-drill-down.tsx +++ b/ui/components/findings/table/findings-group-drill-down.tsx @@ -270,7 +270,9 @@ export function FindingsGroupDrillDown({ colSpan={columns.length} className="h-24 text-center" > - No resources found. + {Object.keys(filters).length > 0 + ? "No resources found for the selected filters." + : "No resources found."} ) : null} diff --git a/ui/components/findings/table/inline-resource-container.tsx b/ui/components/findings/table/inline-resource-container.tsx index 6d0aeef9c0..723fddc005 100644 --- a/ui/components/findings/table/inline-resource-container.tsx +++ b/ui/components/findings/table/inline-resource-container.tsx @@ -363,7 +363,9 @@ export function InlineResourceContainer({ colSpan={columns.length} className="h-24 text-center" > - No resources found. + {Object.keys(filters).length > 0 + ? "No resources found for the selected filters." + : "No resources found."} )}