From c952ea018ed11ebb1c29b0e5329b1f2cdfddba17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Mart=C3=ADn?= Date: Tue, 14 Apr 2026 10:22:42 +0200 Subject: [PATCH] fix(ui): reflect actual provider in compliance detail header (#10674) Co-authored-by: Alan Buscaglia --- ui/CHANGELOG.md | 8 ++++ ui/actions/scans/scans.ts | 9 ++++- .../compliance/[compliancetitle]/page.tsx | 38 ++++++++++++------- 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/ui/CHANGELOG.md b/ui/CHANGELOG.md index f18b5ae14c..b84f0f89ab 100644 --- a/ui/CHANGELOG.md +++ b/ui/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to the **Prowler UI** are documented in this file. +## [1.23.1] (Prowler UNRELEASED) + +### 🐞 Fixed + +- Compliance detail page header now reflects the actual provider, alias and UID of the selected scan instead of always defaulting to AWS [(#10674)](https://github.com/prowler-cloud/prowler/pull/10674) + +--- + ## [1.23.0] (Prowler v5.23.0) ### 🚀 Added diff --git a/ui/actions/scans/scans.ts b/ui/actions/scans/scans.ts index 8716c5c1c6..7f8c2c8479 100644 --- a/ui/actions/scans/scans.ts +++ b/ui/actions/scans/scans.ts @@ -76,11 +76,18 @@ export const getScansByState = async () => { } }; -export const getScan = async (scanId: string) => { +export const getScan = async ( + scanId: string, + { include }: { include?: string } = {}, +) => { const headers = await getAuthHeaders({ contentType: false }); const url = new URL(`${apiBaseUrl}/scans/${scanId}`); + if (include) { + url.searchParams.set("include", include); + } + try { const response = await fetch(url.toString(), { headers, diff --git a/ui/app/(prowler)/compliance/[compliancetitle]/page.tsx b/ui/app/(prowler)/compliance/[compliancetitle]/page.tsx index d33168efc8..dd86be1f8a 100644 --- a/ui/app/(prowler)/compliance/[compliancetitle]/page.tsx +++ b/ui/app/(prowler)/compliance/[compliancetitle]/page.tsx @@ -82,23 +82,35 @@ export default async function ComplianceDetail({ }, }), getComplianceAttributes(complianceId), - selectedScanId ? getScan(selectedScanId) : Promise.resolve(null), + selectedScanId + ? getScan(selectedScanId, { include: "provider" }) + : Promise.resolve(null), ]); if (selectedScanResponse?.data) { const scan = selectedScanResponse.data; - selectedScan = { - id: scan.id, - providerInfo: { - provider: scan.providerInfo?.provider || "aws", - alias: scan.providerInfo?.alias, - uid: scan.providerInfo?.uid, - }, - attributes: { - name: scan.attributes.name, - completed_at: scan.attributes.completed_at, - }, - }; + const providerId = scan.relationships?.provider?.data?.id; + const providerData = providerId + ? selectedScanResponse.included?.find( + (item: { type: string; id: string }) => + item.type === "providers" && item.id === providerId, + ) + : undefined; + + if (providerData) { + selectedScan = { + id: scan.id, + providerInfo: { + provider: providerData.attributes.provider, + alias: providerData.attributes.alias, + uid: providerData.attributes.uid, + }, + attributes: { + name: scan.attributes.name, + completed_at: scan.attributes.completed_at, + }, + }; + } } const uniqueRegions = metadataInfoData?.data?.attributes?.regions || [];