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.

Split infrastructure details drawer runtime owners

rcourtman0809b0271a6b
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index a6d2d03c32..98f9133cfe 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -189,6 +189,15 @@ resource-family counts, agent-backed node-summary projection, unified-node and
PBS-instance projection, and recovery backup-count derivation. Future
infrastructure-selector work should extend those owners instead of pushing
resource aggregation or selection lifecycle back into the shared shell.
+The shared infrastructure details drawer now follows that same owner split.
+`frontend-modern/src/components/shared/InfrastructureDetailsDrawer.tsx` stays
+the render shell, `frontend-modern/src/components/shared/useInfrastructureDetailsDrawerState.ts`
+owns tab-selection runtime, and
+`frontend-modern/src/components/shared/infrastructureDetailsDrawerModel.ts`
+owns canonical metadata-id and discovery-hostname derivation. Future
+infrastructure-details-drawer work should extend those owners instead of
+pushing tab state or resource-identity normalization back into the shared
+shell.
The shared interactive sparkline now follows that same split.
`frontend-modern/src/components/shared/InteractiveSparkline.tsx` stays the
render shell, `frontend-modern/src/components/shared/useInteractiveSparklineState.ts`
diff --git a/frontend-modern/src/components/shared/InfrastructureDetailsDrawer.tsx b/frontend-modern/src/components/shared/InfrastructureDetailsDrawer.tsx
index 8b5cd02ada..46bf1acd46 100644
--- a/frontend-modern/src/components/shared/InfrastructureDetailsDrawer.tsx
+++ b/frontend-modern/src/components/shared/InfrastructureDetailsDrawer.tsx
@@ -1,5 +1,4 @@
-import { Component, Suspense, createSignal } from 'solid-js';
-import type { Agent, Node } from '@/types/api';
+import { Component, Suspense } from 'solid-js';
import { DiscoveryTab } from '../Discovery/DiscoveryTab';
import { SystemInfoCard } from '@/components/shared/cards/SystemInfoCard';
import { HardwareCard } from '@/components/shared/cards/HardwareCard';
@@ -9,56 +8,55 @@ import { DisksCard } from '@/components/shared/cards/DisksCard';
import { WebInterfaceUrlField } from '@/components/shared/WebInterfaceUrlField';
import { getDiscoveryLoadingState } from '@/utils/discoveryPresentation';
import {
- getInfrastructureDiscoveryHostname,
- getInfrastructureMetadataId,
-} from '@/utils/resourceIdentity';
-
-interface InfrastructureDetailsDrawerProps {
- node: Node;
- agent?: Agent;
- customUrl?: string; // Proxmox hosts do not typically override this URL, but the field still supports it.
- onCustomUrlChange?: (agentId: string, url: string) => void;
-}
+ resolveInfrastructureDetailsDrawerDiscoveryHostname,
+ resolveInfrastructureDetailsDrawerMetadataId,
+ type InfrastructureDetailsDrawerProps,
+} from './infrastructureDetailsDrawerModel';
+import { useInfrastructureDetailsDrawerState } from './useInfrastructureDetailsDrawerState';
export const InfrastructureDetailsDrawer: Component<InfrastructureDetailsDrawerProps> = (props) => {
- const [activeTab, setActiveTab] = createSignal<'overview' | 'discovery'>('overview');
- const metadataId = () => getInfrastructureMetadataId(props.node, props.agent);
- const discoveryHostname = () => getInfrastructureDiscoveryHostname(props.node, props.agent);
-
- const switchTab = (tab: 'overview' | 'discovery') => {
- setActiveTab(tab);
- };
+ const drawer = useInfrastructureDetailsDrawerState();
+ const metadataId = () => resolveInfrastructureDetailsDrawerMetadataId(props.node, props.agent);
+ const discoveryHostname = () =>
+ resolveInfrastructureDetailsDrawerDiscoveryHostname(props.node, props.agent);
return (
<div class="space-y-3">
{/* Tabs */}
<div class="flex items-center gap-6 border-b border-border px-1 mb-1">
<button
- onClick={() => switchTab('overview')}
+ onClick={() => drawer.setActiveTab('overview')}
class={`pb-2 text-sm font-medium transition-colors relative ${
- activeTab() === 'overview' ? 'text-blue-600 dark:text-blue-400' : ' hover:text-muted'
+ drawer.activeTab() === 'overview'
+ ? 'text-blue-600 dark:text-blue-400'
+ : ' hover:text-muted'
}`}
>
Overview
- {activeTab() === 'overview' && (
+ {drawer.activeTab() === 'overview' && (
<div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />
)}
</button>
<button
- onClick={() => switchTab('discovery')}
+ onClick={() => drawer.setActiveTab('discovery')}
class={`pb-2 text-sm font-medium transition-colors relative ${
- activeTab() === 'discovery' ? 'text-blue-600 dark:text-blue-400' : ' hover:text-muted'
+ drawer.activeTab() === 'discovery'
+ ? 'text-blue-600 dark:text-blue-400'
+ : ' hover:text-muted'
}`}
>
Discovery
- {activeTab() === 'discovery' && (
+ {drawer.activeTab() === 'discovery' && (
<div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />
)}
</button>
</div>
{/* Overview Tab */}
- <div class={activeTab() === 'overview' ? '' : 'hidden'} style={{ 'overflow-anchor': 'none' }}>
+ <div
+ class={drawer.activeTab() === 'overview' ? '' : 'hidden'}
+ style={{ 'overflow-anchor': 'none' }}
+ >
<div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(25%-0.75rem)] [&>*]:min-w-[200px] [&>*]:max-w-full [&>*]:overflow-hidden">
<SystemInfoCard variant="node" node={props.node} />
<HardwareCard variant="node" node={props.node} />
@@ -79,7 +77,7 @@ export const InfrastructureDetailsDrawer: Component<InfrastructureDetailsDrawerP
{/* Discovery Tab */}
<div
- class={activeTab() === 'discovery' ? '' : 'hidden'}
+ class={drawer.activeTab() === 'discovery' ? '' : 'hidden'}
style={{ 'overflow-anchor': 'none' }}
>
<Suspense
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 2adb6c9e1f..b0970bc278 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -11,6 +11,8 @@ import helpIconSource from '@/components/shared/HelpIcon.tsx?raw';
import helpIconModelSource from '@/components/shared/helpIconModel.ts?raw';
import historyChartSource from '@/components/shared/HistoryChart.tsx?raw';
import historyChartModelSource from '@/components/shared/historyChartModel.ts?raw';
+import infrastructureDetailsDrawerSource from '@/components/shared/InfrastructureDetailsDrawer.tsx?raw';
+import infrastructureDetailsDrawerModelSource from '@/components/shared/infrastructureDetailsDrawerModel.ts?raw';
import mobileNavBarSource from '@/components/shared/MobileNavBar.tsx?raw';
import mobileNavBarModelSource from '@/components/shared/mobileNavBarModel.ts?raw';
import infrastructureSelectorSource from '@/components/shared/InfrastructureSelector.tsx?raw';
@@ -31,6 +33,7 @@ import containerUpdateButtonStateSource from '@/components/shared/useContainerUp
import densityMapStateSource from '@/components/shared/useDensityMapState.ts?raw';
import helpIconStateSource from '@/components/shared/useHelpIconState.ts?raw';
import historyChartStateSource from '@/components/shared/useHistoryChartState.ts?raw';
+import infrastructureDetailsDrawerStateSource from '@/components/shared/useInfrastructureDetailsDrawerState.ts?raw';
import mobileNavBarStateSource from '@/components/shared/useMobileNavBarState.ts?raw';
import infrastructureSelectorStateSource from '@/components/shared/useInfrastructureSelectorState.ts?raw';
import pulseDataGridStateSource from '@/components/shared/usePulseDataGridState.ts?raw';
@@ -313,6 +316,40 @@ describe('shared primitive guardrails', () => {
expect(helpIconModelSource).toContain('helpIconSizeClasses');
});
+ it('keeps infrastructure details drawer on shell, runtime, and model owners', () => {
+ expect(infrastructureDetailsDrawerSource).toContain('useInfrastructureDetailsDrawerState');
+ expect(infrastructureDetailsDrawerSource).toContain(
+ 'resolveInfrastructureDetailsDrawerMetadataId',
+ );
+ expect(infrastructureDetailsDrawerSource).toContain(
+ 'resolveInfrastructureDetailsDrawerDiscoveryHostname',
+ );
+ expect(infrastructureDetailsDrawerSource).not.toContain('createSignal');
+ expect(infrastructureDetailsDrawerSource).not.toContain('getInfrastructureMetadataId');
+ expect(infrastructureDetailsDrawerSource).not.toContain(
+ 'getInfrastructureDiscoveryHostname',
+ );
+
+ expect(infrastructureDetailsDrawerStateSource).toContain(
+ 'export function useInfrastructureDetailsDrawerState',
+ );
+ expect(infrastructureDetailsDrawerStateSource).toContain('createSignal');
+ expect(infrastructureDetailsDrawerStateSource).toContain(
+ "type InfrastructureDetailsDrawerTab = 'overview' | 'discovery'",
+ );
+
+ expect(infrastructureDetailsDrawerModelSource).toContain(
+ 'resolveInfrastructureDetailsDrawerMetadataId',
+ );
+ expect(infrastructureDetailsDrawerModelSource).toContain(
+ 'resolveInfrastructureDetailsDrawerDiscoveryHostname',
+ );
+ expect(infrastructureDetailsDrawerModelSource).toContain('getInfrastructureMetadataId');
+ expect(infrastructureDetailsDrawerModelSource).toContain(
+ 'getInfrastructureDiscoveryHostname',
+ );
+ });
+
it('keeps mobile nav on shell, runtime, and model owners', () => {
expect(mobileNavBarSource).toContain('useMobileNavBarState');
expect(mobileNavBarSource).toContain('getMobileNavTabButtonClass');
diff --git a/frontend-modern/src/components/shared/__tests__/InfrastructureDetailsDrawer.test.tsx b/frontend-modern/src/components/shared/__tests__/InfrastructureDetailsDrawer.test.tsx
index 199704150b..e9287f1a8f 100644
--- a/frontend-modern/src/components/shared/__tests__/InfrastructureDetailsDrawer.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/InfrastructureDetailsDrawer.test.tsx
@@ -1,5 +1,8 @@
import { describe, expect, it, vi } from 'vitest';
import { fireEvent, render, screen } from '@solidjs/testing-library';
+import infrastructureDetailsDrawerSource from '@/components/shared/InfrastructureDetailsDrawer.tsx?raw';
+import infrastructureDetailsDrawerModelSource from '@/components/shared/infrastructureDetailsDrawerModel.ts?raw';
+import infrastructureDetailsDrawerStateSource from '@/components/shared/useInfrastructureDetailsDrawerState.ts?raw';
import { InfrastructureDetailsDrawer } from '@/components/shared/InfrastructureDetailsDrawer';
import type { Node, Agent } from '@/types/api';
@@ -73,6 +76,38 @@ const makeAgent = (overrides: Partial<Agent> = {}): Agent => ({
});
describe('InfrastructureDetailsDrawer', () => {
+ it('keeps infrastructure details drawer on shell, runtime, and model owners', () => {
+ expect(infrastructureDetailsDrawerSource).toContain('useInfrastructureDetailsDrawerState');
+ expect(infrastructureDetailsDrawerSource).toContain(
+ 'resolveInfrastructureDetailsDrawerMetadataId',
+ );
+ expect(infrastructureDetailsDrawerSource).toContain(
+ 'resolveInfrastructureDetailsDrawerDiscoveryHostname',
+ );
+ expect(infrastructureDetailsDrawerSource).not.toContain('createSignal');
+ expect(infrastructureDetailsDrawerSource).not.toContain('getInfrastructureMetadataId');
+ expect(infrastructureDetailsDrawerSource).not.toContain(
+ 'getInfrastructureDiscoveryHostname',
+ );
+
+ expect(infrastructureDetailsDrawerStateSource).toContain(
+ 'export function useInfrastructureDetailsDrawerState',
+ );
+ expect(infrastructureDetailsDrawerStateSource).toContain('createSignal');
+ expect(infrastructureDetailsDrawerStateSource).toContain("type InfrastructureDetailsDrawerTab = 'overview' | 'discovery'");
+
+ expect(infrastructureDetailsDrawerModelSource).toContain(
+ 'resolveInfrastructureDetailsDrawerMetadataId',
+ );
+ expect(infrastructureDetailsDrawerModelSource).toContain(
+ 'resolveInfrastructureDetailsDrawerDiscoveryHostname',
+ );
+ expect(infrastructureDetailsDrawerModelSource).toContain('getInfrastructureMetadataId');
+ expect(infrastructureDetailsDrawerModelSource).toContain(
+ 'getInfrastructureDiscoveryHostname',
+ );
+ });
+
it('uses linkedAgentId when no agent object is provided', async () => {
discoveryTabMock.mockClear();
webInterfaceUrlFieldMock.mockClear();
diff --git a/frontend-modern/src/components/shared/infrastructureDetailsDrawerModel.ts b/frontend-modern/src/components/shared/infrastructureDetailsDrawerModel.ts
new file mode 100644
index 0000000000..2e79b35f18
--- /dev/null
+++ b/frontend-modern/src/components/shared/infrastructureDetailsDrawerModel.ts
@@ -0,0 +1,20 @@
+import type { Agent, Node } from '@/types/api';
+import {
+ getInfrastructureDiscoveryHostname,
+ getInfrastructureMetadataId,
+} from '@/utils/resourceIdentity';
+
+export interface InfrastructureDetailsDrawerProps {
+ node: Node;
+ agent?: Agent;
+ customUrl?: string;
+ onCustomUrlChange?: (agentId: string, url: string) => void;
+}
+
+export const resolveInfrastructureDetailsDrawerMetadataId = (node: Node, agent?: Agent) =>
+ getInfrastructureMetadataId(node, agent);
+
+export const resolveInfrastructureDetailsDrawerDiscoveryHostname = (
+ node: Node,
+ agent?: Agent,
+) => getInfrastructureDiscoveryHostname(node, agent);
diff --git a/frontend-modern/src/components/shared/useInfrastructureDetailsDrawerState.ts b/frontend-modern/src/components/shared/useInfrastructureDetailsDrawerState.ts
new file mode 100644
index 0000000000..7ebd22c94e
--- /dev/null
+++ b/frontend-modern/src/components/shared/useInfrastructureDetailsDrawerState.ts
@@ -0,0 +1,12 @@
+import { createSignal } from 'solid-js';
+
+export type InfrastructureDetailsDrawerTab = 'overview' | 'discovery';
+
+export function useInfrastructureDetailsDrawerState() {
+ const [activeTab, setActiveTab] = createSignal<InfrastructureDetailsDrawerTab>('overview');
+
+ return {
+ activeTab,
+ setActiveTab,
+ };
+}
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index d0ca635734..cacb3e54f9 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -542,9 +542,11 @@ import remediationStatusSource from '@/components/patrol/RemediationStatus.tsx?r
import remediationPresentationSource from '@/utils/remediationPresentation.ts?raw';
import aiChatPresentationSource from '@/utils/aiChatPresentation.ts?raw';
import infrastructureDetailsDrawerSource from '@/components/shared/InfrastructureDetailsDrawer.tsx?raw';
+import infrastructureDetailsDrawerModelSource from '@/components/shared/infrastructureDetailsDrawerModel.ts?raw';
import infrastructurePageSurfaceSource from '@/features/infrastructure/InfrastructurePageSurface.tsx?raw';
import infrastructurePageStateSource from '@/features/infrastructure/useInfrastructurePageState.ts?raw';
import infrastructurePageRouteStateSource from '@/features/infrastructure/useInfrastructurePageRouteState.ts?raw';
+import infrastructureDetailsDrawerStateSource from '@/components/shared/useInfrastructureDetailsDrawerState.ts?raw';
const aiSettingsSource = [
aiSettingsShellSource,
@@ -2747,6 +2749,32 @@ describe('frontend resource type boundaries', () => {
expect(mobileNavBarModelSource).toContain('buildOrderedMobileNavUtilityTabs');
expect(mobileNavBarModelSource).toContain('getMobileNavAlertBadgeCounts');
expect(mobileNavBarModelSource).toContain('getMobileNavFadeState');
+ expect(infrastructureDetailsDrawerSource).toContain('useInfrastructureDetailsDrawerState');
+ expect(infrastructureDetailsDrawerSource).toContain(
+ 'resolveInfrastructureDetailsDrawerMetadataId',
+ );
+ expect(infrastructureDetailsDrawerSource).toContain(
+ 'resolveInfrastructureDetailsDrawerDiscoveryHostname',
+ );
+ expect(infrastructureDetailsDrawerSource).not.toContain('createSignal');
+ expect(infrastructureDetailsDrawerSource).not.toContain('getInfrastructureMetadataId');
+ expect(infrastructureDetailsDrawerSource).not.toContain(
+ 'getInfrastructureDiscoveryHostname',
+ );
+ expect(infrastructureDetailsDrawerStateSource).toContain('createSignal');
+ expect(infrastructureDetailsDrawerStateSource).toContain(
+ "type InfrastructureDetailsDrawerTab = 'overview' | 'discovery'",
+ );
+ expect(infrastructureDetailsDrawerModelSource).toContain(
+ 'resolveInfrastructureDetailsDrawerMetadataId',
+ );
+ expect(infrastructureDetailsDrawerModelSource).toContain(
+ 'resolveInfrastructureDetailsDrawerDiscoveryHostname',
+ );
+ expect(infrastructureDetailsDrawerModelSource).toContain('getInfrastructureMetadataId');
+ expect(infrastructureDetailsDrawerModelSource).toContain(
+ 'getInfrastructureDiscoveryHostname',
+ );
expect(useUnifiedResourcesSource).not.toContain('normalizeResourcePolicyAISafeSummary(');
expect(useUnifiedResourcesSource).not.toContain('normalizeResourcePolicy(');
expect(useUnifiedResourcesSource).not.toContain('const resolvePolicySensitivity =');