Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Converge login spinners on LoadingSpinner

rcourtmana39e2099180a
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index fdd223b521..1c59cb89c2 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -1611,6 +1611,15 @@ not a replacement status card, CTA band, or page-local nested card.
first-time operator setup must enter through the canonical Settings →
Infrastructure workspace and its query-backed add flow, while provider
evidence still owns the operational landing surface.
+ `frontend-modern/src/components/Login.tsx` is part of that same
+ pre-authenticated and first-session shell ownership: auth-check, setup
+ fallback, and submit-pending loading indicators must compose
+ `frontend-modern/src/components/shared/LoadingSpinner.tsx` through the
+ shared-template registry instead of recreating page-local spinner shells.
+ The subsystem registry must keep `Login.tsx` covered by the
+ `first-session-runtime-and-preview` proof policy so login loading
+ affordances cannot drift from the shared Settings, Patrol, AI, and
+ primitive spinner contract.
The authenticated app shell's boot-time route preloads must be owned by
`frontend-modern/src/routing/routePreload.ts` so top-level cold-tab
readiness cannot drift from the route-module preloader. Workloads,
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index 30b5b4b05c..61647dd77d 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -3101,6 +3101,7 @@
"frontend-modern/scripts/settings-diagnostics-boundary-audit.mjs",
"frontend-modern/scripts/shared-template-audit.mjs",
"frontend-modern/scripts/shared-template-registry.json",
+ "frontend-modern/src/components/Login.tsx",
"frontend-modern/src/components/Settings/AgentIntegrationsPanel.tsx",
"frontend-modern/src/components/Settings/AIChatMaintenanceSection.tsx",
"frontend-modern/src/components/Settings/AIModelSelectionSection.tsx",
@@ -3569,6 +3570,7 @@
"label": "first-session runtime and preview proof",
"match_prefixes": [],
"match_files": [
+ "frontend-modern/src/components/Login.tsx",
"frontend-modern/src/components/SetupWizard/SetupCompletionPreview.tsx",
"frontend-modern/src/components/SetupWizard/SetupWizard.tsx",
"frontend-modern/src/components/SetupWizard/steps/WelcomeStep.tsx"
@@ -3576,6 +3578,7 @@
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
+ "frontend-modern/src/components/__tests__/Login.test.tsx",
"frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPreview.test.tsx",
"frontend-modern/src/components/SetupWizard/__tests__/SetupWizard.test.tsx",
"frontend-modern/src/components/SetupWizard/__tests__/WelcomeStep.test.tsx"
diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.json
index cca67c3b06..9c91a240ff 100644
--- a/frontend-modern/scripts/shared-template-registry.json
+++ b/frontend-modern/scripts/shared-template-registry.json
@@ -435,13 +435,14 @@
{
"id": "loading-spinner-shell",
"category": "loading-indicator",
- "summary": "Settings, Patrol, AI, and shared loading indicators must compose LoadingSpinner for shared size, tone, and accessibility behavior instead of recreating border-based animate-spin spans.",
+ "summary": "Login, Settings, Patrol, AI, and shared loading indicators must compose LoadingSpinner for shared size, tone, and accessibility behavior instead of recreating border-based animate-spin spans.",
"canonical": {
"path": "src/components/shared/LoadingSpinner.tsx",
"export": "LoadingSpinner"
},
"requiredConsumers": [
{ "path": "src/components/AI/FindingsPanel.tsx" },
+ { "path": "src/components/Login.tsx" },
{ "path": "src/components/Settings/AISettings.tsx" },
{ "path": "src/components/Settings/AISettingsDialogs.tsx" },
{ "path": "src/components/Settings/APITokenManager.tsx" },
@@ -467,6 +468,13 @@
"h-4 w-4 border-2 border-current border-t-transparent rounded-full animate-spin"
]
},
+ {
+ "path": "src/components/Login.tsx",
+ "patterns": [
+ "animate-spin h-12 w-12 border-4 border-blue-500 border-t-transparent rounded-full mx-auto mb-4",
+ "class=\"animate-spin -ml-1 mr-3 h-5 w-5 text-white\""
+ ]
+ },
{
"path": "src/components/Settings/AISettings.tsx",
"patterns": [
@@ -566,6 +574,7 @@
"src/components/shared/LoadingSpinner.test.tsx",
"src/components/shared/SharedPrimitives.guardrails.test.ts",
"src/components/AI/__tests__/FindingsPanel.test.ts",
+ "src/components/__tests__/Login.test.tsx",
"src/components/patrol/__tests__/ApprovalBanner.test.tsx",
"src/components/patrol/__tests__/ApprovalSection.test.tsx",
"src/components/patrol/__tests__/InvestigationSection.test.tsx",
@@ -2753,6 +2762,27 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "login-local-border-loading-spinner-shell",
+ "category": "loading-indicator",
+ "summary": "Login and first-session auth surfaces must not recreate border-based loading spinners locally; compose LoadingSpinner so size, tone, and accessibility behavior stay shared.",
+ "canonical": {
+ "path": "src/components/shared/LoadingSpinner.tsx",
+ "export": "LoadingSpinner"
+ },
+ "scopes": ["src/components/Login.tsx"],
+ "extensions": [".tsx"],
+ "allPatterns": ["border-t-transparent", "animate-spin"],
+ "legacyReason": "Retired migration debt. Login auth checks, setup fallback, and submit-pending states compose LoadingSpinner instead of local border or SVG spinner shells.",
+ "allowedPaths": [],
+ "ignoredPaths": ["src/components/shared/SharedPrimitives.guardrails.test.ts"],
+ "proof": [
+ "src/components/shared/LoadingSpinner.test.tsx",
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/components/__tests__/Login.test.tsx",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "platform-table-shell-local-frame",
"category": "platform-table-shell",
diff --git a/frontend-modern/src/components/Login.tsx b/frontend-modern/src/components/Login.tsx
index 7ab9f832e6..117af2707d 100644
--- a/frontend-modern/src/components/Login.tsx
+++ b/frontend-modern/src/components/Login.tsx
@@ -3,6 +3,7 @@ import { logger } from '@/utils/logger';
import { apiClient, apiFetchJSON } from '@/utils/apiClient';
import Globe from 'lucide-solid/icons/globe';
import Key from 'lucide-solid/icons/key';
+import { LoadingSpinner } from '@/components/shared/LoadingSpinner';
const SetupWizard = lazy(() => import('./SetupWizard').then((m) => ({ default: m.SetupWizard })));
@@ -248,7 +249,7 @@ export const Login: Component<LoginProps> = (props) => {
fallback={
<div class="min-h-screen flex items-center justify-center bg-base">
<div class="text-center">
- <div class="animate-spin h-12 w-12 border-4 border-blue-500 border-t-transparent rounded-full mx-auto mb-4"></div>
+ <LoadingSpinner size="lg" tone="info" label="Checking authentication" class="mb-4" />
<p class="text-muted">Checking authentication...</p>
</div>
</div>
@@ -284,7 +285,7 @@ export const Login: Component<LoginProps> = (props) => {
fallback={
<div class="min-h-screen flex items-center justify-center bg-base">
<div class="text-center">
- <div class="animate-spin h-12 w-12 border-4 border-blue-500 border-t-transparent rounded-full mx-auto mb-4"></div>
+ <LoadingSpinner size="lg" tone="info" label="Loading setup" class="mb-4" />
<p class="text-muted">Loading setup...</p>
</div>
</div>
@@ -588,25 +589,7 @@ const LoginForm: Component<{
class="group relative w-full flex justify-center py-3 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
>
<Show when={loading()}>
- <svg
- class="animate-spin -ml-1 mr-3 h-5 w-5 text-white"
- fill="none"
- viewBox="0 0 24 24"
- >
- <circle
- class="opacity-25"
- cx="12"
- cy="12"
- r="10"
- stroke="currentColor"
- stroke-width="4"
- ></circle>
- <path
- class="opacity-75"
- fill="currentColor"
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
- ></path>
- </svg>
+ <LoadingSpinner size="button" tone="inverse" class="-ml-1 mr-3" />
</Show>
<Show when={loading()} fallback="Sign in to Pulse">
Authenticating...
diff --git a/frontend-modern/src/components/__tests__/Login.test.tsx b/frontend-modern/src/components/__tests__/Login.test.tsx
index 1249346a4f..22d45dbf8b 100644
--- a/frontend-modern/src/components/__tests__/Login.test.tsx
+++ b/frontend-modern/src/components/__tests__/Login.test.tsx
@@ -1,6 +1,7 @@
import { afterEach, describe, expect, it, vi, beforeEach } from 'vitest';
import { cleanup, render, screen } from '@solidjs/testing-library';
import { Login } from '@/components/Login';
+import loginSource from '@/components/Login.tsx?raw';
// Mock fetch globally
const mockFetch = vi.fn();
@@ -171,4 +172,14 @@ describe('Login', () => {
expect(await screen.findByText('Demo Mode')).toBeInTheDocument();
expect(screen.getAllByText('demo')).toHaveLength(2);
});
+
+ it('routes login loading indicators through the shared LoadingSpinner primitive', () => {
+ expect(loginSource).toContain("from '@/components/shared/LoadingSpinner'");
+ expect(loginSource).toContain('<LoadingSpinner size="lg" tone="info"');
+ expect(loginSource).toContain('<LoadingSpinner size="button" tone="inverse"');
+ expect(loginSource).not.toContain(
+ 'animate-spin h-12 w-12 border-4 border-blue-500 border-t-transparent rounded-full mx-auto mb-4',
+ );
+ expect(loginSource).not.toContain('class="animate-spin -ml-1 mr-3 h-5 w-5 text-white"');
+ });
});
diff --git a/frontend-modern/src/components/shared/LoadingSpinner.test.tsx b/frontend-modern/src/components/shared/LoadingSpinner.test.tsx
index af1c29def9..29fa818b1f 100644
--- a/frontend-modern/src/components/shared/LoadingSpinner.test.tsx
+++ b/frontend-modern/src/components/shared/LoadingSpinner.test.tsx
@@ -59,5 +59,7 @@ describe('LoadingSpinner', () => {
);
expect(getLoadingSpinnerClass({ size: 'xl', tone: 'info' })).toContain('h-6');
expect(getLoadingSpinnerClass({ size: 'xl', tone: 'info' })).toContain('border-blue-500');
+ expect(getLoadingSpinnerClass({ size: 'button', tone: 'inverse' })).toContain('h-5');
+ expect(getLoadingSpinnerClass({ size: 'button', tone: 'inverse' })).toContain('border-white');
});
});
diff --git a/frontend-modern/src/components/shared/LoadingSpinner.tsx b/frontend-modern/src/components/shared/LoadingSpinner.tsx
index 387c5d12ca..b9dd341348 100644
--- a/frontend-modern/src/components/shared/LoadingSpinner.tsx
+++ b/frontend-modern/src/components/shared/LoadingSpinner.tsx
@@ -1,6 +1,6 @@
import { splitProps, type JSX } from 'solid-js';
-export type LoadingSpinnerSize = 'xs' | 'sm' | 'md' | 'xl' | 'lg';
+export type LoadingSpinnerSize = 'xs' | 'sm' | 'md' | 'button' | 'xl' | 'lg';
export type LoadingSpinnerTone = 'current' | 'inverse' | 'info' | 'muted';
export interface LoadingSpinnerProps extends Omit<JSX.HTMLAttributes<HTMLSpanElement>, 'class'> {
@@ -14,6 +14,7 @@ const LOADING_SPINNER_SIZE_CLASSES: Record<LoadingSpinnerSize, string> = {
xs: 'h-2 w-2 border',
sm: 'h-3 w-3 border-2',
md: 'h-4 w-4 border-2',
+ button: 'h-5 w-5 border-2',
xl: 'h-6 w-6 border-2',
lg: 'h-12 w-12 border-4',
};
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 257c540e89..7b9df0ce3d 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -254,6 +254,7 @@ import userAssignmentsPanelSource from '@/components/Settings/UserAssignmentsPan
import infrastructureSourcePickerSource from '@/components/Settings/InfrastructureSourcePicker.tsx?raw';
import resourcePickerSource from '@/components/Settings/ResourcePicker.tsx?raw';
import settingsPageShellSource from '@/components/Settings/SettingsPageShell.tsx?raw';
+import loginSource from '@/components/Login.tsx?raw';
import patrolIntelligenceHeaderSource from '@/features/patrol/PatrolIntelligenceHeader.tsx?raw';
import patrolIntelligenceSummarySource from '@/features/patrol/PatrolIntelligenceSummary.tsx?raw';
import patrolIntelligenceWorkspaceSource from '@/features/patrol/PatrolIntelligenceWorkspace.tsx?raw';
@@ -2459,7 +2460,7 @@ describe('shared primitive guardrails', () => {
}
});
- it('keeps Settings, Patrol, and AI loading spinners on the shared LoadingSpinner primitive', () => {
+ it('keeps Login, Settings, Patrol, and AI loading spinners on the shared LoadingSpinner primitive', () => {
const registry = JSON.parse(sharedTemplateRegistrySource) as {
rules?: Array<{
id: string;
@@ -2486,11 +2487,15 @@ describe('shared primitive guardrails', () => {
const settingsBorderBottomGuard = registry.patternGuards?.find(
(guard) => guard.id === 'settings-local-border-bottom-loading-spinner-shell',
);
+ const loginBorderGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'login-local-border-loading-spinner-shell',
+ );
expect(registeredRule?.canonical?.path).toBe('src/components/shared/LoadingSpinner.tsx');
expect(registeredRule?.canonical?.export).toBe('LoadingSpinner');
expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual([
'src/components/AI/FindingsPanel.tsx',
+ 'src/components/Login.tsx',
'src/components/Settings/AISettings.tsx',
'src/components/Settings/AISettingsDialogs.tsx',
'src/components/Settings/APITokenManager.tsx',
@@ -2531,9 +2536,21 @@ describe('shared primitive guardrails', () => {
expect(settingsBorderBottomGuard?.allPatterns).toEqual(['border-b-2', 'animate-spin']);
expect(settingsBorderBottomGuard?.scopes).toEqual(['src/components/Settings']);
expect(settingsBorderBottomGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(loginBorderGuard?.canonical?.path).toBe('src/components/shared/LoadingSpinner.tsx');
+ expect(loginBorderGuard?.canonical?.export).toBe('LoadingSpinner');
+ expect(loginBorderGuard?.allPatterns).toEqual(['border-t-transparent', 'animate-spin']);
+ expect(loginBorderGuard?.scopes).toEqual(['src/components/Login.tsx']);
+ expect(loginBorderGuard?.allowedPaths ?? []).toHaveLength(0);
expect(loadingSpinnerSource).toContain('getLoadingSpinnerClass');
expect(loadingSpinnerSource).toContain('aria-hidden={ariaHidden()}');
+ expect(loadingSpinnerSource).toContain("button: 'h-5 w-5 border-2'");
+ expect(loginSource).toContain('LoadingSpinner');
+ expect(loginSource).toContain('size="button"');
+ expect(loginSource).not.toContain(
+ 'animate-spin h-12 w-12 border-4 border-blue-500 border-t-transparent rounded-full mx-auto mb-4',
+ );
+ expect(loginSource).not.toContain('class="animate-spin -ml-1 mr-3 h-5 w-5 text-white"');
for (const source of [
findingsPanelSource,