mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-23 12:31:54 +00:00
chore(ui): update connection filter labels to connected/disconnected
This commit is contained in:
@@ -6,6 +6,12 @@ export const filterProviders = [
|
||||
key: "connected",
|
||||
labelCheckboxGroup: "Connection",
|
||||
values: ["false", "true"],
|
||||
valueLabelMapping: [
|
||||
{
|
||||
false: { label: "Disconnected" },
|
||||
true: { label: "Connected" },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "provider__in",
|
||||
|
||||
@@ -196,6 +196,8 @@ export const CustomDropdownFilter = ({
|
||||
(entity as ScanEntity).providerInfo?.uid ||
|
||||
value
|
||||
);
|
||||
} else if ("label" in entity) {
|
||||
return entity.label;
|
||||
} else {
|
||||
return (
|
||||
(entity as ProviderEntity).alias ||
|
||||
@@ -207,6 +209,32 @@ export const CustomDropdownFilter = ({
|
||||
[filter.valueLabelMapping],
|
||||
);
|
||||
|
||||
const renderEntity = (entity: FilterEntity | undefined, value: string) => {
|
||||
if (!entity) return value;
|
||||
|
||||
if (isScanEntity(entity as ScanEntity)) {
|
||||
return <ComplianceScanInfo scan={entity as ScanEntity} />;
|
||||
}
|
||||
|
||||
const maybeProvider = entity as ProviderEntity;
|
||||
if ("provider" in maybeProvider) {
|
||||
return (
|
||||
<EntityInfoShort
|
||||
cloudProvider={maybeProvider.provider}
|
||||
entityAlias={maybeProvider.alias ?? undefined}
|
||||
entityId={maybeProvider.uid}
|
||||
hideCopyButton
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if ("label" in entity) {
|
||||
return <span>{entity.label}</span>;
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-2">
|
||||
<Popover
|
||||
@@ -319,24 +347,7 @@ export const CustomDropdownFilter = ({
|
||||
key={value}
|
||||
value={value}
|
||||
>
|
||||
{entity ? (
|
||||
isScanEntity(entity as ScanEntity) ? (
|
||||
<ComplianceScanInfo scan={entity as ScanEntity} />
|
||||
) : (
|
||||
<EntityInfoShort
|
||||
cloudProvider={
|
||||
(entity as ProviderEntity).provider
|
||||
}
|
||||
entityAlias={
|
||||
(entity as ProviderEntity).alias ?? undefined
|
||||
}
|
||||
entityId={(entity as ProviderEntity).uid}
|
||||
hideCopyButton
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
value
|
||||
)}
|
||||
{renderEntity(entity, value)}
|
||||
</Checkbox>
|
||||
);
|
||||
})}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { ProviderEntity } from "./providers";
|
||||
import { ScanEntity } from "./scans";
|
||||
|
||||
export type FilterEntity = ProviderEntity | ScanEntity;
|
||||
export type FilterEntity = ProviderEntity | ScanEntity | { label: string };
|
||||
|
||||
export interface FilterOption {
|
||||
key: string;
|
||||
|
||||
Reference in New Issue
Block a user