mirror of
https://github.com/hanzoai/ui.git
synced 2026-11-21 00:18:41 +00:00
Replace the ArgoCD React fork (deploy/ui, webpack argo-cd-ui) with a focused, mobile-first CD dashboard built on the shared Hanzo component packages over the native cloud CD plane (/v1/deploy). Its job stays: see every operator App CR with stats · sync · health · resource tree · logs · sync/rollback. - Vite + React 19 STATIC SPA → dist/ (index.html + login.html + CNAME + assets), published to the existing s3://cdn/cd static plane cd.hanzo.ai already serves (ingress staticFiles/spaMode; /v1/deploy peeled to cloud). No ingress/backend change. - @hanzo/gitops (framework-free ArgoCD-replacement views): GitopsAppList for the fleet; GitopsSyncPanel + GitopsAppTree + GitopsNodeInfo + GitopsRollbackDialog composed for the app detail (lazy per-node /resource + /logs). Resolved via Vite path alias off the built dist so it builds without a full monorepo install. - src/lib/adapt.ts maps the real /v1/deploy DTOs into the @hanzo/gitops view-models, reusing the package's foldHealth/foldSync (strips [-_] so the hyphenated 'out-of-sync' folds to OutOfSync, not Unknown). - Auth: the admin-console PKCE login.html (ported) → hanzo_iam_token cookie the cloud binary validates (SuperAdmin gate); same-origin credentialed /v1/deploy. - Lean self-contained topbar (Geist, small mark, env scope) in the interim; the @hanzo/ui-shadcn shared shell + @hanzo/canvas map are registry-install-gated follow-ons (the map already ships green in hanzoai/console). - Verify: tsc 0; vitest 8/8 (adapter + the sync-fold fix); playwright render + mobile (no horizontal body scroll at 390).
4.4 KiB
4.4 KiB
Hanzo CD — the dedicated deploy dashboard (cd.hanzo.ai)
A focused, mobile-first CD dashboard served at cd.hanzo.ai. It replaces the
ArgoCD React fork (~/work/hanzo/deploy/ui, webpack/argo-cd-ui) with the shared
Hanzo component packages over the native cloud CD plane. Its whole job: see every
service deployed as an operator App CR — stats · sync · health · resource tree ·
logs · sync/rollback.
Stack + why
- Vite + React 19 static SPA →
dist/(a static bundle, no runtime server). @hanzo/gitops(workspace) is the ArgoCD-replacement UI — a clean-room, framework-free port (plain React + scoped CSS, no Tamagui/Tailwind). We mountGitopsAppList(the fleet), and composeGitopsSyncPanel+GitopsAppTree+GitopsNodeInfo+GitopsRollbackDialogfor the app detail (lazy per-node/resource+/logsfetch).@hanzo/canvas/pure(workspace) for the pure helpers.- The workspace packages are resolved by Vite path alias (
vite.config.ts), so the app builds off@hanzo/gitops/dist+@hanzo/canvas/srcwithout a full monorepo install (the shared pnpm store lacks the registry deps of the heavier packages). Runpnpm --filter @hanzo/gitops buildonce if itsdistis stale.
Backend + auth (the contract this preserves)
- API = the cloud binary at
/v1/deploy(SuperAdmin-gated, clean paths —applications,:name/tree,:name/resource/:ref,:name/logs,sync,rollback). The cd.hanzo.ai ingress peels/v1/deploy/*off tocloud:8000; the SPA calls it same-origin withcredentials: 'include'. - Auth = the
admin-consolePKCE gate (public/login.html, ported verbatim from the ArgoCD fork — self-contained, proven):hanzo.id→ sets the non-httpOnlyhanzo_iam_tokencookie the cloud binary validates (SanitizeIdentity→c.IsAdmin()). The SPA reads that cookie for its gate; a missing/expired session (or an API 401/403) lands on the sign-in screen — never a fabricated row. src/lib/adapt.tsmaps the/v1/deployDTOs INTO the shared@hanzo/gitopsview-models (reusing the package's ownfoldHealth/foldSync). Note: the cloud wire uses the hyphenatedout-of-sync, whichfoldSync(whitespace-only strip) reads as Unknown — the adapter strips[-_]before folding.
Build + serve
pnpm --filter cd build # tsc -b && vite build → dist/ (index.html + login.html + CNAME + assets)
pnpm --filter cd preview # serve dist locally
pnpm --filter cd dev # vite dev (proxies /v1 → CD_API, default https://cd.hanzo.ai)
Serving: the built dist/ is a static bundle published to s3://cdn/cd — the
existing static plane cd.hanzo.ai already serves (ingress staticFiles +
spaMode, zero pods; see universe/infra/k8s/operator/crs/static-sites.yaml). No
ingress or backend change: publish the bundle, retire the old ArgoCD ui/ + the
deploy/dashboard.go embed.
Verify
tsc --noEmit -p tsconfig.app.json— clean.npx vitest run src/lib/adapt.test.ts— the/v1/deploy→@hanzo/gitopsmapping (incl. theout-of-syncfold fix,parentRefstree linking, clean-semver rollback).npx playwright test— builds + serves + proves the fleet renders, a row opens the ArgoCD-grade detail (sync panel + resource topology), and no horizontal body scroll at 390px. Screenshots ine2e-shots/.
Follow-ons (registry-install / routing gated — flagged, not fabricated)
@hanzo/canvasfleet MAP (the Railway board) needs@hanzo/gui(Tamagui), which is an external npm dep not in the offline store here — so the map is a registry-install follow-on. It already ships green in the console (hanzoai/consolefeat/cd-canvas-map); lifting it in is an import once@hanzo/guiinstalls.@hanzo/ui-shadcnshared shell (HanzoHeader+ org/project switcher + ⌘K) needs a full monorepo install (its Tailwind deps aren't in the offline store). This app ships a lean self-contained topbar (Geist, small mark, env scope) in the interim; swap to the shared shell once installed. The org/project↔IAM switcher additionally needs/v1/iamrouted on cd.hanzo.ai (today the SuperAdmin cookie sees the whole fleet; env is the scope control).- Rollback targets come from the app's
revisions(forward-compat — the plane doesn't expose prior tags yet; empty → the dialog's honest "no history"). Cloud re-validates the clean semver.