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.

Add shared discovery loading fallback

rcourtman9802cf9dbc8a
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 3e4c8a1869..9cab27675b 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -1783,6 +1783,10 @@ primitive internals such as `Button`, `PulseDataGrid`, and
`HistoryChartOverlay`, as well as Login, Settings, Patrol, and AI finding
surfaces; local `animate-spin` spinner shells in those consumers are governed
by the shared-template registry rather than page-local discretion.
+`DiscoveryLoadingFallback` owns the discovery-tab Suspense fallback row for
+resource, workload, and Docker host drawers: centered row layout, status
+semantics, discovery loading copy, and canonical `LoadingSpinner` composition
+live there rather than in drawer-local fallback markup.
AI settings provider fields are a governed frontend primitive, not a
provider-local form fork. The shared provider configuration section must render
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index f98486667f..2694cb63a2 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -672,6 +672,12 @@ shell clickable behind another overlay.
## Current State
+Workload and host drawer discovery-tab Suspense fallbacks now compose the
+frontend-primitives `DiscoveryLoadingFallback` template. `GuestDrawer`,
+`NodeDrawer`, and Docker host drawer consumers own tab availability and target
+identity, but they must not recreate the centered loading row, local border
+spinner, or discovery loading copy inside hot-path drawer render code.
+
Default-org token scoping and notification-settings fan-out on shared
`internal/api/router.go` are likewise adjacent only: the tenant-monitor
settings inheritance hook runs once per tenant-monitor creation and changes
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 90ce00367d..bbcfbe8186 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -1226,6 +1226,12 @@ AI-only summary payloads, or page-local heuristics.
## Current State
+Resource detail drawer discovery-tab Suspense fallbacks now compose the
+frontend-primitives `DiscoveryLoadingFallback` template. `ResourceDetailDrawer`
+and `ResourceDetailDrawerOverviewTab` own when the Discovery tab is available,
+but they must not recreate the centered loading row, local border spinner, or
+discovery loading copy outside that shared primitive.
+
The resource detail drawer's "Open in Workloads / Storage / Recovery"
related-links injection
(`frontend-modern/src/components/Infrastructure/resourceDetailDrawerOperationalModel.ts`'s
diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.json
index e355259204..d56657a324 100644
--- a/frontend-modern/scripts/shared-template-registry.json
+++ b/frontend-modern/scripts/shared-template-registry.json
@@ -454,6 +454,7 @@
{ "path": "src/components/Settings/UserAssignmentsDialog.tsx" },
{ "path": "src/components/Settings/UserAssignmentsPanel.tsx" },
{ "path": "src/components/shared/Button.tsx" },
+ { "path": "src/components/shared/DiscoveryLoadingFallback.tsx" },
{ "path": "src/components/shared/HistoryChartOverlay.tsx" },
{ "path": "src/components/shared/PulseDataGrid.tsx" },
{ "path": "src/components/patrol/ApprovalBanner.tsx" },
@@ -595,6 +596,7 @@
"src/components/shared/LoadingSpinner.test.tsx",
"src/components/shared/SharedPrimitives.guardrails.test.ts",
"src/components/shared/Button.test.tsx",
+ "src/components/shared/DiscoveryLoadingFallback.test.tsx",
"src/components/shared/__tests__/HistoryChart.test.tsx",
"src/components/shared/__tests__/PulseDataGrid.test.tsx",
"src/components/AI/__tests__/FindingsPanel.test.ts",
@@ -606,6 +608,59 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "discovery-loading-fallback",
+ "category": "loading-indicator",
+ "summary": "Discovery tab Suspense fallbacks in resource and workload drawers must compose DiscoveryLoadingFallback for the centered loading row, canonical spinner, status semantics, and discovery loading copy instead of recreating local spinner/text markup.",
+ "canonical": {
+ "path": "src/components/shared/DiscoveryLoadingFallback.tsx",
+ "export": "DiscoveryLoadingFallback"
+ },
+ "requiredConsumers": [
+ { "path": "src/components/Infrastructure/ResourceDetailDrawer.tsx" },
+ { "path": "src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx" },
+ { "path": "src/components/Workloads/GuestDrawer.tsx" },
+ { "path": "src/components/Workloads/NodeDrawer.tsx" },
+ { "path": "src/features/docker/DockerHostDrawer.tsx" }
+ ],
+ "forbiddenPatterns": [
+ {
+ "path": "src/components/Infrastructure/ResourceDetailDrawer.tsx",
+ "patterns": [
+ "h-6 w-6 animate-spin rounded-full border-2 border-blue-500 border-t-transparent"
+ ]
+ },
+ {
+ "path": "src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx",
+ "patterns": [
+ "animate-spin h-6 w-6 border-2 border-blue-500 border-t-transparent rounded-full"
+ ]
+ },
+ {
+ "path": "src/components/Workloads/GuestDrawer.tsx",
+ "patterns": [
+ "animate-spin h-6 w-6 border-2 border-blue-500 border-t-transparent rounded-full"
+ ]
+ },
+ {
+ "path": "src/components/Workloads/NodeDrawer.tsx",
+ "patterns": [
+ "animate-spin h-6 w-6 border-2 border-blue-500 border-t-transparent rounded-full"
+ ]
+ },
+ {
+ "path": "src/features/docker/DockerHostDrawer.tsx",
+ "patterns": [
+ "animate-spin h-6 w-6 border-2 border-blue-500 border-t-transparent rounded-full"
+ ]
+ }
+ ],
+ "proof": [
+ "src/components/shared/DiscoveryLoadingFallback.test.tsx",
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "settings-loading-skeleton-shell",
"category": "loading-skeleton",
@@ -2813,6 +2868,32 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "drawer-discovery-local-loading-fallback",
+ "category": "loading-indicator",
+ "summary": "Resource and workload drawer discovery Suspense fallbacks must not recreate local border spinner rows; compose DiscoveryLoadingFallback so all drawer loading rows inherit the same spinner, spacing, copy, and status semantics.",
+ "canonical": {
+ "path": "src/components/shared/DiscoveryLoadingFallback.tsx",
+ "export": "DiscoveryLoadingFallback"
+ },
+ "scopes": [
+ "src/components/Infrastructure/ResourceDetailDrawer.tsx",
+ "src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx",
+ "src/components/Workloads/GuestDrawer.tsx",
+ "src/components/Workloads/NodeDrawer.tsx",
+ "src/features/docker/DockerHostDrawer.tsx"
+ ],
+ "extensions": [".tsx"],
+ "allPatterns": ["border-t-transparent", "animate-spin"],
+ "legacyReason": "Retired migration debt. Discovery tab fallbacks in drawers compose DiscoveryLoadingFallback instead of local centered border-spinner rows.",
+ "allowedPaths": [],
+ "ignoredPaths": ["src/components/shared/SharedPrimitives.guardrails.test.ts"],
+ "proof": [
+ "src/components/shared/DiscoveryLoadingFallback.test.tsx",
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "login-local-border-loading-spinner-shell",
"category": "loading-indicator",
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
index ca2bc1e72d..a1a3697167 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
@@ -9,6 +9,7 @@ import {
DrawerHeaderActionGroup,
DrawerHeaderIconButton,
} from '@/components/shared/Button';
+import { DiscoveryLoadingFallback } from '@/components/shared/DiscoveryLoadingFallback';
import { StatusDot } from '@/components/shared/StatusDot';
import { Subtabs } from '@/components/shared/Subtabs';
import { ReportMergeModal } from './ReportMergeModal';
@@ -24,7 +25,6 @@ import { ResourceDetailDrawerDebugTab } from './ResourceDetailDrawerDebugTab';
import { ResourceDetailDrawerOverviewTab } from './ResourceDetailDrawerOverviewTab';
import { useResourceDetailDrawerState } from './useResourceDetailDrawerState';
import { DiscoveryTab } from '@/components/Discovery/DiscoveryTab';
-import { getDiscoveryLoadingState } from '@/utils/discoveryPresentation';
import {
DEFAULT_RESOURCE_DETAIL_DRAWER_PRESENTATION,
type ResourceDetailDrawerPresentation,
@@ -212,14 +212,7 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
fallback={<TabAvailabilityNotice message="Discovery is unavailable." />}
>
{(config) => (
- <Suspense
- fallback={
- <div class="flex items-center justify-center py-8">
- <div class="h-6 w-6 animate-spin rounded-full border-2 border-blue-500 border-t-transparent" />
- <span class="ml-2 text-sm text-muted">{getDiscoveryLoadingState().text}</span>
- </div>
- }
- >
+ <Suspense fallback={<DiscoveryLoadingFallback />}>
<DiscoveryTab
resourceType={config().resourceType}
agentId={config().agentId}
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx
index dab8948a39..3049f6bcfd 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx
@@ -15,6 +15,7 @@ import { DisksCard } from '@/components/shared/cards/DisksCard';
import { TemperaturesCard } from '@/components/shared/cards/TemperaturesCard';
import { RaidCard } from '@/components/shared/cards/RaidCard';
import { DiscoveryTab } from '@/components/Discovery/DiscoveryTab';
+import { DiscoveryLoadingFallback } from '@/components/shared/DiscoveryLoadingFallback';
import { FormSelect } from '@/components/shared/FormSelect';
import { InfoCardFrame } from '@/components/shared/InfoCardFrame';
import { WebInterfaceUrlField } from '@/components/shared/WebInterfaceUrlField';
@@ -40,7 +41,6 @@ import { formatConfidenceLabel } from '@/utils/confidencePresentation';
import { formatIdentifierLabel } from '@/utils/textPresentation';
import { shouldShowResourcePlatformId } from '@/utils/resourceIdentity';
import { isPulseAgentPlatformResource } from '@/utils/agentResources';
-import { getDiscoveryLoadingState } from '@/utils/discoveryPresentation';
import { formatInteger } from './resourceDetailMappers';
import { buildPbsJobHealthEvidenceModel } from './resourceDetailDrawerServiceModel';
import { ResourceDetailDrawerSupportDisclosure as SupportDisclosure } from './ResourceDetailDrawerSupportDisclosure';
@@ -294,14 +294,7 @@ const AccessDisclosure: Component<{
</div>
<Show when={props.drawer.showDiscoveryContext()}>
- <Suspense
- fallback={
- <div class="flex items-center justify-center py-8">
- <div class="animate-spin h-6 w-6 border-2 border-blue-500 border-t-transparent rounded-full" />
- <span class="ml-2 text-sm text-muted">{getDiscoveryLoadingState().text}</span>
- </div>
- }
- >
+ <Suspense fallback={<DiscoveryLoadingFallback />}>
<DiscoveryTab
resourceType={config().resourceType}
agentId={config().agentId}
diff --git a/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx b/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx
index 5628defa5f..4412fc72e3 100644
--- a/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx
+++ b/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx
@@ -7,6 +7,7 @@ import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSusp
import { aiChatStore } from '@/stores/aiChat';
import { getCanonicalWorkloadId } from '@/utils/workloads';
import { getDiscoveryProvenanceTitle } from '@/utils/discoveryPresentation';
+import guestDrawerSource from './GuestDrawer.tsx?raw';
// ── Mocks ──────────────────────────────────────────────────────────────
@@ -199,6 +200,13 @@ afterEach(() => {
// ── Tests ──────────────────────────────────────────────────────────────
describe('GuestDrawer', () => {
+ it('uses the shared discovery loading fallback instead of a drawer-local spinner row', () => {
+ expect(guestDrawerSource).toContain('DiscoveryLoadingFallback');
+ expect(guestDrawerSource).not.toContain(
+ 'animate-spin h-6 w-6 border-2 border-blue-500 border-t-transparent rounded-full',
+ );
+ });
+
describe('Assistant context actions', () => {
it('opens Pulse Assistant with a canonical Proxmox LXC resource handoff', () => {
aiChatStore.setEnabled(true);
diff --git a/frontend-modern/src/components/Workloads/GuestDrawer.tsx b/frontend-modern/src/components/Workloads/GuestDrawer.tsx
index e8416856b2..bbe16357af 100644
--- a/frontend-modern/src/components/Workloads/GuestDrawer.tsx
+++ b/frontend-modern/src/components/Workloads/GuestDrawer.tsx
@@ -8,6 +8,7 @@ import {
DrawerHeaderActionGroup,
DrawerHeaderIconButton,
} from '@/components/shared/Button';
+import { DiscoveryLoadingFallback } from '@/components/shared/DiscoveryLoadingFallback';
import { DrawerSubjectHeading } from '@/components/shared/DrawerSubjectHeading';
import { DiscoveryReadinessBadge } from '@/components/shared/DiscoveryReadinessBadge';
import { Subtabs, type SubtabOption } from '@/components/shared/Subtabs';
@@ -175,14 +176,7 @@ export const GuestDrawer: Component<GuestDrawerProps> = (props) => {
class={activeTab() === 'discovery' ? '' : 'hidden'}
style={{ 'overflow-anchor': 'none' }}
>
- <Suspense
- fallback={
- <div class="flex items-center justify-center py-8">
- <div class="animate-spin h-6 w-6 border-2 border-blue-500 border-t-transparent rounded-full" />
- <span class="ml-2 text-sm text-muted">{discoveryLoadingState.text}</span>
- </div>
- }
- >
+ <Suspense fallback={<DiscoveryLoadingFallback text={discoveryLoadingState.text} />}>
<DiscoveryTab
resourceType={discoveryResourceType()!}
agentId={discoveryAgentId()}
diff --git a/frontend-modern/src/components/Workloads/NodeDrawer.tsx b/frontend-modern/src/components/Workloads/NodeDrawer.tsx
index 3c8b322bec..2cdde508c3 100644
--- a/frontend-modern/src/components/Workloads/NodeDrawer.tsx
+++ b/frontend-modern/src/components/Workloads/NodeDrawer.tsx
@@ -2,10 +2,10 @@ import { Show, Suspense, createMemo, createSignal, type Component } from 'solid-
import type { HistoryTimeRange } from '@/api/charts';
import { DiscoveryTab } from '@/components/Discovery/DiscoveryTab';
+import { DiscoveryLoadingFallback } from '@/components/shared/DiscoveryLoadingFallback';
import { DrawerSubjectHeading } from '@/components/shared/DrawerSubjectHeading';
import { Subtabs, type SubtabOption } from '@/components/shared/Subtabs';
import type { Disk, Node } from '@/types/api';
-import { getDiscoveryLoadingState } from '@/utils/discoveryPresentation';
import { getNodeDisplayName } from '@/utils/nodes';
import { getSimpleStatusIndicator } from '@/utils/status';
@@ -91,14 +91,7 @@ export const NodeDrawer: Component<NodeDrawerProps> = (props) => {
class={activeTab() === 'discovery' ? '' : 'hidden'}
style={{ 'overflow-anchor': 'none' }}
>
- <Suspense
- fallback={
- <div class="flex items-center justify-center py-8">
- <div class="animate-spin h-6 w-6 border-2 border-blue-500 border-t-transparent rounded-full" />
- <span class="ml-2 text-sm text-muted">{getDiscoveryLoadingState().text}</span>
- </div>
- }
- >
+ <Suspense fallback={<DiscoveryLoadingFallback />}>
<DiscoveryTab
resourceType="agent"
agentId={props.discoveryTarget.agentId}
diff --git a/frontend-modern/src/components/shared/DiscoveryLoadingFallback.test.tsx b/frontend-modern/src/components/shared/DiscoveryLoadingFallback.test.tsx
new file mode 100644
index 0000000000..e0c4c613c9
--- /dev/null
+++ b/frontend-modern/src/components/shared/DiscoveryLoadingFallback.test.tsx
@@ -0,0 +1,22 @@
+import { render, screen } from '@solidjs/testing-library';
+import { describe, expect, it } from 'vitest';
+import discoveryLoadingFallbackSource from '@/components/shared/DiscoveryLoadingFallback.tsx?raw';
+import { DiscoveryLoadingFallback } from './DiscoveryLoadingFallback';
+
+describe('DiscoveryLoadingFallback', () => {
+ it('renders the shared discovery loading row on the canonical LoadingSpinner primitive', () => {
+ render(() => <DiscoveryLoadingFallback text="Loading discovery details" />);
+
+ const status = screen.getByRole('status');
+ expect(status).toHaveTextContent('Loading discovery details');
+ expect(status).toHaveClass('flex');
+ expect(status).toHaveClass('items-center');
+ expect(status).toHaveClass('justify-center');
+ expect(status).toHaveClass('py-8');
+ expect(status.querySelector('span[aria-hidden="true"]')).toHaveClass('h-6');
+ expect(status.querySelector('span[aria-hidden="true"]')).toHaveClass('border-blue-500');
+
+ expect(discoveryLoadingFallbackSource).toContain('LoadingSpinner');
+ expect(discoveryLoadingFallbackSource).not.toContain('animate-spin h-6 w-6');
+ });
+});
diff --git a/frontend-modern/src/components/shared/DiscoveryLoadingFallback.tsx b/frontend-modern/src/components/shared/DiscoveryLoadingFallback.tsx
new file mode 100644
index 0000000000..78f833a814
--- /dev/null
+++ b/frontend-modern/src/components/shared/DiscoveryLoadingFallback.tsx
@@ -0,0 +1,27 @@
+import type { JSX } from 'solid-js';
+import { getDiscoveryLoadingState } from '@/utils/discoveryPresentation';
+import { LoadingSpinner } from './LoadingSpinner';
+
+interface DiscoveryLoadingFallbackProps {
+ text?: string;
+ class?: string;
+}
+
+export function DiscoveryLoadingFallback(props: DiscoveryLoadingFallbackProps): JSX.Element {
+ const text = () => props.text ?? getDiscoveryLoadingState().text;
+
+ return (
+ <div
+ role="status"
+ aria-live="polite"
+ class={['flex items-center justify-center py-8', props.class ?? '']
+ .filter(Boolean)
+ .join(' ')}
+ >
+ <LoadingSpinner size="xl" tone="info" />
+ <span class="ml-2 text-sm text-muted">{text()}</span>
+ </div>
+ );
+}
+
+export default DiscoveryLoadingFallback;
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index d094f77173..dc8c23ebef 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -50,6 +50,7 @@ import searchInputEnhancementsModelSource from '@/components/shared/searchInputE
import searchInputModelSource from '@/components/shared/searchInputModel.ts?raw';
import statusDotSource from '@/components/shared/StatusDot.tsx?raw';
import loadingSpinnerSource from '@/components/shared/LoadingSpinner.tsx?raw';
+import discoveryLoadingFallbackSource from '@/components/shared/DiscoveryLoadingFallback.tsx?raw';
import settingsLoadingSkeletonSource from '@/components/shared/SettingsLoadingSkeleton.tsx?raw';
import statusBadgeSource from '@/components/shared/StatusBadge.tsx?raw';
import statusBadgeModelSource from '@/components/shared/statusBadgeModel.ts?raw';
@@ -133,6 +134,7 @@ import selfHostedCommercialRecoverySectionSource from '@/components/Settings/Sel
import suggestProfileModalSource from '@/components/Settings/SuggestProfileModal.tsx?raw';
import alertAppriseDestinationsSectionSource from '@/features/alerts/AlertAppriseDestinationsSection.tsx?raw';
import dockerPageSurfaceSource from '@/features/docker/DockerPageSurface.tsx?raw';
+import dockerHostDrawerSource from '@/features/docker/DockerHostDrawer.tsx?raw';
import dockerServicesTableSource from '@/features/docker/DockerServicesTable.tsx?raw';
import kubernetesPageSurfaceSource from '@/features/kubernetes/KubernetesPageSurface.tsx?raw';
import proxmoxPageSurfaceSource from '@/features/proxmox/ProxmoxPageSurface.tsx?raw';
@@ -149,6 +151,7 @@ import upgradeNavigationSource from '@/utils/upgradeNavigation.ts?raw';
import guestRowSource from '@/components/Workloads/GuestRow.tsx?raw';
import guestDrawerSource from '@/components/Workloads/GuestDrawer.tsx?raw';
import guestDrawerHistorySource from '@/components/Workloads/GuestDrawerHistory.tsx?raw';
+import nodeDrawerSource from '@/components/Workloads/NodeDrawer.tsx?raw';
import workloadsSurfaceSource from '@/components/Workloads/WorkloadsSurface.tsx?raw';
import workloadsTableSource from '@/components/Workloads/WorkloadsTable.tsx?raw';
import workloadPanelSource from '@/components/Workloads/WorkloadPanel.tsx?raw';
@@ -2460,7 +2463,7 @@ describe('shared primitive guardrails', () => {
}
});
- it('keeps shared, Login, Settings, Patrol, and AI loading spinners on the shared LoadingSpinner primitive', () => {
+ it('keeps shared, discovery drawer, Login, Settings, Patrol, and AI loading spinners on shared loading primitives', () => {
const registry = JSON.parse(sharedTemplateRegistrySource) as {
rules?: Array<{
id: string;
@@ -2478,6 +2481,9 @@ describe('shared primitive guardrails', () => {
}>;
};
const registeredRule = registry.rules?.find((rule) => rule.id === 'loading-spinner-shell');
+ const discoveryFallbackRule = registry.rules?.find(
+ (rule) => rule.id === 'discovery-loading-fallback',
+ );
const registeredGuard = registry.patternGuards?.find(
(guard) => guard.id === 'patrol-ai-local-loading-spinner-shell',
);
@@ -2493,6 +2499,9 @@ describe('shared primitive guardrails', () => {
const sharedComponentSpinnerGuard = registry.patternGuards?.find(
(guard) => guard.id === 'shared-component-local-loading-spinner-shell',
);
+ const drawerDiscoveryFallbackGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'drawer-discovery-local-loading-fallback',
+ );
expect(registeredRule?.canonical?.path).toBe('src/components/shared/LoadingSpinner.tsx');
expect(registeredRule?.canonical?.export).toBe('LoadingSpinner');
@@ -2510,6 +2519,7 @@ describe('shared primitive guardrails', () => {
'src/components/Settings/UserAssignmentsDialog.tsx',
'src/components/Settings/UserAssignmentsPanel.tsx',
'src/components/shared/Button.tsx',
+ 'src/components/shared/DiscoveryLoadingFallback.tsx',
'src/components/shared/HistoryChartOverlay.tsx',
'src/components/shared/PulseDataGrid.tsx',
'src/components/patrol/ApprovalBanner.tsx',
@@ -2558,10 +2568,40 @@ describe('shared primitive guardrails', () => {
'src/components/shared/PulseDataGrid.tsx',
]);
expect(sharedComponentSpinnerGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(discoveryFallbackRule?.canonical?.path).toBe(
+ 'src/components/shared/DiscoveryLoadingFallback.tsx',
+ );
+ expect(discoveryFallbackRule?.canonical?.export).toBe('DiscoveryLoadingFallback');
+ expect(discoveryFallbackRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual([
+ 'src/components/Infrastructure/ResourceDetailDrawer.tsx',
+ 'src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx',
+ 'src/components/Workloads/GuestDrawer.tsx',
+ 'src/components/Workloads/NodeDrawer.tsx',
+ 'src/features/docker/DockerHostDrawer.tsx',
+ ]);
+ expect(drawerDiscoveryFallbackGuard?.canonical?.path).toBe(
+ 'src/components/shared/DiscoveryLoadingFallback.tsx',
+ );
+ expect(drawerDiscoveryFallbackGuard?.canonical?.export).toBe('DiscoveryLoadingFallback');
+ expect(drawerDiscoveryFallbackGuard?.allPatterns).toEqual([
+ 'border-t-transparent',
+ 'animate-spin',
+ ]);
+ expect(drawerDiscoveryFallbackGuard?.scopes).toEqual([
+ 'src/components/Infrastructure/ResourceDetailDrawer.tsx',
+ 'src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx',
+ 'src/components/Workloads/GuestDrawer.tsx',
+ 'src/components/Workloads/NodeDrawer.tsx',
+ 'src/features/docker/DockerHostDrawer.tsx',
+ ]);
+ expect(drawerDiscoveryFallbackGuard?.allowedPaths ?? []).toHaveLength(0);
expect(loadingSpinnerSource).toContain('getLoadingSpinnerClass');
expect(loadingSpinnerSource).toContain('aria-hidden={ariaHidden()}');
expect(loadingSpinnerSource).toContain("button: 'h-5 w-5 border-2'");
+ expect(discoveryLoadingFallbackSource).toContain('LoadingSpinner');
+ expect(discoveryLoadingFallbackSource).toContain('getDiscoveryLoadingState');
+ expect(discoveryLoadingFallbackSource).toContain('role="status"');
expect(loginSource).toContain('LoadingSpinner');
expect(loginSource).toContain('size="button"');
expect(loginSource).not.toContain(
@@ -2569,11 +2609,41 @@ describe('shared primitive guardrails', () => {
);
expect(loginSource).not.toContain('class="animate-spin -ml-1 mr-3 h-5 w-5 text-white"');
- for (const source of [buttonSource, historyChartOverlaySource, pulseDataGridSource]) {
+ for (const source of [
+ buttonSource,
+ discoveryLoadingFallbackSource,
+ historyChartOverlaySource,
+ pulseDataGridSource,
+ ]) {
expect(source).toContain('LoadingSpinner');
expect(source).not.toContain('animate-spin');
}
+ const discoveryFallbackConsumers: Array<[string, string]> = [
+ ['src/components/Infrastructure/ResourceDetailDrawer.tsx', resourceDetailDrawerSource],
+ [
+ 'src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx',
+ resourceDetailDrawerOverviewTabSource,
+ ],
+ ['src/components/Workloads/GuestDrawer.tsx', guestDrawerSource],
+ ['src/components/Workloads/NodeDrawer.tsx', nodeDrawerSource],
+ ['src/features/docker/DockerHostDrawer.tsx', dockerHostDrawerSource],
+ ];
+ const discoveryFallbackForbiddenByPath = new Map(
+ discoveryFallbackRule?.forbiddenPatterns?.map((entry) => [
+ entry.path,
+ entry.patterns ?? [],
+ ]) ?? [],
+ );
+
+ for (const [path, source] of discoveryFallbackConsumers) {
+ expect(source).toContain('DiscoveryLoadingFallback');
+ for (const retiredPattern of discoveryFallbackForbiddenByPath.get(path) ?? []) {
+ expect(source).not.toContain(retiredPattern);
+ }
+ expect(source).not.toContain('border-t-transparent');
+ }
+
for (const source of [
findingsPanelSource,
approvalBannerSource,
diff --git a/frontend-modern/src/features/docker/DockerHostDrawer.tsx b/frontend-modern/src/features/docker/DockerHostDrawer.tsx
index 8b9a1c2b66..0daf34584b 100644
--- a/frontend-modern/src/features/docker/DockerHostDrawer.tsx
+++ b/frontend-modern/src/features/docker/DockerHostDrawer.tsx
@@ -2,6 +2,7 @@ import { Show, Suspense, createMemo, createSignal, type Component } from 'solid-
import type { HistoryTimeRange } from '@/api/charts';
import { DiscoveryTab } from '@/components/Discovery/DiscoveryTab';
+import { DiscoveryLoadingFallback } from '@/components/shared/DiscoveryLoadingFallback';
import { DrawerSubjectHeading } from '@/components/shared/DrawerSubjectHeading';
import { Subtabs, type SubtabOption } from '@/components/shared/Subtabs';
import { getSimpleStatusIndicator } from '@/utils/status';
@@ -9,7 +10,6 @@ import { GuestDrawerHistory, GuestDrawerHistoryRangeSelect } from '@/components/
import { GUEST_DRAWER_HISTORY_DEFAULT_RANGE } from '@/components/Workloads/guestDrawerModel';
import { toDiscoveryConfig } from '@/components/Infrastructure/resourceDetailDiscoveryModel';
import type { Resource } from '@/types/resource';
-import { getDiscoveryLoadingState } from '@/utils/discoveryPresentation';
import { asTrimmedString } from '@/utils/stringUtils';
import { DockerHostDrawerOverview } from './DockerHostDrawerOverview';
@@ -91,14 +91,7 @@ export const DockerHostDrawer: Component<DockerHostDrawerProps> = (props) => {
class={activeTab() === 'discovery' ? '' : 'hidden'}
style={{ 'overflow-anchor': 'none' }}
>
- <Suspense
- fallback={
- <div class="flex items-center justify-center py-8">
- <div class="animate-spin h-6 w-6 border-2 border-blue-500 border-t-transparent rounded-full" />
- <span class="ml-2 text-sm text-muted">{getDiscoveryLoadingState().text}</span>
- </div>
- }
- >
+ <Suspense fallback={<DiscoveryLoadingFallback />}>
<DiscoveryTab
resourceType={config().resourceType}
agentId={config().agentId}