25175b65b8
Headlamp plugin for Rook-Ceph cluster visibility. Pages: - Overview dashboard: CephCluster health, capacity bar, resource counts (block pools, filesystems, object stores, PVs, PVCs), daemon pod health summary, non-Bound PVC alerts - Block Pools: CephBlockPool table with replication, failure domain, mirroring; slide-in detail panel - Pods: all Rook-Ceph daemon pods grouped by role with ready/total counts Native Headlamp integrations: - StorageClass table: Rook Type, Pool, Cluster ID columns - PV table: Rook Type, Pool columns - PVC detail injection: driver, type, pool, volume handle - PV detail injection: CSI volume attributes - Pod detail injection: Ceph daemon role badge - App bar badge: cluster health (HEALTH_OK/WARN/ERR), color-coded API / architecture: - src/api/k8s.ts: types + filters for ceph.rook.io/v1 CRDs; handles both default rook-ceph.* and custom-namespace provisioner strings - src/api/RookCephDataContext.tsx: shared context provider; fetches CephCluster, CephBlockPool, CephFilesystem, CephObjectStore CRDs plus daemon pods via label selectors - 37 unit tests (vitest + @testing-library/react) - TypeScript strict mode, zero any types - CI + release GitHub Actions workflows Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import '@testing-library/jest-dom';
|
|
|
|
// Node 22+ ships a minimal built-in `localStorage` global (property-bag only,
|
|
// no getItem/setItem/removeItem/clear) that shadows jsdom's Web Storage
|
|
// implementation. Provide a spec-compliant shim so code under test works.
|
|
if (typeof localStorage !== 'undefined' && typeof localStorage.getItem !== 'function') {
|
|
const store = new Map<string, string>();
|
|
|
|
const storage = {
|
|
getItem(key: string): string | null {
|
|
return store.get(key) ?? null;
|
|
},
|
|
setItem(key: string, value: string): void {
|
|
store.set(key, String(value));
|
|
},
|
|
removeItem(key: string): void {
|
|
store.delete(key);
|
|
},
|
|
clear(): void {
|
|
store.clear();
|
|
},
|
|
get length(): number {
|
|
return store.size;
|
|
},
|
|
key(index: number): string | null {
|
|
return [...store.keys()][index] ?? null;
|
|
},
|
|
};
|
|
|
|
Object.defineProperty(globalThis, 'localStorage', {
|
|
value: storage,
|
|
writable: true,
|
|
configurable: true,
|
|
});
|
|
|
|
if (typeof window !== 'undefined') {
|
|
Object.defineProperty(window, 'localStorage', {
|
|
value: storage,
|
|
writable: true,
|
|
configurable: true,
|
|
});
|
|
}
|
|
}
|