Skip to content

feat: dedicated server StatusPage for lifecycle states - #1452

Merged
harshithmohan merged 4 commits into
masterfrom
feat/server-actions
Aug 27, 2026
Merged

harshithmohan merged 4 commits into
masterfrom
feat/server-actions

Conversation

@harshithmohan

@harshithmohan harshithmohan commented Aug 27, 2026

Copy link
Copy Markdown
Member

Summary

Adds a dedicated, full-bleed StatusPage (/webui/status) that is the single canonical surface for all non-ready server states — Starting, Failed, Restarting, Shutting-down, Shutdown, and Offline — plus an automatic recovery redirect back into the app once the server is Started. This fixes the auto-login gap that occurred when the server transitioned Starting → Started while the user was on the login page.

Why

  • LoginPage lived outside AuthenticatedRoute, so the Starting state was handled ad-hoc there and the Starting → Started transition was never reliably caught (auto-login gap during the boot window).
  • A 502 during Starting produced a blank crossfade / stuck state because nothing canonical owned the "server not reachable yet" state.
  • Auto-login could fire during the boot window, racing server readiness.
  • Restart/shutdown had no canonical UX; SignalR toasts and route guards fought the in-progress action.

Changes

  • New serverLifecycle slice (src/core/slices/serverLifecycle.ts) — ephemeral UI intent (idle | restarting | shutting-down, initiatedAt). Deliberately excluded from sessionStorage persistence (both loadState and saveState in src/core/localStorage.ts) so a reload mid-restart never rehydrates a stale restarting and traps the user on a stuck StatusPage.
  • New StatusPage.tsx (src/pages/StatusPage.tsx) — 7 variants (loading, starting, failed, restarting, shutting-down, shutdown, offline). Drive text via variantDetailMap and icons via variantIconMap. Polling at 2s / retry 5s that backs off to 15s / 15s once the server is unreachable. A 3-minute restart timeout promotes restarting → offline; 2 consecutive failures promotes shutting-down → shutdown. Immediate redirect on Started is guarded by lastSeenStartedAtRef + sawDisruptionRef + STATUS_FRESH_MS so the redirect only fires after a genuine disruption. Variants failed/offline/shutdown render action buttons — "Restart Server" (gated on CanRestart), "Retry Now", and "Retry Connection" respectively — so recovery is possible directly from the page.
  • AuthenticatedRoute guard (src/core/router/AuthenticatedRoute.tsx) — isError or active lifecycle actionStatusPage; Waiting → login; Started → authenticated children / login redirected; Starting/FailedStatusPage; otherwise optimistically render when authenticated.
  • /webui/status route added in src/core/router/index.tsx.
  • SignalR suppression (src/core/signalr/signalr.ts) — onreconnecting / onreconnected / onclose and requiresRestart are gated on serverLifecycle.action === 'idle', so StatusPage is the only UX during a user-initiated restart/shutdown.
  • GeneralSettings handoff (src/pages/settings/tabs/GeneralSettings.tsx) — new Restart/Shutdown buttons (gated on CanRestart/CanShutdown) with ConfirmationPromptModal; onConfirmRestart/onConfirmShutdown dispatch setAction → mutate (Init/Restart, Init/Shutdown) → navigate('/webui/status').
  • LoginPage redirect (src/pages/login/LoginPage.tsx) — any non-Started/non-Waiting state (or isError) redirects to /webui/status; removed the bespoke Starting/Failed blocks from the login UI.
  • axios 401 fix (src/core/axios.ts) — fullPath now uses a proper /${url} slash, adds Settings exclusion (/api/v3/Settings) for the boot window so settings reads don't trigger a logout.
  • Simplifications — detail destructure, !! truthiness checks, retry-interval consolidation, icon map, etc.
  • Verifiedpnpm lint and pnpm build pass; dev override removed before commit; a11y/aria removed per codebase conventions.

Testing

  • pnpm lint and pnpm build pass.
  • Manual restart / shutdown / starting flows verified end-to-end (StatusPage surfaces, redirects recover on Started).

- Rename DatabaseBlocked.Status to Reason
- Remove non-existent Progress field
- Add optional CanShutdown, CanRestart, BootstrappedAt, StartedAt, StartupTime fields
- Make Uptime optional to match server TimeSpan?
- Add useServerRestartMutation and useServerShutdownMutation
- Add Server Status section with restart/shutdown buttons
- Buttons conditionally rendered based on CanRestart/CanShutdown
- Confirmation modals with toast notifications
- Use mutateAsync with inline error handling
Add a dedicated StatusPage covering server lifecycle states
(Starting/Failed/Restarting/Shutting-down/Shutdown/Offline) with a
serverLifecycle Redux slice that is ephemeral and excluded from
persistence. AuthenticatedRoute now guards authenticated access and a
/webui/status route is added.

- serverLifecycle Redux slice (ephemeral, excluded from persistence)
- AuthenticatedRoute guard + /webui/status route
- SignalR toast suppression and requiresRestart suppression with comment fixes
- GeneralSettings restart/shutdown handoff to StatusPage
- LoginPage redirect handling for lifecycle states
- axios 401 fix for /api/v3/Settings
- StatusPage simplifications (detail/variantIconMap, !! checks, etc.)

@revam revam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got asked to review text, so reviewed text. My human findings are below. Rest of 'em seem fine-ish.

Comment thread src/pages/StatusPage.tsx Outdated
Comment thread src/pages/StatusPage.tsx Outdated
…, abstract copy

- GeneralSettings: treat ERR_NETWORK/no-response as success navigating to /webui/status
- queries: native refetchInterval function form
- StatusPage: derive interval via query.state, remove extra render, dash→'.', starting/restarting abstracted
@harshithmohan
harshithmohan merged commit a8a13e6 into master Aug 27, 2026
3 checks passed
@harshithmohan
harshithmohan deleted the feat/server-actions branch August 27, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants