feat: add per-namespace detail pages with dynamic sidebar sub-items

Add drill-down namespace views under the Polaris sidebar entry. Each
namespace gets a sidebar sub-item registered dynamically from audit data,
linking to /polaris/:namespace with a score summary and per-resource table.

Introduces a shared PolarisDataContext so the sidebar registrar and view
components share a single data fetch. Also updates the Artifact Hub
repository ID.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 23:09:40 -05:00
parent 818f4bc9cb
commit b217a8119e
7 changed files with 239 additions and 14 deletions
@@ -0,0 +1,29 @@
import { registerSidebarEntry } from '@kinvolk/headlamp-plugin/lib';
import React from 'react';
import { usePolarisDataContext } from '../api/PolarisDataContext';
import { getNamespaces } from '../api/polaris';
const registeredNamespaces = new Set<string>();
export default function DynamicSidebarRegistrar() {
const { data } = usePolarisDataContext();
React.useEffect(() => {
if (!data) return;
const namespaces = getNamespaces(data);
for (const ns of namespaces) {
if (registeredNamespaces.has(ns)) continue;
registeredNamespaces.add(ns);
registerSidebarEntry({
parent: 'polaris',
name: `polaris-ns-${ns}`,
label: ns,
url: `/polaris/${ns}`,
icon: 'mdi:folder-outline',
});
}
}, [data]);
return null;
}