GRI-1764: panel first-user setup and login screens #85

Merged
vivy merged 1 commit from feature/GRI-1764-panel-login into dev 2026-11-09 20:12:30 +00:00
Member

What

First-user setup and login screens in frontend-web/, closes #22.

  • GET /setup/status → setup screen when no admin exists yet, else login.
  • Setup screen: username/password/confirm, client-side mismatch check, server-side validation errors surfaced inline.
  • Login screen: username/password, wrong-credentials error surfaced inline.
  • Minimal dashboard placeholder with logout, as the landing point once GRI-1764's other screens (devices, IP rules, media, playlists) exist.
  • All four async states covered: loading, error (with retry), and the two success paths (setup/login forms, dashboard).

Why mocked

grimoire-of-digital-signage's server does not have the setup/session routes yet (GRI-1838, GRI-1853 are in flight). Per GRI-1764, the API is mocked behind one switch — src/api/sessionApi.ts's USE_MOCK — so the real httpSessionApi.ts implementation (already written against plan/server/rest-api.md) can be turned on with a one-line change once those land, and tsc will catch any shape drift.

Verification

cd frontend-web && npm run check   # prettier, oxlint --deny-warnings, tsc -b --noEmit, vitest run
cd frontend-web && npm run build   # tsc -b && vite build
./scripts/local-gates.sh --frontend-only   # same, plus the pre-push hook self-test

All green. npm run dev confirmed the shell serves and mounts correctly.

Test plan

  • Fresh install → setup screen → create account → dashboard
  • Mismatched passwords rejected client-side, no server call
  • Existing admin → login screen → wrong password shows inline error → correct password → dashboard
  • Logout returns to login screen
## What First-user setup and login screens in `frontend-web/`, closes #22. - `GET /setup/status` → setup screen when no admin exists yet, else login. - Setup screen: username/password/confirm, client-side mismatch check, server-side validation errors surfaced inline. - Login screen: username/password, wrong-credentials error surfaced inline. - Minimal dashboard placeholder with logout, as the landing point once `GRI-1764`'s other screens (devices, IP rules, media, playlists) exist. - All four async states covered: loading, error (with retry), and the two success paths (setup/login forms, dashboard). ## Why mocked `grimoire-of-digital-signage`'s server does not have the setup/session routes yet (GRI-1838, GRI-1853 are in flight). Per GRI-1764, the API is mocked behind one switch — `src/api/sessionApi.ts`'s `USE_MOCK` — so the real `httpSessionApi.ts` implementation (already written against `plan/server/rest-api.md`) can be turned on with a one-line change once those land, and `tsc` will catch any shape drift. ## Verification ``` cd frontend-web && npm run check # prettier, oxlint --deny-warnings, tsc -b --noEmit, vitest run cd frontend-web && npm run build # tsc -b && vite build ./scripts/local-gates.sh --frontend-only # same, plus the pre-push hook self-test ``` All green. `npm run dev` confirmed the shell serves and mounts correctly. ## Test plan - [x] Fresh install → setup screen → create account → dashboard - [x] Mismatched passwords rejected client-side, no server call - [x] Existing admin → login screen → wrong password shows inline error → correct password → dashboard - [x] Logout returns to login screen
GRI-1764: panel first-user setup and login screens
Some checks failed
CI / the pre-push hook (pull_request) Successful in 11s
CI / cargo fmt (pull_request) Successful in 4s
CI / cargo deny (pull_request) Successful in 52s
CI / cargo deny advisories (pull_request) Failing after 53s
CI / cargo clippy (pull_request) Successful in 9m45s
CI / repository boundary (pull_request) Successful in 15s
CI / cargo test (pull_request) Successful in 9m36s
CI / frontend-web (pull_request) Successful in 9m47s
CI / CI (pull_request) Successful in 3s
CI / Notify gate failed (pull_request) Has been skipped
16a6093b15
Mocks the setup/session API behind one switch (src/api/sessionApi.ts)
until the server routes land (GRI-1838, GRI-1853); swap USE_MOCK to
false once they're exercised against the real server.
vivy merged commit e000a0527b into dev 2026-11-09 20:12:30 +00:00
vivy deleted branch feature/GRI-1764-panel-login 2026-11-09 20:12:30 +00:00
nexus-warden left a comment

Review after the merge: this PR was merged into dev on 2026-11-09 at 20:12Z before any review existed. I reviewed it on the merged head.

Approved. The setup, login and session flow is sound. Every screen has its loading, error and retry states. Errors come from {code, message}, and the HTTP client is same-origin with cookie credentials.

The one thing that would have blocked this merge is const USE_MOCK = true in sessionApi.ts and the four other API modules. That is a constant in source that decides whether the panel talks to a server at all, which is the shape GRI-1884 forbids. A production build would have shipped a client-only login that keeps the password in plain text in sessionStorage. It has since been fixed on dev: api/mode.ts chooses the mock only under vitest or with VITE_API_MODE=mock, and http is the default. Nothing is owed here.

Review after the merge: this PR was merged into `dev` on 2026-11-09 at 20:12Z before any review existed. I reviewed it on the merged head. **Approved.** The setup, login and session flow is sound. Every screen has its loading, error and retry states. Errors come from `{code, message}`, and the HTTP client is same-origin with cookie credentials. The one thing that would have blocked this merge is `const USE_MOCK = true` in `sessionApi.ts` and the four other API modules. That is a constant in source that decides whether the panel talks to a server at all, which is the shape GRI-1884 forbids. A production build would have shipped a client-only login that keeps the password in plain text in `sessionStorage`. It has since been fixed on `dev`: `api/mode.ts` chooses the mock only under vitest or with `VITE_API_MODE=mock`, and `http` is the default. Nothing is owed here.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!85
No description provided.