Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Add Kubernetes storage native table
rcourtman0d22db1a27ac
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex a88e17f987..48183f3b4d 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -179,7 +179,10 @@ Secret rows: the shared table wording may indicate metadata-only inventory, butmust not imply payload fields were read when the agent used Kubernetesmetadata-only API responses. Kubernetes Node inventory must also be reachablethrough a dedicated native tab, not only the overview stack, while retaining the-shared `PlatformSectionTabs` shell.+shared `PlatformSectionTabs` shell. Kubernetes storage inventory must likewise+stay on the shared tab, toolbar, table, table-alignment, and inline-detail+primitives while the unified-resource owner supplies StorageClass,+PersistentVolume, and PersistentVolumeClaim-specific columns.1. `frontend-modern/src/components/Settings/APIAccessPanel.tsx` shared with `security-privacy`: the API Access settings intro is both a security/privacy token-management trust surface and a canonical settings-shell presentation boundary.The panel may own shell placement and local action layout, butdiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 3e59742745..9fb5e95ea6 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -129,6 +129,7 @@ cross-source deduplication.105. `frontend-modern/src/features/kubernetes/KubernetesClustersTable.tsx`106. `frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx`107. `frontend-modern/src/features/kubernetes/KubernetesNodesTable.tsx`+108. `frontend-modern/src/features/kubernetes/KubernetesStorageTable.tsx`## Shared Boundaries@@ -271,6 +272,12 @@ reintroduce false Swarm capability surfaces.Kubernetes Node inventory is an API-native resource surface, not merelyoverview chrome: `/kubernetes/nodes` must expose the bespoke node table whilethe overview may still include the same rows for cluster orientation.+ Kubernetes storage inventory is likewise API-native: `/kubernetes/storage`+ must render StorageClass, PersistentVolume, and PersistentVolumeClaim rows+ through a storage-specific table that preserves cluster scope, binding mode+ or phase, class, size/request, access/reclaim policy, provisioner, and+ PV/PVC binding targets instead of routing those API objects through the+ generic Kubernetes inventory table.2. Add typed accessors and views in `internal/unifiedresources/views.go`3. Add source ingestion/adaptation in the adapter layer onlyFrontend resource platform contracts indiff --git a/frontend-modern/src/features/kubernetes/KubernetesInventoryTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesInventoryTable.tsxindex 019f3605a8..1d477a3010 100644--- a/frontend-modern/src/features/kubernetes/KubernetesInventoryTable.tsx+++ b/frontend-modern/src/features/kubernetes/KubernetesInventoryTable.tsx@@ -10,7 +10,6 @@ import {TableHeader,TableRow,} from '@/components/shared/Table';-import { formatBytes } from '@/utils/format';import { getResourceTypeLabel } from '@/utils/resourceTypePresentation';import { getSimpleStatusIndicator } from '@/utils/status';import { asTrimmedString } from '@/utils/stringUtils';@@ -32,7 +31,6 @@ import type { Resource } from '@/types/resource';type KubernetesInventoryVariant =| 'controllers'| 'services'- | 'storage'| 'networking'| 'config'| 'policy'@@ -43,8 +41,6 @@ const textValue = (value: string | undefined): string => asTrimmedString(value)const numberValue = (value: number | undefined): JSX.Element => (<span class="tabular-nums">{value ?? 0}</span>);-const byteValue = (value: number | undefined): string =>- typeof value === 'number' && value > 0 ? formatBytes(value) : '—';const joinValues = (values: readonly (string | undefined)[] | undefined): string =>(values ?? []).map((value) => asTrimmedString(value))@@ -61,8 +57,6 @@ const tableTitle = (variant: KubernetesInventoryVariant, explicit?: string): strreturn 'Controllers';case 'services':return 'Services';- case 'storage':- return 'Storage';case 'networking':return 'Networking';case 'config':@@ -156,24 +150,6 @@ const KubernetesInventoryHeader: Component<{ variant: KubernetesInventoryVariant>Namespace</TableHead>- <Show when={props.variant === 'storage'}>- <TableHead class={`${getPlatformTableHeadClassForKind('text')} md:w-[12%]`}>- Phase / mode- </TableHead>- <TableHead- class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[14%]`}- >- Class- </TableHead>- <TableHead class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[12%]`}>- Size- </TableHead>- <TableHead- class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[21%]`}- >- Detail- </TableHead>- </Show><Show when={props.variant === 'services' || props.variant === 'networking'}><TableHead class={`${getPlatformTableHeadClassForKind('text')} md:w-[14%]`}>Type</TableHead><TableHead@@ -309,23 +285,6 @@ const KubernetesInventoryRow: Component<{props.resource.kubernetes?.addressType ||props.resource.kubernetes?.policyTypes?.join(', '),);- const storagePhase = () =>- textValue(- props.resource.kubernetes?.phase ||- props.resource.kubernetes?.volumeBindingMode ||- props.resource.kubernetes?.reclaimPolicy,- );- const storageClass = () =>- textValue(props.resource.kubernetes?.storageClass || props.resource.name);- const storageDetail = () =>- textValue(- props.resource.kubernetes?.volumeName ||- [props.resource.kubernetes?.claimNamespace, props.resource.kubernetes?.claimName]- .filter(Boolean)- .join('/') ||- props.resource.kubernetes?.provisioner ||- props.resource.kubernetes?.parameterKeys?.join(', '),- );const configState = () =>textValue(props.resource.kubernetes?.phase ||@@ -450,26 +409,6 @@ const KubernetesInventoryRow: Component<{>{namespace()}</TableCell>- <Show when={props.variant === 'storage'}>- <TableCell class={`${getPlatformTableCellClassForKind('text')} text-base-content`}>- {storagePhase()}- </TableCell>- <TableCell- class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}- >- {storageClass()}- </TableCell>- <TableCell class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}>- {byteValue(- props.resource.kubernetes?.capacityBytes || props.resource.kubernetes?.requestedBytes,- )}- </TableCell>- <TableCell- class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}- >- {storageDetail()}- </TableCell>- </Show><Show when={props.variant === 'services' || props.variant === 'networking'}><TableCell class={`${getPlatformTableCellClassForKind('text')} text-base-content`}>{networkType()}diff --git a/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx b/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsxindex 2c94418128..5fc4734fd9 100644--- a/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx+++ b/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx@@ -17,6 +17,7 @@ import { KubernetesClustersTable } from './KubernetesClustersTable';import { KubernetesDeploymentsTable } from './KubernetesDeploymentsTable';import { KubernetesInventoryTable } from './KubernetesInventoryTable';import { KubernetesNodesTable } from './KubernetesNodesTable';+import { KubernetesStorageTable } from './KubernetesStorageTable';import {KUBERNETES_TAB_SPECS,buildKubernetesPageModel,@@ -119,9 +120,8 @@ export function KubernetesPageSurface() {/></Show><Show when={activeTab() === 'storage'}>- <KubernetesInventoryTable+ <KubernetesStorageTableresources={model().storage}- variant="storage"emptyIcon={k8sIcon()}emptyTitle="No Kubernetes volume resources reported"emptyDescription="StorageClasses, persistent volumes, and claims appear here once the agent can read storage inventory."diff --git a/frontend-modern/src/features/kubernetes/KubernetesStorageTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesStorageTable.tsxnew file mode 100644index 0000000000..bef1b15a73--- /dev/null+++ b/frontend-modern/src/features/kubernetes/KubernetesStorageTable.tsx@@ -0,0 +1,359 @@+import { For, Show, type Component, type JSX } from 'solid-js';+import { StatusDot } from '@/components/shared/StatusDot';+import { TableCard } from '@/components/shared/TableCard';+import { TableCardHeader } from '@/components/shared/TableCardHeader';+import {+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+} from '@/components/shared/Table';+import { formatBytes } from '@/utils/format';+import { getSimpleStatusIndicator } from '@/utils/status';+import { asTrimmedString } from '@/utils/stringUtils';+import {+ PLATFORM_HEALTH_FILTER_OPTIONS,+ PLATFORM_TABLE_BODY_CLASS,+ PLATFORM_TABLE_CARD_CLASS,+ PLATFORM_TABLE_HEADER_ROW_CLASS,+ PlatformTableEmptyState,+ PlatformTableToolbar,+ createPlatformTableFilterState,+ filterPlatformResources,+ getPlatformTableCellClassForKind,+ getPlatformTableHeadClassForKind,+ type PlatformResourceStatusFilter,+} from '@/features/platformPage/sharedPlatformPage';+import {+ PlatformResourceDetailTableRow,+ createPlatformResourceDetailState,+ createPlatformResourceLabelResolver,+ getPlatformResourceDetailRowClass,+} from '@/features/platformPage/PlatformResourceDetailTableRow';+import type { Resource } from '@/types/resource';++// Kubernetes storage is intentionally not rendered by the generic+// inventory table. StorageClass, PersistentVolume, and+// PersistentVolumeClaim expose different API fields, and operators need+// to see binding mode, reclaim policy, access modes, requested capacity,+// and claim/volume bindings without mentally decoding a catch-all+// "detail" column.++const ACCESS_MODE_LABELS: Record<string, string> = {+ ReadOnlyMany: 'ROX',+ ReadWriteMany: 'RWX',+ ReadWriteOnce: 'RWO',+ ReadWriteOncePod: 'RWOP',+};++const textValue = (value: string | undefined): string => asTrimmedString(value) || '—';++const storageName = (resource: Resource): string =>+ asTrimmedString(resource.displayName) || asTrimmedString(resource.name) || resource.id;++const storageKind = (resource: Resource): string => {+ if (resource.type === 'k8s-storage-class') return 'StorageClass';+ if (resource.type === 'k8s-persistent-volume') return 'PV';+ if (resource.type === 'k8s-persistent-volume-claim') return 'PVC';+ return resource.kubernetes?.resourceKind || resource.type;+};++const storageScope = (resource: Resource): string => {+ const clusterScope =+ asTrimmedString(resource.kubernetes?.clusterId) ||+ asTrimmedString(resource.kubernetes?.clusterName);+ const namespace = asTrimmedString(resource.kubernetes?.namespace);+ if (namespace) {+ return clusterScope ? `${clusterScope}/${namespace}` : namespace;+ }+ return clusterScope || 'Cluster';+};++const bindingOrPhase = (resource: Resource): string => {+ if (resource.type === 'k8s-storage-class') {+ return textValue(resource.kubernetes?.volumeBindingMode || 'Immediate');+ }+ return textValue(resource.kubernetes?.phase);+};++const storageClass = (resource: Resource): string => {+ if (resource.type === 'k8s-storage-class') return storageName(resource);+ return textValue(resource.kubernetes?.storageClass);+};++const capacityLabel = (resource: Resource): string => {+ const capacity = resource.kubernetes?.capacityBytes;+ const requested = resource.kubernetes?.requestedBytes;+ if (resource.type === 'k8s-persistent-volume-claim') {+ if (+ typeof capacity === 'number' &&+ capacity > 0 &&+ typeof requested === 'number' &&+ requested > 0+ ) {+ if (capacity !== requested) return `${formatBytes(capacity)} / ${formatBytes(requested)} req`;+ return formatBytes(capacity);+ }+ if (typeof requested === 'number' && requested > 0) return `${formatBytes(requested)} req`;+ }+ if (typeof capacity === 'number' && capacity > 0) return formatBytes(capacity);+ return '—';+};++const summarizeAccessModes = (+ accessModes: string[] | undefined,+): { label: string; title: string } => {+ const modes = (accessModes ?? [])+ .map((mode) => asTrimmedString(mode))+ .filter((mode): mode is string => typeof mode === 'string' && mode.length > 0);+ if (modes.length === 0) return { label: '—', title: '' };+ return {+ label: modes.map((mode) => ACCESS_MODE_LABELS[mode] || mode).join(', '),+ title: modes.join(', '),+ };+};++const policyLabel = (resource: Resource): { label: string; title: string } => {+ const accessModes = summarizeAccessModes(resource.kubernetes?.accessModes);+ const parts = accessModes.label === '—' ? [] : [accessModes.label];+ const titleParts = accessModes.title ? [accessModes.title] : [];+ const reclaimPolicy = asTrimmedString(resource.kubernetes?.reclaimPolicy);+ if (reclaimPolicy) {+ parts.push(reclaimPolicy);+ titleParts.push(`Reclaim: ${reclaimPolicy}`);+ }+ if (+ resource.type === 'k8s-storage-class' &&+ resource.kubernetes?.allowVolumeExpansion !== undefined+ ) {+ const expansion = resource.kubernetes.allowVolumeExpansion ? 'Expandable' : 'Fixed';+ parts.push(expansion);+ titleParts.push(`Volume expansion: ${expansion}`);+ }+ return { label: parts.join(' · ') || '—', title: titleParts.join(' · ') };+};++const bindingTarget = (resource: Resource): { label: string; title: string } => {+ if (resource.type === 'k8s-storage-class') {+ const provisioner = textValue(resource.kubernetes?.provisioner);+ const parameterKeys = resource.kubernetes?.parameterKeys ?? [];+ return {+ label: provisioner,+ title:+ parameterKeys.length > 0+ ? `${provisioner} · params: ${parameterKeys.join(', ')}`+ : provisioner,+ };+ }+ if (resource.type === 'k8s-persistent-volume') {+ const claim = [resource.kubernetes?.claimNamespace, resource.kubernetes?.claimName]+ .map((value) => asTrimmedString(value))+ .filter(Boolean)+ .join('/');+ return { label: claim || 'Unclaimed', title: claim || 'Unclaimed' };+ }+ const volumeName = asTrimmedString(resource.kubernetes?.volumeName);+ return { label: volumeName || 'Unbound', title: volumeName || 'Unbound' };+};++export const KubernetesStorageTable: Component<{+ resources: Resource[];+ emptyIcon: JSX.Element;+ emptyTitle: string;+ emptyDescription: string;+ title?: string;+ showToolbar?: boolean;+}> = (props) => {+ const tableState = createPlatformTableFilterState({+ resources: () => props.resources,+ initialStatus: 'all' as PlatformResourceStatusFilter,+ filter: filterPlatformResources,+ });+ const drawer = createPlatformResourceDetailState({ idPrefix: 'kubernetes-storage-drawer' });+ const resolveResourceLabel = createPlatformResourceLabelResolver(() => props.resources);++ return (+ <Show+ when={props.resources.length > 0}+ fallback={+ <PlatformTableEmptyState+ icon={props.emptyIcon}+ title={props.emptyTitle}+ description={props.emptyDescription}+ />+ }+ >+ <div class="space-y-3">+ <Show when={props.showToolbar !== false}>+ <PlatformTableToolbar+ search={tableState.search}+ onSearchChange={tableState.setSearch}+ searchPlaceholder="Search storage inventory"+ status={tableState.status()}+ onStatusChange={tableState.setStatus}+ statusOptions={PLATFORM_HEALTH_FILTER_OPTIONS}+ visible={tableState.visible()}+ total={tableState.total()}+ rowNoun="storage resources"+ />+ </Show>++ <Show+ when={tableState.filtered().length > 0}+ fallback={+ <PlatformTableEmptyState+ icon={props.emptyIcon}+ title="No volume resources match current filters"+ description="Adjust the search or status filter to see more Kubernetes volume resources."+ />+ }+ >+ <TableCard class={PLATFORM_TABLE_CARD_CLASS}>+ <TableCardHeader title={props.title ?? 'Storage Classes, Volumes, and Claims'} />+ <Table class="min-w-full table-fixed text-xs md:min-w-[1120px]">+ <TableHeader>+ <TableRow class={PLATFORM_TABLE_HEADER_ROW_CLASS}>+ <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[19%]`}>+ Resource+ </TableHead>+ <TableHead class={`${getPlatformTableHeadClassForKind('text')} md:w-[10%]`}>+ Kind+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[13%]`}+ >+ Scope+ </TableHead>+ <TableHead class={`${getPlatformTableHeadClassForKind('text')} md:w-[14%]`}>+ Binding / phase+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[10%]`}+ >+ Class+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[8%]`}+ >+ Size+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[12%]`}+ >+ Access / policy+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[14%]`}+ >+ Provider / binding+ </TableHead>+ </TableRow>+ </TableHeader>+ <TableBody class={PLATFORM_TABLE_BODY_CLASS}>+ <For each={tableState.filtered()}>+ {(resource) => {+ const indicator = () => getSimpleStatusIndicator(resource.status);+ const name = () => storageName(resource);+ const kind = () => storageKind(resource);+ const scope = () => storageScope(resource);+ const policy = () => policyLabel(resource);+ const target = () => bindingTarget(resource);+ const detailRowId = () => drawer.detailRowId(resource);+ const isExpanded = () => drawer.isExpanded(resource);++ return (+ <>+ <TableRow+ class={`${getPlatformResourceDetailRowClass(isExpanded())} text-[11px] sm:text-xs`}+ aria-controls={isExpanded() ? detailRowId() : undefined}+ aria-expanded={isExpanded() ? 'true' : 'false'}+ data-kubernetes-storage-row={resource.id}+ onClick={() => drawer.toggle(resource)}+ onKeyDown={drawer.handleActivationKey(resource)}+ tabIndex={0}+ >+ <TableCell class={getPlatformTableCellClassForKind('name')}>+ <div class="flex min-w-0 items-center gap-2">+ <StatusDot+ size="sm"+ variant={indicator().variant}+ title={resource.status || 'unknown'}+ ariaHidden+ />+ <span class="truncate font-semibold text-base-content" title={name()}>+ {name()}+ </span>+ </div>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} text-base-content`}+ >+ {kind()}+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}+ >+ <span class="inline-block max-w-[12rem] truncate" title={scope()}>+ {scope()}+ </span>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} text-base-content`}+ >+ {bindingOrPhase(resource)}+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}+ >+ {storageClass(resource)}+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content tabular-nums`}+ >+ {capacityLabel(resource)}+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}+ >+ <span+ class="inline-block max-w-[12rem] truncate"+ title={policy().title}+ >+ {policy().label}+ </span>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}+ >+ <span+ class="inline-block max-w-[18rem] truncate"+ title={target().title}+ >+ {target().label}+ </span>+ </TableCell>+ </TableRow>+ <PlatformResourceDetailTableRow+ resource={resource}+ open={isExpanded()}+ detailRowId={detailRowId()}+ colSpan={8}+ resolveResourceLabel={resolveResourceLabel}+ onClose={() => drawer.close(resource)}+ />+ </>+ );+ }}+ </For>+ </TableBody>+ </Table>+ </TableCard>+ </Show>+ </div>+ </Show>+ );+};++export default KubernetesStorageTable;diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurface.contract.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurface.contract.test.tsxindex 4c947334e8..71d7902e0f 100644--- a/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurface.contract.test.tsx+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesPageSurface.contract.test.tsx@@ -58,6 +58,10 @@ vi.mock('../KubernetesDeploymentsTable', () => ({KubernetesDeploymentsTable: () => <div data-testid="deployments-table" />,}));+vi.mock('../KubernetesStorageTable', () => ({+ KubernetesStorageTable: () => <div data-testid="storage-table" />,+}));+describe('KubernetesPageSurface contract', () => {beforeEach(() => {mockPathname.mockReturnValue('/');@@ -203,4 +207,61 @@ describe('KubernetesPageSurface contract', () => {expect(screen.getByTestId('nodes-table')).toBeInTheDocument();expect(screen.queryByTestId('kubernetes-workloads-surface')).not.toBeInTheDocument();});++ it('renders Kubernetes storage inventory through the storage-native table', () => {+ mockPathname.mockReturnValue('/kubernetes/storage');+ mockUseUnifiedResources.mockReturnValue({+ resources: () => [+ {+ id: 'fast-csi',+ type: 'k8s-storage-class',+ name: 'fast-csi',+ displayName: 'fast-csi',+ platformId: 'cluster-1',+ platformType: 'kubernetes',+ sourceType: 'agent',+ sources: ['kubernetes'],+ status: 'online',+ lastSeen: 1_700_000_000_000,+ },+ ],+ loading: () => false,+ error: () => null,+ refetch: vi.fn(),+ });+ mockUseWorkloadsState.mockReturnValue({+ allGuests: () => [],+ clearPinnedSummaryScope: vi.fn(),+ containerRuntimeFilterConfig: () => undefined,+ focusedSummaryWorkloadGroupId: () => null,+ groupingMode: () => 'grouped',+ handleBeforeAutoFocus: vi.fn(),+ search: () => '',+ selectedGuestId: () => null,+ setGroupingMode: vi.fn(),+ setMetricDisplayMode: vi.fn(),+ setSearch: vi.fn(),+ setSortDirection: vi.fn(),+ setSortKey: vi.fn(),+ setStatusMode: vi.fn(),+ setViewMode: vi.fn(),+ setWorkloadMetricHistoryRange: vi.fn(),+ statusMode: () => 'all',+ surfaceConnected: () => false,+ surfaceInitialDataReceived: () => false,+ viewMode: () => 'pod',+ workloadMetricDisplayMode: () => 'bars',+ workloadMetricHistoryRange: () => '1h',+ workloadsFilterColumnVisibility: () => undefined,+ });++ render(() => (+ <Router>+ <Route path="/" component={KubernetesPageSurface} />+ </Router>+ ));++ expect(screen.getByTestId('storage-table')).toBeInTheDocument();+ expect(screen.queryByTestId('kubernetes-workloads-surface')).not.toBeInTheDocument();+ });});diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesStorageTable.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesStorageTable.test.tsxnew file mode 100644index 0000000000..4558c9b90a--- /dev/null+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesStorageTable.test.tsx@@ -0,0 +1,95 @@+import { cleanup, render, screen } from '@solidjs/testing-library';+import { afterEach, describe, expect, it } from 'vitest';++import type { Resource } from '@/types/resource';+import { KubernetesStorageTable } from '../KubernetesStorageTable';++const gib = (value: number): number => value * 1024 * 1024 * 1024;++const makeResource = ({+ id,+ type,+ ...overrides+}: Partial<Resource> & Pick<Resource, 'id' | 'type'>): Resource => ({+ id,+ name: id,+ displayName: id,+ platformId: 'cluster-1',+ platformType: 'kubernetes',+ sourceType: 'agent',+ sources: ['kubernetes'],+ status: 'online',+ type,+ lastSeen: 1_700_000_000_000,+ ...overrides,+});++afterEach(() => {+ cleanup();+});++describe('KubernetesStorageTable', () => {+ it('renders StorageClass, PersistentVolume, and PersistentVolumeClaim fields from the Kubernetes storage APIs', () => {+ render(() => (+ <KubernetesStorageTable+ resources={[+ makeResource({+ id: 'fast-csi',+ type: 'k8s-storage-class',+ kubernetes: {+ resourceKind: 'StorageClass',+ provisioner: 'csi.truenas.example',+ reclaimPolicy: 'Delete',+ volumeBindingMode: 'WaitForFirstConsumer',+ allowVolumeExpansion: true,+ parameterKeys: ['fstype'],+ },+ }),+ makeResource({+ id: 'pv-postgres',+ type: 'k8s-persistent-volume',+ kubernetes: {+ resourceKind: 'PersistentVolume',+ phase: 'Bound',+ storageClass: 'fast-csi',+ capacityBytes: gib(100),+ accessModes: ['ReadWriteOnce'],+ reclaimPolicy: 'Retain',+ claimNamespace: 'services',+ claimName: 'postgres-data',+ },+ }),+ makeResource({+ id: 'postgres-data',+ type: 'k8s-persistent-volume-claim',+ kubernetes: {+ namespace: 'services',+ resourceKind: 'PersistentVolumeClaim',+ phase: 'Bound',+ storageClass: 'fast-csi',+ requestedBytes: gib(100),+ capacityBytes: gib(100),+ accessModes: ['ReadWriteOnce'],+ volumeName: 'pv-postgres',+ },+ }),+ ]}+ emptyIcon={<span />}+ emptyTitle="No storage"+ emptyDescription="No storage"+ showToolbar={false}+ />+ ));++ expect(screen.getByText('Binding / phase')).toBeInTheDocument();+ expect(screen.getByText('Access / policy')).toBeInTheDocument();+ expect(screen.getByText('Provider / binding')).toBeInTheDocument();+ expect(screen.getByText('WaitForFirstConsumer')).toBeInTheDocument();+ expect(screen.getByText('csi.truenas.example')).toBeInTheDocument();+ expect(screen.getAllByText('Bound')).toHaveLength(2);+ expect(screen.getAllByText('100 GB')).toHaveLength(2);+ expect(screen.getByText('RWO · Retain')).toBeInTheDocument();+ expect(screen.getByText('services/postgres-data')).toBeInTheDocument();+ expect(screen.getAllByText('pv-postgres').length).toBeGreaterThanOrEqual(1);+ });+});