mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-05 03:12:14 +00:00
fix(ui): reflect actual provider in compliance detail header (#10674)
Co-authored-by: Alan Buscaglia <gentlemanprogramming@gmail.com>
This commit is contained in:
co-authored by
Alan Buscaglia
parent
31b645ee53
commit
c952ea018e
@@ -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
|
||||
|
||||
@@ -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 || [];
|
||||
|
||||
Reference in New Issue
Block a user