fix(ui): reflect actual provider in compliance detail header (#10674)

Co-authored-by: Alan Buscaglia <gentlemanprogramming@gmail.com>
This commit is contained in:
Pedro Martín
2026-04-14 10:22:42 +02:00
committed by GitHub
co-authored by Alan Buscaglia
parent 31b645ee53
commit c952ea018e
3 changed files with 41 additions and 14 deletions
+8
View File
@@ -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
+8 -1
View File
@@ -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,
@@ -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 || [];