mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-22 03:35:52 +00:00
cfc3fd1606
The unified resource projection returned by /api/resources leaves `platformType` empty on several canonical resource types (storage, agent, pbs, app-container, vm, k8s-deployment, pod, etc.) under the mock fixture path and parts of the live backend. Platform-first pages were filtering on `resource.platformType` directly, so Docker / Kubernetes / TrueNAS / vSphere pages rendered empty under mock mode even though the resources existed and were tagged with the right `sources` array (['docker'], ['kubernetes'], ['truenas'], ['vmware']). Introduce `resolveResourcePlatformType(resource)` in `frontend-modern/src/utils/sourcePlatforms.ts` as the canonical reader for "what platform family does this unified resource belong to". It prefers `resource.platformType` when present and falls back to the resource's `sources` array via the existing `resolvePlatformTypeFromSources` normalization, so client-side family grouping behaves identically against mock fixtures and live backends. Each platform page model now buckets resources through that helper: - dockerPageModel.ts - kubernetesPageModel.ts - truenasPageModel.ts - vmwarePageModel.ts Browser verification (Playwright, chromium, against live mock-mode Pulse dev runtime): - 4 no-data tests (stubbed empty /api/resources): all 4 pages render sub-tab chrome and surface empty state. - 4 populated tests (live mock backend): each platform asserts at least one canonical row renders on its data-bearing sub-tabs: - docker: /docker/overview (Hosts), /docker/containers - kubernetes: /kubernetes/pods, /kubernetes/deployments - truenas: /truenas/storage - vmware: /vmware/vms, /vmware/storage All 8 tests pass. Verification artifacts staged: - sourcePlatforms.test.ts extended with resolveResourcePlatformType cases (19 tests pass). - 68-platform-pages-shell.spec.ts extended with populated-state assertions per platform. Contracts updated: - unified-resources.md Shared Boundaries: resolveResourcePlatformType is the canonical reader for unified-resource platform family. - frontend-primitives.md Extension Points: same. Remaining mock fixture gaps (intentionally not asserted populated in this commit; tracked for fixture extension): - docker/services: default mock fixtures do not expose docker-service resources at the /api/resources boundary. - kubernetes/overview, kubernetes/nodes, kubernetes/services: KubernetesClusters are generated but k8s-cluster, k8s-node, and k8s-service resource projections are not surfaced. - truenas/overview, truenas/apps: no TrueNAS agent or TrueNAS-scoped app-container resources in default fixtures. - vmware/overview: no VMware ESXi-host agent resources in default fixtures.