From 69f70a3fcdc77eba3b0779274cca23bd4c498c82 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sat, 16 May 2026 12:23:57 +0100 Subject: [PATCH] k8s(deployments): replace generic infra table with a deployment-native table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Kubernetes Deployments tab was mounting the canonical UnifiedResourceTable, which renders CPU / Memory / Disk / Disk I/O / Uptime / Temperature columns. For Kubernetes Deployments those columns are conceptually N/A: Deployments are scheduling abstractions over their controlled pods and do not have temperature sensors, process uptime, or per-disk I/O of their own. The user's complaint ("uptime/temp/disk-io still dashes — why show columns the data can't back?") is right: the generic infrastructure table is the wrong UI for deployments. Add `KubernetesDeploymentsTable` under `features/kubernetes/KubernetesDeploymentsTable.tsx` and mount it on `/kubernetes/deployments` instead of the shared `PlatformResourceTable`. The new table reuses the canonical shared primitives (Card, Table, SearchInput, FilterButtonGroup, StatusDot) plus the shared `filterPlatformResources` helper for search + status, but surfaces deployment-meaningful columns only: - Deployment (status dot + name) - Namespace - Cluster - Desired / Updated / Ready / Available replicas (right-aligned, tabular-nums) The operator toolbar (search + status chip strip + counter) and the empty-state path follow the same shape as `PlatformResourceTable` so the page still feels native to the platform-page family. `ResourceKubernetesMeta` extended with `deploymentUid`, `desiredReplicas`, `updatedReplicas`, `readyReplicas`, `availableReplicas`. The backend `K8sData` already emits these fields on `k8s-deployment` rows; the frontend type just hadn't surfaced them yet (the existing K8sDeploymentsDrawer worked around it with a local shape). The synthetic CPU/memory/disk metrics added in 8fb141c0a / 60e649a45 stay on the canonical adapter (other K8s surfaces or future infrastructure-table uses will benefit) but are no longer the source of column truth for the platform-page Deployments tab — the table just doesn't render those columns. Browser verification (Playwright, chromium, live mock-mode): - 9 tests pass; the every-sub-tab operator-controls audit still finds the search input on `/kubernetes/deployments` (now provided by the bespoke deployments table's toolbar). Tests: - `tsc --noEmit` clean. - Existing vitest suites continue to pass. Contract-neutral bypass: PULSE_ALLOW_CONTRACT_NEUTRAL_COMMIT set because this is a presentation refactor inside the Kubernetes feature directory. No public API shape changes (the backend already emitted replica fields on `k8s-deployment` resources), no canonical subsystem boundary changes, no platform-page composition contract changes; the new bespoke table reuses canonical shared primitives. --- .../kubernetes/KubernetesDeploymentsTable.tsx | 169 ++++++++++++++++++ .../kubernetes/KubernetesPageSurface.tsx | 3 +- frontend-modern/src/types/resource.ts | 10 ++ 3 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx diff --git a/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx new file mode 100644 index 0000000000..aa83866faa --- /dev/null +++ b/frontend-modern/src/features/kubernetes/KubernetesDeploymentsTable.tsx @@ -0,0 +1,169 @@ +import { For, Show, createMemo, createSignal, type Component, type JSX } from 'solid-js'; +import { Card } from '@/components/shared/Card'; +import { EmptyState } from '@/components/shared/EmptyState'; +import { FilterButtonGroup, type FilterOption } from '@/components/shared/FilterButtonGroup'; +import { SearchInput } from '@/components/shared/SearchInput'; +import { StatusDot } from '@/components/shared/StatusDot'; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from '@/components/shared/Table'; +import { getSimpleStatusIndicator } from '@/utils/status'; +import { asTrimmedString } from '@/utils/stringUtils'; +import { + filterPlatformResources, + type PlatformResourceStatusFilter, +} from '@/features/platformPage/sharedPlatformPage'; +import type { Resource } from '@/types/resource'; + +// Kubernetes Deployments are scheduling abstractions over their controlled +// pods, so the generic infrastructure table's CPU / Memory / Disk I/O / +// Uptime / Temperature columns are conceptually N/A on these rows and +// render as dashes. This deployment-native table reuses canonical shared +// primitives (Card, Table, SearchInput, FilterButtonGroup, StatusDot) but +// surfaces deployment-meaningful columns only: namespace, cluster, +// desired / updated / ready / available replicas. + +const STATUS_FILTER_OPTIONS: FilterOption[] = [ + { value: 'all', label: 'All' }, + { value: 'online', label: 'Healthy' }, + { value: 'degraded', label: 'Degraded' }, + { value: 'offline', label: 'Offline' }, +]; + +const replicaCount = (value: number | undefined): JSX.Element => ( + {value ?? 0} +); + +export const KubernetesDeploymentsTable: Component<{ + resources: Resource[]; + emptyIcon: JSX.Element; + emptyTitle: string; + emptyDescription: string; +}> = (props) => { + const [search, setSearch] = createSignal(''); + const [status, setStatus] = createSignal('all'); + + const filtered = createMemo(() => filterPlatformResources(props.resources, search(), status())); + const visible = createMemo(() => filtered().length); + const total = createMemo(() => props.resources.length); + + return ( + 0} + fallback={ + + + + } + > +
+
+
+ +
+ + + {total()} deployments}> + {visible()} of {total()} deployments + + +
+ + 0} + fallback={ + + + + } + > + + + + + Deployment + Namespace + Cluster + Desired + Updated + Ready + Available + + + + + {(deployment) => { + const name = () => asTrimmedString(deployment.name) || deployment.id; + const ns = () => asTrimmedString(deployment.kubernetes?.namespace) || '—'; + const cluster = () => + asTrimmedString(deployment.kubernetes?.clusterName) || + asTrimmedString(deployment.kubernetes?.clusterId) || + '—'; + const indicator = () => getSimpleStatusIndicator(deployment.status); + return ( + + +
+ + + {name()} + +
+
+ {ns()} + {cluster()} + + {replicaCount(deployment.kubernetes?.desiredReplicas)} + + + {replicaCount(deployment.kubernetes?.updatedReplicas)} + + + {replicaCount(deployment.kubernetes?.readyReplicas)} + + + {replicaCount(deployment.kubernetes?.availableReplicas)} + +
+ ); + }} +
+
+
+
+
+
+
+ ); +}; + +export default KubernetesDeploymentsTable; diff --git a/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx b/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx index 089a5d0655..42b6355b5e 100644 --- a/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx +++ b/frontend-modern/src/features/kubernetes/KubernetesPageSurface.tsx @@ -9,6 +9,7 @@ import { PlatformSectionTabs, PlatformTableEmptyState, } from '@/features/platformPage/sharedPlatformPage'; +import { KubernetesDeploymentsTable } from './KubernetesDeploymentsTable'; import { KUBERNETES_TAB_SPECS, buildKubernetesPageModel, @@ -108,7 +109,7 @@ export function KubernetesPageSurface() { /> -