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.

Make slow app bootstrap recoverable

pulse-triage[bot]ceb0f0dc080f
diff --git a/frontend-modern/src/App.tsx b/frontend-modern/src/App.tsx
index 7ba3eff584..4378425755 100644
--- a/frontend-modern/src/App.tsx
+++ b/frontend-modern/src/App.tsx
@@ -74,6 +74,7 @@ import {
} from '@/features/platformNavigation/platformNavigationModel';
import type { Resource } from '@/types/resource';
import type { SecurityStatusSettingsCapabilities } from '@/types/config';
+import { AppBootstrapStatus } from '@/components/AppBootstrapStatus';
function isPublicRoutePath(pathname: string): boolean {
// Public routes must be viewable without authentication.
@@ -508,14 +509,7 @@ function App() {
});
return (
- <Show
- when={!runtime.isLoading()}
- fallback={
- <div class="min-h-screen flex items-center justify-center bg-base">
- <div class="text-muted">Loading...</div>
- </div>
- }
- >
+ <Show when={!runtime.isLoading()} fallback={<AppBootstrapStatus />}>
<Show
when={isPublicRoute()}
fallback={
diff --git a/frontend-modern/src/__tests__/App.architecture.test.ts b/frontend-modern/src/__tests__/App.architecture.test.ts
index 42a8d11382..75fb42a40c 100644
--- a/frontend-modern/src/__tests__/App.architecture.test.ts
+++ b/frontend-modern/src/__tests__/App.architecture.test.ts
@@ -209,6 +209,11 @@ describe('Global update progress authorization', () => {
});
describe('App architecture', () => {
+ it('keeps first-load connection progress understandable and retryable', () => {
+ expect(appSource).toContain('fallback={<AppBootstrapStatus />}');
+ expect(appSource).not.toContain('<div class="text-muted">Loading...</div>');
+ });
+
it('keeps every top-level destination on the same wide shell contract', () => {
expect(appStylesSource).toContain('--pulse-shell-max-width: min(97vw, 1920px)');
expect(appStylesSource).not.toContain('--pulse-shell-max-width: min(97vw, 1560px)');
diff --git a/frontend-modern/src/components/AppBootstrapStatus.tsx b/frontend-modern/src/components/AppBootstrapStatus.tsx
new file mode 100644
index 0000000000..8fcc556c10
--- /dev/null
+++ b/frontend-modern/src/components/AppBootstrapStatus.tsx
@@ -0,0 +1,67 @@
+import { Show, createSignal, onCleanup, onMount, type Component } from 'solid-js';
+import { Button } from '@/components/shared/Button';
+import { LoadingSpinner } from '@/components/shared/LoadingSpinner';
+
+export const APP_BOOTSTRAP_SLOW_DELAY_MS = 10_000;
+
+interface AppBootstrapStatusProps {
+ onRetry?: () => void;
+ slowDelayMs?: number;
+}
+
+export const AppBootstrapStatus: Component<AppBootstrapStatusProps> = (props) => {
+ const [isSlow, setIsSlow] = createSignal(false);
+
+ onMount(() => {
+ const timeout = window.setTimeout(
+ () => setIsSlow(true),
+ props.slowDelayMs ?? APP_BOOTSTRAP_SLOW_DELAY_MS,
+ );
+ onCleanup(() => window.clearTimeout(timeout));
+ });
+
+ const retry = () => {
+ if (props.onRetry) {
+ props.onRetry();
+ return;
+ }
+ window.location.reload();
+ };
+
+ return (
+ <main
+ class="flex min-h-screen items-center justify-center bg-base px-4 py-8 text-base-content"
+ aria-labelledby="app-bootstrap-title"
+ >
+ <div class="w-full max-w-md rounded-md border border-border bg-surface p-6 text-center shadow-sm sm:p-8">
+ <LoadingSpinner size="xl" tone="info" class="mb-4" />
+ <h1 id="app-bootstrap-title" class="text-lg font-semibold tracking-tight">
+ Connecting to Pulse
+ </h1>
+ <p
+ class="mt-2 text-sm leading-6 text-muted"
+ role="status"
+ aria-live="polite"
+ aria-atomic="true"
+ >
+ <Show when={isSlow()} fallback="Checking your session and preparing the workspace.">
+ Pulse is taking longer than expected to respond. The server may still be starting or
+ busy.
+ </Show>
+ </p>
+ <Show when={isSlow()}>
+ <div class="mt-5 border-t border-border pt-5">
+ <p class="mb-4 text-sm leading-6 text-muted">
+ You can keep waiting, or retry the connection.
+ </p>
+ <Button variant="primary" size="md" onClick={retry}>
+ Retry connection
+ </Button>
+ </div>
+ </Show>
+ </div>
+ </main>
+ );
+};
+
+export default AppBootstrapStatus;
diff --git a/frontend-modern/src/components/__tests__/AppBootstrapStatus.test.tsx b/frontend-modern/src/components/__tests__/AppBootstrapStatus.test.tsx
new file mode 100644
index 0000000000..128ad1b919
--- /dev/null
+++ b/frontend-modern/src/components/__tests__/AppBootstrapStatus.test.tsx
@@ -0,0 +1,37 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { APP_BOOTSTRAP_SLOW_DELAY_MS, AppBootstrapStatus } from '@/components/AppBootstrapStatus';
+
+describe('AppBootstrapStatus', () => {
+ afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+ });
+
+ it('names and announces the initial connection work', () => {
+ render(() => <AppBootstrapStatus />);
+
+ expect(screen.getByRole('main')).toHaveAccessibleName('Connecting to Pulse');
+ expect(screen.getByRole('status')).toHaveTextContent(
+ 'Checking your session and preparing the workspace.',
+ );
+ expect(screen.queryByRole('button', { name: 'Retry connection' })).toBeNull();
+ });
+
+ it('keeps waiting while making a slow bootstrap understandable and retryable', async () => {
+ vi.useFakeTimers();
+ const onRetry = vi.fn();
+ render(() => <AppBootstrapStatus onRetry={onRetry} />);
+
+ await vi.advanceTimersByTimeAsync(APP_BOOTSTRAP_SLOW_DELAY_MS);
+
+ expect(screen.getByRole('status')).toHaveTextContent(
+ 'Pulse is taking longer than expected to respond.',
+ );
+ expect(screen.getByText('You can keep waiting, or retry the connection.')).toBeVisible();
+
+ const retry = screen.getByRole('button', { name: 'Retry connection' });
+ fireEvent.click(retry);
+ expect(onRetry).toHaveBeenCalledOnce();
+ });
+});