feat: consolidate dashboard pages, fix namespace links, add tests

Merge Overview and Full Audit into a single dashboard page that always
shows the skipped check count. Fix namespace link 404s by using
Headlamp's Link component (which generates cluster-prefixed URLs)
instead of raw react-router-dom Link. Add vitest unit tests for all
polaris.ts utility functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-07 14:10:08 -05:00
parent cc280034f6
commit 6281dbfa5e
8 changed files with 329 additions and 68 deletions
+12 -2
View File
@@ -1,4 +1,5 @@
import {
Link,
Loader,
NameValueTable,
SectionBox,
@@ -7,7 +8,6 @@ import {
StatusLabel,
} from '@kinvolk/headlamp-plugin/lib/CommonComponents';
import React from 'react';
import { Link } from 'react-router-dom';
import {
computeScore,
countResultsForItems,
@@ -28,6 +28,7 @@ interface NamespaceRow {
pass: number;
warning: number;
danger: number;
skipped: number;
}
export default function NamespacesListView() {
@@ -77,6 +78,7 @@ export default function NamespacesListView() {
pass: counts.pass,
warning: counts.warning,
danger: counts.danger,
skipped: counts.skipped,
};
});
@@ -89,7 +91,9 @@ export default function NamespacesListView() {
{
label: 'Namespace',
getter: (row: NamespaceRow) => (
<Link to={`/polaris/ns/${row.namespace}`}>{row.namespace}</Link>
<Link routeName="polaris-namespace" params={{ namespace: row.namespace }}>
{row.namespace}
</Link>
),
},
{
@@ -116,6 +120,12 @@ export default function NamespacesListView() {
<StatusLabel status="error">{row.danger}</StatusLabel>
),
},
{
label: 'Skipped',
getter: (row: NamespaceRow) => (
<StatusLabel status="">{row.skipped}</StatusLabel>
),
},
]}
data={rows}
emptyMessage="No namespaces found in Polaris audit data."