diff --git a/src/components/DashboardView.test.tsx b/src/components/DashboardView.test.tsx index 78eb87d..4ddbb56 100644 --- a/src/components/DashboardView.test.tsx +++ b/src/components/DashboardView.test.tsx @@ -34,6 +34,17 @@ vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', () => ({ ), + SimpleTable: ({ data }: { data: Array }) => ( + + + {data.map((item, idx) => ( + + + + ))} + +
{JSON.stringify(item)}
+ ), PercentageCircle: ({ label }: { label: string }) => (
{label}
), diff --git a/src/components/DashboardView.tsx b/src/components/DashboardView.tsx index 103b671..9379373 100644 --- a/src/components/DashboardView.tsx +++ b/src/components/DashboardView.tsx @@ -100,19 +100,21 @@ export default function DashboardView() { return ( <> -
+
{data && (
Last updated: {formatAuditTime(data.AuditTime)} -
diff --git a/src/components/ExemptionManager.tsx b/src/components/ExemptionManager.tsx index 602e9a0..c9641b4 100644 --- a/src/components/ExemptionManager.tsx +++ b/src/components/ExemptionManager.tsx @@ -21,7 +21,12 @@ interface CheckFailure { * Exemption management UI for adding/removing Polaris exemptions * Uses annotation patches on the workload resource */ -export default function ExemptionManager({ workloadResult, namespace, kind, name }: ExemptionManagerProps) { +export default function ExemptionManager({ + workloadResult, + namespace, + kind, + name, +}: ExemptionManagerProps) { const [dialogOpen, setDialogOpen] = React.useState(false); const [selectedChecks, setSelectedChecks] = React.useState>(new Set()); const [exemptAll, setExemptAll] = React.useState(false); @@ -169,18 +174,11 @@ export default function ExemptionManager({ workloadResult, namespace, kind, name - setDialogOpen(false)} - title="Add Exemptions" - > + setDialogOpen(false)} title="Add Exemptions">
setExemptAll(e.target.checked)} - /> + setExemptAll(e.target.checked)} /> } label="Exempt from all checks" /> @@ -207,10 +205,10 @@ export default function ExemptionManager({ workloadResult, namespace, kind, name )} -
- +
+
), diff --git a/src/index.tsx b/src/index.tsx index a23edaa..6e11d17 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -69,7 +69,7 @@ registerRoute({ registerPluginSettings('polaris', PolarisSettings); // Register details view section for supported controller types -registerDetailsViewSection('polaris-audit', ({ resource }) => { +registerDetailsViewSection(({ resource }) => { const supportedKinds = ['Deployment', 'StatefulSet', 'DaemonSet', 'Job', 'CronJob']; if (!supportedKinds.includes(resource?.kind)) { @@ -84,7 +84,7 @@ registerDetailsViewSection('polaris-audit', ({ resource }) => { }); // Register app bar score badge -registerAppBarAction('polaris-score', () => ( +registerAppBarAction(() => (