Frontend (Unit 2 completion): dual dev-server tooling (pnpm dev:slave, pnpm dev:all), per-instance browser tab titles, and a backend capability check (SystemController + useSystemCapabilities + ModuleGuard) so a Master-only page is hidden on a slave instance instead of assuming every backend has every module. Master/slave protocol fixes surfaced by actually running master and slave side by side locally: - Deactivating a CMS instance (Inactive) now releases the slave's master gate instead of leaving it stuck on its last pushed status. - The periodic integrity check now also re-pushes status to every reachable slave (previously URL-verification only) and runs once immediately on startup. - Added the originally-specified (but never implemented) slave-pull path: a slave now periodically polls its own status from the master (GET /api/v1/SlaveStatus) and fails open to Available if the master is unreachable for too long, complementing the existing push. - The slave's own Settings page can no longer "successfully" change local availability while the master controls it; it's now locked with an explanatory banner and the backend rejects the write with 409 instead of silently no-op'ing it. - CMS instance status badges now match the dashboard's color/icon styling instead of a plain grey badge. Also corrected the master-cms-module design docs to match this as-built behavior, and flagged (without a full rewrite) a larger, pre-existing divergence between its inception-stage application design and what construction actually built. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2.7 KiB
2.7 KiB
Code Generation Summary — Unit 2: Frontend Dual-Instance Tooling & Runbook
Created
frontend/.env.slave.local—VITE_API_BASE_URL=https://localhost:7222,VITE_APP_TITLE=SlpModularCms (Slave)(gitignored via existingfrontend/.gitignore*.localpattern, verified viagit check-ignore)aidlc-docs/features/local-dev-master-slave-setup/construction/unit-2-frontend-dual-instance-tooling/code/summary.md(this file)
Modified
frontend/.env.example— added a documented block explaining how to create.env.slave.localand usepnpm dev:slave, and howVITE_APP_TITLEdistinguishes tabsfrontend/.env.local(developer's existing local file, gitignored) — addedVITE_APP_TITLE=SlpModularCms (Master)for symmetry with the slavefrontend/package.json— added"dev:slave": "vite --mode slave --port 5174"scriptfrontend/src/vite-env.d.ts— added optionalVITE_APP_TITLEto the typed env interfacefrontend/src/lib/config.ts— addedappTitletoAppConfig, sourced fromVITE_APP_TITLEwith a'SlpModularCms'fallback when unsetfrontend/src/main.tsx— setsdocument.titlefromgetAppConfig().appTitleat startup, so each instance's browser tab is recognizableREADME.md(root) — added new section "Lokaal Master + Slave Draaien (Dev)" after "Master CMS Module", covering: starting both backends, starting the frontend against either instance, and using the existing "Add CMS Instance" dialog to connect them
Notes
- No new tests — this unit is env/config/documentation only, no testable logic.
pnpm dev:slaveuses Vite's--mode slaveflag, which loads.env.slave.localin addition to the default.env/.env.localfiles;--port 5174overridesvite.config.ts's default port (5173) for this invocation only.- Added after initial Build and Test review (user request): distinguishable browser tab titles per instance via
VITE_APP_TITLE, defaulting to"SlpModularCms"so existing setups without the var keep today's title unchanged. - Full end-to-end verification (starting both backends with real local databases, running both frontends, and confirming the "Add CMS Instance" flow actually connects them) is performed in Build and Test, since it requires a running local SQL Server instance that isn't available in this automated environment.
Verification Performed (Tab Title Change)
pnpm build(tsc -b + vite build) — succeeds, no type errors.pnpm test— 208/209 pass; the 1 failure (AddCmsInstanceDialog.test.tsx, a findByTestId timeout) reproduced as flaky under this session's load and passed 5/5 when re-run in isolation — unrelated to the title change (no title-related assertions, andmain.tsxis not exercised by component tests).