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.

Delete orphaned InfrastructureSummary and infrastructureSummaryModel

rcourtmand8a8709b561d
diff --git a/frontend-modern/src/components/Infrastructure/InfrastructureSummary.test.tsx b/frontend-modern/src/components/Infrastructure/InfrastructureSummary.test.tsx
deleted file mode 100644
index ff27530d3c..0000000000
--- a/frontend-modern/src/components/Infrastructure/InfrastructureSummary.test.tsx
+++ /dev/null
@@ -1,897 +0,0 @@
-import { createSignal } from 'solid-js';
-import { render, waitFor, cleanup } from '@solidjs/testing-library';
-import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest';
-import { InfrastructureSummary } from './InfrastructureSummary';
-import { __resetInMemoryChartCacheForTests } from './useInfrastructureSummaryState';
-import type { Resource } from '@/types/resource';
-import type { TimeRange } from '@/api/charts';
-import { __resetInfrastructureSummaryFetchesForTests } from '@/utils/infrastructureSummaryCache';
-
-const mockGetCharts = vi.fn();
-let mockHostAgentResources: Resource[] = [];
-
-vi.mock('@/api/charts', async () => {
- const actual = await vi.importActual<typeof import('@/api/charts')>('@/api/charts');
- return {
- ...actual,
- ChartsAPI: {
- ...actual.ChartsAPI,
- getInfrastructureSummaryCharts: (...args: unknown[]) => mockGetCharts(...args),
- },
- };
-});
-
-vi.mock('@/hooks/useResources', () => ({
- useResources: () => ({
- workloads: () => [],
- resources: () => mockHostAgentResources,
- }),
-}));
-
-vi.mock('@/components/shared/DensityMap', () => ({
- DensityMap: (_props: {
- series?: Array<{ id?: string; name?: string; data?: Array<unknown> }>;
- }) => {
- return (
- <svg class="cursor-crosshair" data-testid="density-map">
- <path vector-effect="non-scaling-stroke" />
- </svg>
- );
- },
-}));
-
-const makeHost = (overrides: Partial<Resource> = {}): Resource => ({
- id: 'node-1',
- type: 'agent',
- name: 'node-1',
- displayName: 'node-1',
- platformId: 'node-1',
- platformType: 'proxmox-pve',
- sourceType: 'api',
- status: 'online',
- lastSeen: Date.now(),
- ...overrides,
-});
-
-const makeChartsResponse = (ids: string[] = ['node-1']) => ({
- nodeData: Object.fromEntries(
- ids.map((id, index) => [
- id,
- {
- cpu: [
- { timestamp: Date.now() - 60_000, value: 10 + index },
- { timestamp: Date.now(), value: 15 + index },
- ],
- memory: [
- { timestamp: Date.now() - 60_000, value: 45 + index },
- { timestamp: Date.now(), value: 50 + index },
- ],
- disk: [
- { timestamp: Date.now() - 60_000, value: 30 + index },
- { timestamp: Date.now(), value: 35 + index },
- ],
- },
- ]),
- ),
- dockerHostData: {},
- agentData: {},
- timestamp: Date.now(),
- stats: {
- oldestDataTimestamp: Date.now() - 60_000,
- },
-});
-
-const countSparklinePaths = (container: HTMLElement): number =>
- container.querySelectorAll('path[vector-effect="non-scaling-stroke"]').length;
-
-describe('InfrastructureSummary range behavior', () => {
- beforeEach(() => {
- mockGetCharts.mockReset();
- mockGetCharts.mockResolvedValue(makeChartsResponse());
- __resetInfrastructureSummaryFetchesForTests();
- __resetInMemoryChartCacheForTests();
- localStorage.clear();
- mockHostAgentResources = [];
- });
-
- afterEach(() => {
- cleanup();
- });
-
- it('requests charts for initial and updated time ranges', async () => {
- const [range, setRange] = createSignal<TimeRange>('1h');
- render(() => <InfrastructureSummary resources={[makeHost()]} timeRange={range()} />);
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
-
- setRange('24h');
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('24h', undefined, expect.any(Object));
- });
- });
-
- it('deduplicates concurrent summary fetches across component instances', async () => {
- let resolveFetch: ((value: ReturnType<typeof makeChartsResponse>) => void) | undefined;
- const pending = new Promise<ReturnType<typeof makeChartsResponse>>((resolve) => {
- resolveFetch = resolve;
- });
- mockGetCharts.mockReset();
- mockGetCharts.mockImplementation(() => pending);
-
- render(() => (
- <>
- <InfrastructureSummary resources={[makeHost()]} timeRange="1h" />
- <InfrastructureSummary resources={[makeHost()]} timeRange="1h" />
- </>
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledTimes(1);
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
-
- resolveFetch?.(makeChartsResponse());
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledTimes(1);
- });
- });
-
- it('hydrates sparklines from cache immediately while live fetch is pending', async () => {
- // First render: fetch succeeds, populating the in-memory cache.
- mockGetCharts.mockReset();
- mockGetCharts.mockResolvedValueOnce(makeChartsResponse());
- const { container: firstContainer, unmount } = render(() => (
- <InfrastructureSummary resources={[makeHost()]} timeRange="1h" />
- ));
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- expect(firstContainer.querySelector('svg.cursor-crosshair')).toBeTruthy();
- });
- unmount();
-
- // Second render: fetch hangs, but in-memory cache provides instant data.
- mockGetCharts.mockReset();
- mockGetCharts.mockImplementationOnce(() => new Promise(() => {}));
- const { container } = render(() => (
- <InfrastructureSummary resources={[makeHost()]} timeRange="1h" />
- ));
-
- await waitFor(() => {
- const path = container
- .querySelector('svg.cursor-crosshair')
- ?.querySelector('path[vector-effect="non-scaling-stroke"]');
- expect(path).toBeTruthy();
- });
- });
-
- it('renders charts once live fetch resolves', async () => {
- let resolveFetch: ((value: ReturnType<typeof makeChartsResponse>) => void) | undefined;
- mockGetCharts.mockReset();
- mockGetCharts.mockImplementationOnce(
- () =>
- new Promise((resolve) => {
- resolveFetch = resolve as (value: ReturnType<typeof makeChartsResponse>) => void;
- }),
- );
-
- const { container } = render(() => (
- <InfrastructureSummary resources={[makeHost()]} timeRange="1h" />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
-
- // While fetch is pending, skeleton should be shown (no in-memory cache yet).
- expect(container.querySelectorAll('[data-testid="sparkline-skeleton"]').length).toBeGreaterThan(
- 0,
- );
-
- resolveFetch?.(makeChartsResponse());
-
- await waitFor(() => {
- expect(container.querySelector('svg.cursor-crosshair')).toBeTruthy();
- expect(container.querySelectorAll('[data-testid="sparkline-skeleton"]')).toHaveLength(0);
- });
- });
-
- it('does not render stale-range sparkline paths while new range data is loading', async () => {
- const firstResponse = makeChartsResponse();
- mockGetCharts.mockImplementationOnce(() => Promise.resolve(firstResponse));
- mockGetCharts.mockImplementationOnce(() => new Promise(() => {}));
-
- const [range, setRange] = createSignal<TimeRange>('1h');
- const { container } = render(() => (
- <InfrastructureSummary resources={[makeHost()]} timeRange={range()} />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
-
- await waitFor(() => {
- const sparklineSvg = container.querySelector('svg.cursor-crosshair');
- const sparklinePath = sparklineSvg?.querySelector('path[vector-effect="non-scaling-stroke"]');
- expect(sparklinePath).toBeTruthy();
- });
-
- setRange('24h');
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('24h', undefined, expect.any(Object));
- });
-
- expect(container.querySelector('svg.cursor-crosshair')).toBeNull();
- expect(container.querySelectorAll('[data-testid="sparkline-skeleton"]').length).toBeGreaterThan(
- 0,
- );
- });
-
- it('requests the new range while the previous range request is still pending', async () => {
- mockGetCharts.mockReset();
- mockGetCharts.mockImplementationOnce(() => new Promise(() => {}));
- mockGetCharts.mockImplementationOnce(() => Promise.resolve(makeChartsResponse()));
-
- const [range, setRange] = createSignal<TimeRange>('1h');
- render(() => <InfrastructureSummary resources={[makeHost()]} timeRange={range()} />);
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
-
- setRange('24h');
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('24h', undefined, expect.any(Object));
- });
- });
-
- it('clears stale range data when a new range response is empty', async () => {
- mockGetCharts.mockReset();
- mockGetCharts.mockImplementationOnce(() => Promise.resolve(makeChartsResponse()));
- mockGetCharts.mockImplementationOnce(() =>
- Promise.resolve({
- nodeData: {},
- dockerHostData: {},
- agentData: {},
- timestamp: Date.now(),
- stats: {
- oldestDataTimestamp: Date.now() - 60_000,
- },
- }),
- );
-
- const [range, setRange] = createSignal<TimeRange>('1h');
- const { container } = render(() => (
- <InfrastructureSummary resources={[makeHost()]} timeRange={range()} />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
- await waitFor(() => {
- expect(container.querySelector('svg.cursor-crosshair')).toBeTruthy();
- });
-
- setRange('24h');
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('24h', undefined, expect.any(Object));
- });
-
- await waitFor(() => {
- expect(container.querySelector('svg.cursor-crosshair')).toBeNull();
- expect(container.textContent).toContain('Gathering first sample…');
- });
- });
-
- it('shows waiting state for a newly connected online host before the first sample lands', async () => {
- mockGetCharts.mockReset();
- mockGetCharts.mockResolvedValueOnce({
- nodeData: {},
- dockerHostData: {},
- agentData: {},
- timestamp: Date.now(),
- stats: {
- oldestDataTimestamp: null,
- },
- });
-
- const { container } = render(() => (
- <InfrastructureSummary resources={[makeHost()]} timeRange="1h" />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
-
- await waitFor(() => {
- expect(container.textContent).toContain('Gathering first sample…');
- });
- });
-
- it('shows error state when the newly selected range request fails', async () => {
- mockGetCharts.mockReset();
- mockGetCharts.mockImplementationOnce(() => Promise.resolve(makeChartsResponse()));
- mockGetCharts.mockImplementationOnce(() => Promise.reject(new Error('network error')));
-
- const [range, setRange] = createSignal<TimeRange>('1h');
- const { container } = render(() => (
- <InfrastructureSummary resources={[makeHost()]} timeRange={range()} />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
- await waitFor(() => {
- expect(container.querySelector('svg.cursor-crosshair')).toBeTruthy();
- });
-
- setRange('24h');
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('24h', undefined, expect.any(Object));
- });
-
- await waitFor(() => {
- expect(container.querySelector('svg.cursor-crosshair')).toBeNull();
- expect(container.textContent).toContain('Trend data unavailable');
- });
- });
-
- it('hydrates from cache after hosts are removed and re-added', async () => {
- mockGetCharts.mockReset();
- mockGetCharts.mockImplementationOnce(() => Promise.resolve(makeChartsResponse()));
- mockGetCharts.mockImplementationOnce(() => new Promise(() => {}));
-
- const [hosts, setHosts] = createSignal<Resource[]>([makeHost()]);
- const { container } = render(() => (
- <InfrastructureSummary resources={hosts()} timeRange="1h" />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
- await waitFor(() => {
- expect(container.querySelector('svg.cursor-crosshair')).toBeTruthy();
- });
-
- setHosts([]);
- setHosts([makeHost()]);
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledTimes(2);
- });
-
- await waitFor(() => {
- expect(container.querySelector('svg.cursor-crosshair')).toBeTruthy();
- });
- });
-
- it('keeps per-chart rendered series bounded to the focused resource', async () => {
- mockGetCharts.mockReset();
- mockGetCharts.mockResolvedValueOnce(makeChartsResponse(['node-1', 'node-2']));
- const hosts = [
- makeHost(),
- makeHost({
- id: 'node-2',
- name: 'node-2',
- displayName: 'node-2',
- platformId: 'node-2',
- }),
- ];
- const [focusedResourceId, setFocusedResourceId] = createSignal<string | null>(null);
-
- const { container } = render(() => (
- <InfrastructureSummary
- resources={hosts}
- timeRange="1h"
- focusedResourceId={focusedResourceId()}
- />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- expect(container.querySelectorAll('[data-testid="sparkline-skeleton"]')).toHaveLength(0);
- expect(countSparklinePaths(container)).toBeGreaterThan(0);
- });
-
- const allSeriesPathCount = countSparklinePaths(container);
- setFocusedResourceId('node-2');
-
- await waitFor(() => {
- expect(container.querySelectorAll('[data-testid="sparkline-skeleton"]')).toHaveLength(0);
- expect(countSparklinePaths(container)).toBeGreaterThan(0);
- expect(countSparklinePaths(container)).toBeLessThan(allSeriesPathCount);
- });
- });
-
- it('does not refetch charts on large resource list growth for the same range', async () => {
- mockGetCharts.mockReset();
- mockGetCharts.mockResolvedValue(makeChartsResponse(['node-1']));
-
- const [hosts, setHosts] = createSignal<Resource[]>(
- Array.from({ length: 300 }, (_, i) =>
- makeHost({
- id: `node-${i}`,
- name: `node-${i}`,
- displayName: `node-${i}`,
- platformId: `node-${i}`,
- }),
- ),
- );
-
- render(() => <InfrastructureSummary resources={hosts()} timeRange="1h" />);
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledTimes(1);
- });
-
- setHosts(
- Array.from({ length: 1200 }, (_, i) =>
- makeHost({
- id: `node-updated-${i}`,
- name: `node-updated-${i}`,
- displayName: `node-updated-${i}`,
- platformId: `node-updated-${i}`,
- }),
- ),
- );
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledTimes(1);
- });
- });
-
- it('keeps the network card visible from canonical agent facets without source hints', async () => {
- mockGetCharts.mockReset();
- const now = Date.now();
- mockGetCharts.mockResolvedValueOnce({
- nodeData: {},
- dockerHostData: {},
- agentData: {
- 'agent-host-1': {
- cpu: [],
- memory: [],
- disk: [],
- netin: [],
- netout: [],
- },
- },
- timestamp: now,
- stats: {
- oldestDataTimestamp: now - 60_000,
- },
- });
-
- const agentOnlyHost: Resource = {
- id: 'unified-host-1',
- type: 'agent',
- name: 'unraid-node',
- displayName: 'unraid-node',
- platformId: 'unraid-node',
- platformType: 'agent',
- sourceType: 'agent',
- status: 'online',
- lastSeen: now,
- platformData: {
- agent: {
- agentId: 'agent-host-1',
- hostname: 'unraid-node',
- },
- },
- };
-
- const { container } = render(() => (
- <InfrastructureSummary resources={[agentOnlyHost]} timeRange="1h" />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
-
- await waitFor(() => {
- expect(container.textContent).toContain('Network');
- expect(container.textContent).not.toContain('Workloads');
- });
- });
-
- it('maps agentData by top-level resource.agent.agentId when platformData is absent', async () => {
- mockGetCharts.mockReset();
- const now = Date.now();
- mockGetCharts.mockResolvedValueOnce({
- nodeData: {},
- dockerHostData: {},
- agentData: {
- 'agent-host-2': {
- cpu: [],
- memory: [],
- disk: [],
- netin: [
- { timestamp: now - 60_000, value: 4096 },
- { timestamp: now, value: 8192 },
- ],
- netout: [
- { timestamp: now - 60_000, value: 2048 },
- { timestamp: now, value: 4096 },
- ],
- },
- },
- timestamp: now,
- stats: {
- oldestDataTimestamp: now - 60_000,
- },
- });
-
- const agentOnlyHost: Resource = {
- id: 'unified-host-2',
- type: 'agent',
- name: 'agent-host-two',
- displayName: 'agent-host-two',
- platformId: 'agent-host-two',
- platformType: 'agent',
- sourceType: 'agent',
- status: 'online',
- lastSeen: now,
- agent: {
- agentId: 'agent-host-2',
- },
- platformData: {
- sources: ['agent'],
- },
- };
-
- const { container } = render(() => (
- <InfrastructureSummary resources={[agentOnlyHost]} timeRange="1h" />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
-
- await waitFor(() => {
- expect(container.querySelector('[data-testid="density-map"]')).toBeTruthy();
- });
- });
-
- it('maps docker-host metrics using metricsTarget and hostSourceId identifiers', async () => {
- mockGetCharts.mockReset();
- const now = Date.now();
- mockGetCharts.mockResolvedValueOnce({
- nodeData: {},
- dockerHostData: {
- 'docker-host-1': {
- cpu: [
- { timestamp: now - 60_000, value: 18 },
- { timestamp: now, value: 21 },
- ],
- memory: [
- { timestamp: now - 60_000, value: 52 },
- { timestamp: now, value: 55 },
- ],
- disk: [
- { timestamp: now - 60_000, value: 37 },
- { timestamp: now, value: 39 },
- ],
- },
- },
- agentData: {},
- timestamp: now,
- stats: {
- oldestDataTimestamp: now - 60_000,
- },
- });
-
- const dockerHost: Resource = {
- id: 'hash-docker-host-resource-id',
- type: 'docker-host',
- name: 'Tower',
- displayName: 'Tower',
- platformId: 'tower',
- platformType: 'docker',
- sourceType: 'agent',
- status: 'online',
- lastSeen: now,
- metricsTarget: {
- resourceType: 'docker-host',
- resourceId: 'docker-host-1',
- },
- platformData: {
- docker: {
- hostSourceId: 'docker-host-1',
- },
- },
- };
-
- const { container } = render(() => (
- <InfrastructureSummary
- resources={[dockerHost]}
- timeRange="1h"
- focusedResourceId="hash-docker-host-resource-id"
- />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
-
- await waitFor(() => {
- expect(container.textContent).not.toContain('Building trend history…');
- });
- });
-
- it('uses linked agent discovery IDs for network chart fallback when resource IDs are hashed', async () => {
- mockGetCharts.mockReset();
- const now = Date.now();
- mockGetCharts.mockResolvedValueOnce({
- nodeData: {
- 'node-1': {
- cpu: [
- { timestamp: now - 60_000, value: 20 },
- { timestamp: now, value: 25 },
- ],
- memory: [
- { timestamp: now - 60_000, value: 40 },
- { timestamp: now, value: 45 },
- ],
- disk: [
- { timestamp: now - 60_000, value: 35 },
- { timestamp: now, value: 40 },
- ],
- netin: [],
- netout: [],
- },
- },
- dockerHostData: {},
- agentData: {
- 'agent-host-3': {
- cpu: [],
- memory: [],
- disk: [],
- netin: [
- { timestamp: now - 60_000, value: 1024 },
- { timestamp: now, value: 2048 },
- ],
- netout: [
- { timestamp: now - 60_000, value: 512 },
- { timestamp: now, value: 1536 },
- ],
- },
- },
- timestamp: now,
- stats: {
- oldestDataTimestamp: now - 60_000,
- },
- });
-
- mockHostAgentResources = [
- {
- id: 'hash-host-resource-id',
- type: 'agent',
- name: 'agent-host-3-name',
- displayName: 'Agent Host 3',
- platformId: 'agent-host-3-platform',
- platformType: 'proxmox-pve',
- sourceType: 'agent',
- status: 'online',
- lastSeen: now,
- discoveryTarget: {
- resourceType: 'agent',
- agentId: 'agent-host-3',
- resourceId: 'agent-host-3',
- },
- platformData: {
- agent: {
- agentId: 'agent-host-3',
- linkedNodeId: 'node-1',
- },
- },
- },
- ];
-
- const proxmoxNodeHost: Resource = {
- id: 'node-1',
- type: 'agent',
- name: 'node-1',
- displayName: 'node-1',
- platformId: 'node-1',
- platformType: 'proxmox-pve',
- sourceType: 'api',
- status: 'online',
- lastSeen: now,
- platformData: {
- sources: ['agent'],
- },
- };
-
- const { container } = render(() => (
- <InfrastructureSummary
- resources={[proxmoxNodeHost, ...mockHostAgentResources]}
- timeRange="1h"
- />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
-
- await waitFor(() => {
- expect(container.querySelector('[data-testid="density-map"]')).toBeTruthy();
- });
- });
-
- it('uses linkedAgentId for direct agent chart fallback when no agent resource is loaded', async () => {
- mockGetCharts.mockReset();
- const now = Date.now();
- mockHostAgentResources = [];
- mockGetCharts.mockResolvedValueOnce({
- nodeData: {
- 'node-1': {
- cpu: [
- { timestamp: now - 60_000, value: 20 },
- { timestamp: now, value: 25 },
- ],
- memory: [
- { timestamp: now - 60_000, value: 40 },
- { timestamp: now, value: 45 },
- ],
- disk: [
- { timestamp: now - 60_000, value: 35 },
- { timestamp: now, value: 40 },
- ],
- netin: [],
- netout: [],
- },
- },
- dockerHostData: {},
- agentData: {
- 'agent-host-4': {
- cpu: [],
- memory: [],
- disk: [],
- netin: [
- { timestamp: now - 60_000, value: 1024 },
- { timestamp: now, value: 2048 },
- ],
- netout: [
- { timestamp: now - 60_000, value: 512 },
- { timestamp: now, value: 1536 },
- ],
- },
- },
- timestamp: now,
- stats: {
- oldestDataTimestamp: now - 60_000,
- },
- });
-
- const proxmoxNodeHost: Resource = {
- id: 'node-1',
- type: 'agent',
- name: 'node-1',
- displayName: 'node-1',
- platformId: 'node-1',
- platformType: 'proxmox-pve',
- sourceType: 'api',
- status: 'online',
- lastSeen: now,
- platformData: {
- linkedAgentId: 'agent-host-4',
- },
- };
-
- const { container } = render(() => (
- <InfrastructureSummary resources={[proxmoxNodeHost]} timeRange="1h" />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
-
- await waitFor(() => {
- expect(container.querySelector('[data-testid="density-map"]')).toBeTruthy();
- });
- });
-
- it('matches loaded agent resources by shared identity aliases when names diverge', async () => {
- mockGetCharts.mockReset();
- const now = Date.now();
- mockGetCharts.mockResolvedValueOnce({
- nodeData: {
- 'node-2': {
- cpu: [
- { timestamp: now - 60_000, value: 20 },
- { timestamp: now, value: 25 },
- ],
- memory: [
- { timestamp: now - 60_000, value: 40 },
- { timestamp: now, value: 45 },
- ],
- disk: [
- { timestamp: now - 60_000, value: 35 },
- { timestamp: now, value: 40 },
- ],
- netin: [],
- netout: [],
- },
- },
- dockerHostData: {},
- agentData: {
- 'agent-host-5': {
- cpu: [],
- memory: [],
- disk: [],
- netin: [
- { timestamp: now - 60_000, value: 1024 },
- { timestamp: now, value: 2048 },
- ],
- netout: [
- { timestamp: now - 60_000, value: 512 },
- { timestamp: now, value: 1536 },
- ],
- },
- },
- timestamp: now,
- stats: {
- oldestDataTimestamp: now - 60_000,
- },
- });
-
- mockHostAgentResources = [
- {
- id: 'hash-agent-resource',
- type: 'agent',
- name: 'unhelpful-internal-name',
- displayName: 'Merged Host',
- platformId: 'internal-platform-id',
- platformType: 'agent',
- sourceType: 'agent',
- status: 'online',
- lastSeen: now,
- platformData: {
- agent: {
- agentId: 'agent-host-5',
- hostname: 'tower.local',
- },
- },
- },
- ];
-
- const proxmoxNodeHost: Resource = {
- id: 'node-2',
- type: 'agent',
- name: 'pve-node-2',
- displayName: 'PVE Node 2',
- platformId: 'pve-node-2',
- platformType: 'proxmox-pve',
- sourceType: 'api',
- status: 'online',
- lastSeen: now,
- identity: {
- hostname: 'tower.local',
- },
- platformData: {
- sources: ['proxmox'],
- },
- };
-
- const { container } = render(() => (
- <InfrastructureSummary
- resources={[proxmoxNodeHost, ...mockHostAgentResources]}
- timeRange="1h"
- />
- ));
-
- await waitFor(() => {
- expect(mockGetCharts).toHaveBeenCalledWith('1h', undefined, expect.any(Object));
- });
-
- await waitFor(() => {
- expect(container.querySelector('[data-testid="density-map"]')).toBeTruthy();
- });
- });
-});
diff --git a/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx b/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx
deleted file mode 100644
index 2b84aee453..0000000000
--- a/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx
+++ /dev/null
@@ -1,290 +0,0 @@
-import type { Component } from 'solid-js';
-import { Show } from 'solid-js';
-import { Card } from '@/components/shared/Card';
-import { AnimatedNumber } from '@/components/shared/AnimatedNumber';
-import { InteractiveSparkline } from '@/components/shared/InteractiveSparkline';
-import { DensityMap } from '@/components/shared/DensityMap';
-import { SummaryJumpToRowButton } from '@/components/shared/SummaryJumpToRowButton';
-import { SummaryPanel } from '@/components/shared/SummaryPanel';
-import { SummaryMetricCard } from '@/components/shared/SummaryMetricCard';
-import { SummarySynchronizedReadout } from '@/components/shared/SummarySynchronizedReadout';
-import { buildDensityMapSynchronizedReadout } from '@/components/shared/densityMapModel';
-import { buildInteractiveSparklineSynchronizedReadout } from '@/components/shared/interactiveSparklineModel';
-import { formatThroughputRate } from '@/utils/throughputPresentation';
-import { formatPercent } from '@/utils/format';
-import type { InfrastructureSummaryProps } from './infrastructureSummaryModel';
-import { useInfrastructureSummaryState } from './useInfrastructureSummaryState';
-
-export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (props) => {
- const state = useInfrastructureSummaryState(props);
-
- const rangeLabel = () => props.timeRange || '1h';
-
- const focusedLabel = () => {
- const name = state.focusedResourceName();
- if (!name) return undefined;
- return <span class="text-xs text-muted ml-1.5 truncate">&mdash; {name}</span>;
- };
- const renderSyncedReadout = (
- readout: { empty?: boolean; timestamp: number; value: string } | null,
- ) =>
- readout ? (
- <SummarySynchronizedReadout
- empty={readout.empty}
- timestamp={readout.timestamp}
- value={readout.value}
- />
- ) : undefined;
- const cpuSyncedReadout = () =>
- buildInteractiveSparklineSynchronizedReadout({
- hoverSourceKey: 'cpu',
- hoverSync: state.chartHoverSync(),
- series: state.seriesFor('cpu'),
- timeRange: props.timeRange,
- });
- const memorySyncedReadout = () =>
- buildInteractiveSparklineSynchronizedReadout({
- hoverSourceKey: 'memory',
- hoverSync: state.chartHoverSync(),
- series: state.seriesFor('memory'),
- timeRange: props.timeRange,
- });
- const diskIOSyncedReadout = () =>
- buildDensityMapSynchronizedReadout({
- emptyValue: 'No sample',
- formatValue: formatThroughputRate,
- hoverSourceKey: 'diskio',
- hoverSync: state.chartHoverSync(),
- series: state.diskioSeries(),
- timeRange: props.timeRange,
- });
- const networkSyncedReadout = () =>
- buildDensityMapSynchronizedReadout({
- emptyValue: 'No sample',
- formatValue: formatThroughputRate,
- hoverSourceKey: 'network',
- hoverSync: state.chartHoverSync(),
- series: state.networkSeries(),
- timeRange: props.timeRange,
- });
- const diskIOHeaderValue = () => {
- const synced = renderSyncedReadout(diskIOSyncedReadout());
- if (synced) {
- return synced;
- }
- if (!state.focusedResourceName() && state.avgDiskCapacity() !== null) {
- return (
- <span class="text-[10px] text-muted shrink-0">
- Capacity: <AnimatedNumber value={state.avgDiskCapacity() ?? 0} format={formatPercent} />
- </span>
- );
- }
- return undefined;
- };
-
- return (
- <Show when={props.resources.length > 0}>
- <div class="space-y-2">
- <SummaryPanel
- testId="infrastructure-summary"
- headerLeft={
- <>
- <span class="font-medium text-base-content">
- <AnimatedNumber value={state.resourceCounts().total} />{' '}
- {state.resourceCounts().total === 1 ? 'system' : 'systems'}
- </span>
- <Show
- when={
- state.resourceCounts().offline > 0 ||
- state.resourceCounts().degraded > 0 ||
- state.resourceCounts().alerting > 0
- }
- fallback={
- <Show when={state.resourceCounts().online > 0}>
- <span class="text-emerald-600 dark:text-emerald-400">all online</span>
- </Show>
- }
- >
- <Show when={state.resourceCounts().offline > 0}>
- <span class="text-red-600 dark:text-red-400">
- <AnimatedNumber value={state.resourceCounts().offline} /> offline
- </span>
- </Show>
- <Show when={state.resourceCounts().degraded > 0}>
- <span class="text-amber-600 dark:text-amber-400">
- <AnimatedNumber value={state.resourceCounts().degraded} /> degraded
- </span>
- </Show>
- <Show when={state.resourceCounts().alerting > 0}>
- <span class="text-amber-600 dark:text-amber-400">
- <AnimatedNumber value={state.resourceCounts().alerting} /> alerting
- </span>
- </Show>
- </Show>
- <Show when={props.showJumpToActiveRow && props.onJumpToActiveRow}>
- <SummaryJumpToRowButton onClick={() => props.onJumpToActiveRow?.()} />
- </Show>
- </>
- }
- timeRange={state.selectedRange()}
- onTimeRangeChange={props.onTimeRangeChange}
- >
- <SummaryMetricCard
- label="CPU"
- secondaryLabel={focusedLabel()}
- headerValue={renderSyncedReadout(cpuSyncedReadout())}
- loaded={state.isCurrentRangeLoaded()}
- hasData={state.hasData('cpu')}
- emptyMessage={state.emptyMessage()}
- interactionState={state.interactionStateFor(state.seriesFor('cpu'))}
- >
- <InteractiveSparkline
- series={state.seriesFor('cpu')}
- rangeLabel={rangeLabel()}
- timeRange={props.timeRange}
- activeSeriesDisplay="isolate"
- yMode="percent"
- highlightNearestSeriesOnHover
- hoverSourceKey="cpu"
- hoverSync={state.chartHoverSync()}
- highlightSeriesId={state.activeSeriesId()}
- interactionState={state.interactionStateFor(state.seriesFor('cpu'))}
- onHoverSyncChange={state.setChartHoverSync}
- />
- </SummaryMetricCard>
-
- <SummaryMetricCard
- label="Memory"
- secondaryLabel={focusedLabel()}
- headerValue={renderSyncedReadout(memorySyncedReadout())}
- loaded={state.isCurrentRangeLoaded()}
- hasData={state.hasData('memory')}
- emptyMessage={state.emptyMessage()}
- interactionState={state.interactionStateFor(state.seriesFor('memory'))}
- >
- <InteractiveSparkline
- series={state.seriesFor('memory')}
- rangeLabel={rangeLabel()}
- timeRange={props.timeRange}
- activeSeriesDisplay="isolate"
- yMode="percent"
- highlightNearestSeriesOnHover
- hoverSourceKey="memory"
- hoverSync={state.chartHoverSync()}
- highlightSeriesId={state.activeSeriesId()}
- interactionState={state.interactionStateFor(state.seriesFor('memory'))}
- onHoverSyncChange={state.setChartHoverSync}
- />
- </SummaryMetricCard>
-
- <SummaryMetricCard
- label="Disk I/O"
- secondaryLabel={focusedLabel()}
- headerValue={diskIOHeaderValue()}
- loaded={state.isCurrentRangeLoaded()}
- hasData={state.hasDiskIOData()}
- emptyMessage={state.emptyMessage()}
- interactionState={state.interactionStateFor(state.diskioSeries())}
- >
- <DensityMap
- series={state.diskioSeries()}
- rangeLabel={rangeLabel()}
- timeRange={props.timeRange}
- formatValue={formatThroughputRate}
- focusEmptyStateLabel="No disk activity in range"
- hoverSourceKey="diskio"
- hoverSync={state.chartHoverSync()}
- highlightSeriesId={state.activeSeriesId()}
- interactionState={state.interactionStateFor(state.diskioSeries())}
- onHoverSyncChange={state.setChartHoverSync}
- />
- </SummaryMetricCard>
-
- <Show
- when={state.shouldShowNetworkCard()}
- fallback={
- <Card padding="sm" class="h-full">
- <div class="flex flex-col h-full">
- <div class="flex items-center justify-between mb-1.5">
- <span class="text-xs font-medium text-muted uppercase tracking-wide">
- Workloads
- </span>
- <svg
- class="w-4 h-4 text-green-500"
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- stroke-width="1.5"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- d="M6 6.878V6a2.25 2.25 0 012.25-2.25h7.5A2.25 2.25 0 0118 6v.878m-12 0c.235-.083.487-.128.75-.128h10.5c.263 0 .515.045.75.128m-12 0A2.25 2.25 0 004.5 9v.878m13.5-3A2.25 2.25 0 0119.5 9v.878m0 0a2.246 2.246 0 00-.75-.128H5.25c-.263 0-.515.045-.75.128m15 0A2.25 2.25 0 0121 12v6a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 18v-6c0-.98.626-1.813 1.5-2.122"
- />
- </svg>
- </div>
- <div class="text-xl sm:text-2xl font-bold text-base-content">
- <AnimatedNumber value={state.workloadStats().running} />
- <span class="text-sm font-normal text-muted ml-1">running</span>
- </div>
- <Show
- when={state.workloadStats().total > 0}
- fallback={<div class="text-[10px] text-muted mt-1">No workloads detected</div>}
- >
- <div class="text-[10px] text-muted mt-1">
- <Show when={state.workloadStats().vms > 0}>
- <span>
- <AnimatedNumber value={state.workloadStats().vms} /> VMs
- </span>
- </Show>
- <Show
- when={state.workloadStats().vms > 0 && state.workloadStats().containers > 0}
- >
- <span class="mx-0.5">&middot;</span>
- </Show>
- <Show when={state.workloadStats().containers > 0}>
- <span>
- <AnimatedNumber value={state.workloadStats().containers} /> containers
- </span>
- </Show>
- </div>
- <Show when={state.workloadStats().stopped > 0}>
- <div class="text-[10px] text-muted">
- <AnimatedNumber value={state.workloadStats().stopped} /> stopped
- </div>
- </Show>
- </Show>
- </div>
- </Card>
- }
- >
- <SummaryMetricCard
- label="Network"
- secondaryLabel={focusedLabel()}
- headerValue={renderSyncedReadout(networkSyncedReadout())}
- loaded={state.isCurrentRangeLoaded()}
- hasData={state.hasNetData()}
- emptyMessage={state.emptyHistoryLabel()}
- interactionState={state.interactionStateFor(state.networkSeries())}
- >
- <DensityMap
- series={state.networkSeries()}
- rangeLabel={rangeLabel()}
- timeRange={props.timeRange}
- formatValue={formatThroughputRate}
- focusEmptyStateLabel="No network activity in range"
- hoverSourceKey="network"
- hoverSync={state.chartHoverSync()}
- highlightSeriesId={state.activeSeriesId()}
- interactionState={state.interactionStateFor(state.networkSeries())}
- onHoverSyncChange={state.setChartHoverSync}
- />
- </SummaryMetricCard>
- </Show>
- </SummaryPanel>
- </div>
- </Show>
- );
-};
-
-export default InfrastructureSummary;
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
index 6ff63f807b..866d0c74f0 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
@@ -12,7 +12,6 @@ import unifiedResourceTableStateSource from '@/components/Infrastructure/useUnif
import unifiedResourceTableViewportSyncSource from '@/components/Infrastructure/useUnifiedResourceTableViewportSync.ts?raw';
import unifiedResourceTableModelSource from '@/components/Infrastructure/unifiedResourceTableModel.ts?raw';
import unifiedResourceTableStateModelSource from '@/components/Infrastructure/unifiedResourceTableStateModel.ts?raw';
-import infrastructureSummarySource from '@/components/Infrastructure/InfrastructureSummary.tsx?raw';
import infrastructureSummaryStateSource from '@/components/Infrastructure/useInfrastructureSummaryState.ts?raw';
import infrastructureSummaryModelSource from '@/components/Infrastructure/infrastructureSummaryModel.ts?raw';
import unifiedResourceHostTableCardSource from '@/components/Infrastructure/UnifiedResourceHostTableCard.tsx?raw';
@@ -602,11 +601,6 @@ describe('UnifiedResourceTable performance contract', () => {
});
it('keeps infrastructure summary fetch runtime out of the render shell', () => {
- expect(infrastructureSummarySource).toContain('useInfrastructureSummaryState');
- expect(infrastructureSummarySource).not.toContain('fetchInfrastructureSummaryAndCache');
- expect(infrastructureSummarySource).not.toContain('readInfrastructureSummaryCache');
- expect(infrastructureSummarySource).not.toContain('setInterval(');
- expect(infrastructureSummarySource).not.toContain('AbortController');
expect(infrastructureSummaryStateSource).toContain('fetchInfrastructureSummaryAndCache');
expect(infrastructureSummaryStateSource).toContain('readInfrastructureSummaryCache');
expect(infrastructureSummaryStateSource).toContain('setInterval(');
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts
deleted file mode 100644
index d5ea0d41e1..0000000000
--- a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts
+++ /dev/null
@@ -1,379 +0,0 @@
-import { describe, expect, it } from 'vitest';
-import useInfrastructureSummaryStateSource from '../useInfrastructureSummaryState.ts?raw';
-
-import type { Resource } from '@/types/resource';
-import type { InfrastructureSummarySeries } from '@/components/Infrastructure/infrastructureSummaryModel';
-import { buildInfrastructureSummaryGroupScope } from '@/components/Infrastructure/infrastructureSelectors';
-import { buildDensityMapSynchronizedReadout } from '@/components/shared/densityMapModel';
-import { buildInteractiveSparklineSynchronizedReadout } from '@/components/shared/interactiveSparklineModel';
-import { resolveSummaryActiveSeriesId } from '@/components/shared/summaryCardInteraction';
-import {
- buildInfrastructureDisplaySeries,
- buildInfrastructureEmptyHistoryLabel,
- buildInfrastructureEmptyMessage,
- buildInfrastructureMetricSeries,
- buildInfrastructureResourceCounts,
- getFocusedInfrastructureResourceName,
- getSingleDisplayedOnlineInfrastructureResource,
- hasInfrastructureSeriesData,
- isInfrastructureAwaitingFirstSample,
- shouldShowInfrastructureNetworkCard,
-} from '@/components/Infrastructure/infrastructureSummaryModel';
-
-const makeSeries = (id: string, overrides: Partial<InfrastructureSummarySeries> = {}): InfrastructureSummarySeries => ({
- key: id,
- id,
- cpu: [],
- memory: [],
- disk: [],
- netin: [],
- netout: [],
- network: [],
- diskio: [],
- color: '#00aaff',
- name: id,
- ...overrides,
-});
-
-const makeResource = (overrides: Partial<Resource> = {}): Resource => ({
- id: 'resource-1',
- type: 'agent',
- name: 'host-1',
- displayName: 'Host 1',
- platformId: 'host-1',
- platformType: 'agent',
- sourceType: 'hybrid',
- status: 'online',
- lastSeen: 1_000,
- platformData: { sources: ['agent'] },
- ...overrides,
-});
-
-describe('infrastructureSummaryModel', () => {
- it('focuses the display series and focused label through the canonical model owner', () => {
- const allSeries = [makeSeries('host-1', { name: 'Host 1' }), makeSeries('host-2', { name: 'Host 2' })];
-
- expect(buildInfrastructureDisplaySeries(allSeries, 'host-2')).toEqual([
- makeSeries('host-2', { name: 'Host 2' }),
- ]);
- expect(buildInfrastructureDisplaySeries(allSeries, 'missing')).toEqual(allSeries);
- expect(getFocusedInfrastructureResourceName(allSeries, 'host-1')).toBe('Host 1');
- expect(getFocusedInfrastructureResourceName(allSeries, 'missing')).toBeNull();
- });
-
- it('allows page-scoped display series while still resolving the focused label canonically', () => {
- const allSeries = [makeSeries('host-1', { name: 'Host 1' }), makeSeries('host-2', { name: 'Host 2' })];
-
- expect(buildInfrastructureDisplaySeries(allSeries, null)).toEqual(allSeries);
- expect(getFocusedInfrastructureResourceName(allSeries, 'host-2')).toBe('Host 2');
- });
-
- it('keeps page-scoped metric series on canonical resource ids while focused highlight resolves separately', () => {
- const allSeries = [
- makeSeries('host-1', {
- name: 'Host 1',
- cpu: [{ timestamp: 1, value: 20 }],
- }),
- makeSeries('host-2', {
- name: 'Host 2',
- cpu: [{ timestamp: 2, value: 40 }],
- }),
- ];
-
- expect(buildInfrastructureMetricSeries(buildInfrastructureDisplaySeries(allSeries, null), 'cpu')).toEqual([
- { id: 'host-1', data: [{ timestamp: 1, value: 20 }], color: '#00aaff', name: 'Host 1' },
- { id: 'host-2', data: [{ timestamp: 2, value: 40 }], color: '#00aaff', name: 'Host 2' },
- ]);
- expect(
- resolveSummaryActiveSeriesId({
- hoveredSeriesId: null,
- focusedSeriesId: 'host-2',
- }),
- ).toBe('host-2');
- });
-
- it('keeps first-sample waiting logic on canonical summary inputs', () => {
- const onlineResource = makeResource({ lastSeen: 5_000 });
-
- expect(
- getSingleDisplayedOnlineInfrastructureResource([onlineResource], [makeSeries('resource-1')]),
- ).toEqual(onlineResource);
- expect(
- getSingleDisplayedOnlineInfrastructureResource(
- [makeResource({ status: 'offline' })],
- [makeSeries('resource-1')],
- ),
- ).toBeNull();
-
- expect(
- isInfrastructureAwaitingFirstSample({
- resource: onlineResource,
- isCurrentRangeLoaded: true,
- fetchFailed: false,
- oldestDataTimestamp: null,
- }),
- ).toBe(true);
- expect(
- isInfrastructureAwaitingFirstSample({
- resource: onlineResource,
- isCurrentRangeLoaded: true,
- fetchFailed: false,
- oldestDataTimestamp: 4_000,
- }),
- ).toBe(true);
- expect(
- isInfrastructureAwaitingFirstSample({
- resource: onlineResource,
- isCurrentRangeLoaded: true,
- fetchFailed: true,
- oldestDataTimestamp: 4_000,
- }),
- ).toBe(false);
- });
-
- it('resolves the single displayed online resource from the filtered summary series instead of full page cardinality', () => {
- const onlineResource = makeResource({ id: 'resource-1', lastSeen: 5_000 });
- const secondResource = makeResource({ id: 'resource-2', displayName: 'Host 2' });
-
- expect(
- getSingleDisplayedOnlineInfrastructureResource(
- [onlineResource, secondResource],
- [makeSeries('resource-1', { name: 'Host 1' })],
- ),
- ).toEqual(onlineResource);
- });
-
- it('builds metric series, data checks, and empty-state copy canonically', () => {
- const series = [
- makeSeries('host-1', {
- cpu: [{ timestamp: 1, value: 20 }],
- network: [{ timestamp: 1, value: 300 }],
- }),
- makeSeries('host-2'),
- ];
-
- expect(buildInfrastructureMetricSeries(series, 'cpu')).toEqual([
- { id: 'host-1', data: [{ timestamp: 1, value: 20 }], color: '#00aaff', name: 'host-1' },
- { id: 'host-2', data: [], color: '#00aaff', name: 'host-2' },
- ]);
- expect(hasInfrastructureSeriesData(series, 'network')).toBe(true);
- expect(hasInfrastructureSeriesData(series, 'diskio')).toBe(false);
- expect(buildInfrastructureEmptyHistoryLabel(true)).toBe('Gathering first sample…');
- expect(buildInfrastructureEmptyHistoryLabel(false)).toBe('Building trend history…');
- expect(buildInfrastructureEmptyMessage(true, 'Building trend history…')).toBe('Trend data unavailable');
- expect(buildInfrastructureEmptyMessage(false, 'Building trend history…')).toBe('Building trend history…');
- });
-
- it('keeps network and diskio series on canonical ids when focused summary selection narrows the view', () => {
- const displayedSeries = buildInfrastructureDisplaySeries(
- [
- makeSeries('host-1', {
- name: 'Host 1',
- network: [{ timestamp: 1, value: 120 }],
- diskio: [{ timestamp: 1, value: 45 }],
- }),
- makeSeries('host-2', {
- name: 'Host 2',
- network: [{ timestamp: 2, value: 240 }],
- diskio: [{ timestamp: 2, value: 90 }],
- }),
- ],
- 'host-2',
- );
-
- expect(buildInfrastructureMetricSeries(displayedSeries, 'network')).toEqual([
- { id: 'host-2', data: [{ timestamp: 2, value: 240 }], color: '#00aaff', name: 'Host 2' },
- ]);
- expect(buildInfrastructureMetricSeries(displayedSeries, 'diskio')).toEqual([
- { id: 'host-2', data: [{ timestamp: 2, value: 90 }], color: '#00aaff', name: 'Host 2' },
- ]);
- });
-
- it('keeps the same canonical resource id on empty metric series so shared hover can stay page-scoped', () => {
- const displayedSeries = buildInfrastructureDisplaySeries(
- [
- makeSeries('host-1', {
- name: 'Host 1',
- cpu: [{ timestamp: 1, value: 20 }],
- memory: [{ timestamp: 1, value: 35 }],
- network: [],
- diskio: [],
- }),
- makeSeries('host-2', {
- name: 'Host 2',
- cpu: [{ timestamp: 2, value: 40 }],
- memory: [{ timestamp: 2, value: 55 }],
- network: [{ timestamp: 2, value: 240 }],
- diskio: [{ timestamp: 2, value: 90 }],
- }),
- ],
- null,
- );
-
- expect(buildInfrastructureMetricSeries(displayedSeries, 'network')).toEqual([
- { id: 'host-1', data: [], color: '#00aaff', name: 'Host 1' },
- { id: 'host-2', data: [{ timestamp: 2, value: 240 }], color: '#00aaff', name: 'Host 2' },
- ]);
- expect(buildInfrastructureMetricSeries(displayedSeries, 'diskio')).toEqual([
- { id: 'host-1', data: [], color: '#00aaff', name: 'Host 1' },
- { id: 'host-2', data: [{ timestamp: 2, value: 90 }], color: '#00aaff', name: 'Host 2' },
- ]);
- });
-
- it('uses one canonical active series id across hover and focused summary selection', () => {
- expect(
- resolveSummaryActiveSeriesId({
- chartHoveredSeriesId: 'agent-3',
- hoveredSeriesId: 'agent-1',
- focusedSeriesId: 'agent-2',
- }),
- ).toBe('agent-3');
- expect(
- resolveSummaryActiveSeriesId({
- hoveredSeriesId: 'agent-1',
- focusedSeriesId: 'agent-2',
- }),
- ).toBe('agent-1');
- expect(
- resolveSummaryActiveSeriesId({
- hoveredSeriesId: null,
- focusedSeriesId: 'agent-2',
- }),
- ).toBe('agent-2');
- });
-
- it('keeps infrastructure cluster scope separate from active entity selection', () => {
- const clusterScope = buildInfrastructureSummaryGroupScope({
- cluster: 'cluster-a',
- resources: [makeResource({ id: 'agent-1' }), makeResource({ id: 'agent-2' })],
- });
-
- expect(
- resolveSummaryActiveSeriesId({
- hoveredSeriesId: 'agent-3',
- groupScope: clusterScope,
- }),
- ).toBeNull();
- expect(
- resolveSummaryActiveSeriesId({
- hoveredSeriesId: 'agent-2',
- groupScope: clusterScope,
- }),
- ).toBe('agent-2');
- });
-
- it('builds sibling synchronized readouts from canonical infrastructure series without duplicating the source tooltip', () => {
- const displayedSeries = buildInfrastructureDisplaySeries(
- [
- makeSeries('host-1', {
- name: 'Host 1',
- cpu: [{ timestamp: Date.now() - 45_000, value: 20 }],
- memory: [{ timestamp: Date.now() - 45_000, value: 35 }],
- network: [],
- diskio: [],
- }),
- makeSeries('host-2', {
- name: 'Host 2',
- cpu: [{ timestamp: Date.now() - 30_000, value: 40 }],
- memory: [{ timestamp: Date.now() - 30_000, value: 55 }],
- network: [{ timestamp: Date.now() - 30_000, value: 240 }],
- diskio: [{ timestamp: Date.now() - 30_000, value: 90 }],
- }),
- ],
- null,
- );
- const hoverSync = {
- sourceKey: 'cpu',
- seriesId: 'host-2',
- timestamp: Date.now() - 30_000,
- };
-
- expect(
- buildInteractiveSparklineSynchronizedReadout({
- hoverSourceKey: 'cpu',
- hoverSync,
- series: buildInfrastructureMetricSeries(displayedSeries, 'cpu'),
- timeRange: '1h',
- }),
- ).toBeNull();
- expect(
- buildInteractiveSparklineSynchronizedReadout({
- hoverSourceKey: 'memory',
- hoverSync,
- series: buildInfrastructureMetricSeries(displayedSeries, 'memory'),
- timeRange: '1h',
- }),
- ).toMatchObject({ value: '55.0%' });
- expect(
- buildDensityMapSynchronizedReadout({
- hoverSourceKey: 'diskio',
- hoverSync,
- series: buildInfrastructureMetricSeries(displayedSeries, 'diskio'),
- timeRange: '1h',
- }),
- ).toMatchObject({ value: '90.0' });
- expect(
- buildDensityMapSynchronizedReadout({
- hoverSourceKey: 'network',
- hoverSync,
- series: buildInfrastructureMetricSeries(displayedSeries, 'network'),
- timeRange: '1h',
- }),
- ).toMatchObject({ value: '240.0' });
- });
-
- it('shows the network card when either data or network capability exists', () => {
- expect(
- shouldShowInfrastructureNetworkCard(false, [
- makeResource({
- type: 'vm',
- platformType: 'proxmox-pve',
- network: { rxBytes: 10, txBytes: 0 },
- }),
- ]),
- ).toBe(true);
- expect(shouldShowInfrastructureNetworkCard(true, [makeResource()])).toBe(true);
- expect(
- shouldShowInfrastructureNetworkCard(false, [
- makeResource({
- type: 'vm',
- platformType: 'proxmox-pve',
- network: { rxBytes: 0, txBytes: 0 },
- platformData: { sources: ['proxmox'] },
- }),
- ]),
- ).toBe(false);
- });
-
- it('versions same-tab infrastructure summary cache keys', () => {
- expect(useInfrastructureSummaryStateSource).toContain(
- 'const INFRA_SUMMARY_IN_MEMORY_CACHE_VERSION = 1;',
- );
- expect(useInfrastructureSummaryStateSource).toContain(
- 'return `${INFRA_SUMMARY_IN_MEMORY_CACHE_VERSION}::${normalizeOrgScope(getOrgID())}::${range}`;',
- );
- expect(useInfrastructureSummaryStateSource).toContain('hoveredGroupScope');
- expect(useInfrastructureSummaryStateSource).toContain('filterSeriesForActiveScope');
- });
-
- it('buildInfrastructureResourceCounts separates online, alerting, degraded, and offline', () => {
- const resources = [
- makeResource({ id: 'r1', status: 'online' }),
- makeResource({ id: 'r2', status: 'online', alerts: [{ id: 'a1' } as never] }),
- makeResource({ id: 'r3', status: 'degraded' }),
- makeResource({ id: 'r4', status: 'offline' }),
- ];
- const counts = buildInfrastructureResourceCounts(resources);
- expect(counts).toEqual({ total: 4, online: 1, alerting: 1, degraded: 1, offline: 1 });
- });
-
- it('buildInfrastructureResourceCounts returns zero counts for empty input', () => {
- expect(buildInfrastructureResourceCounts([])).toEqual({
- total: 0,
- online: 0,
- alerting: 0,
- degraded: 0,
- offline: 0,
- });
- });
-});
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/useInfrastructureSummaryState.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/useInfrastructureSummaryState.test.tsx
deleted file mode 100644
index ca75d3e6da..0000000000
--- a/frontend-modern/src/components/Infrastructure/__tests__/useInfrastructureSummaryState.test.tsx
+++ /dev/null
@@ -1,125 +0,0 @@
-import { renderHook, waitFor } from '@solidjs/testing-library';
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-
-import type { Resource } from '@/types/resource';
-
-import {
- __resetInMemoryChartCacheForTests,
- useInfrastructureSummaryState,
-} from '../useInfrastructureSummaryState';
-
-const {
- mockFetchInfrastructureSummaryAndCache,
- mockReadInfrastructureSummaryCache,
-} = vi.hoisted(() => ({
- mockFetchInfrastructureSummaryAndCache: vi.fn(),
- mockReadInfrastructureSummaryCache: vi.fn(() => null),
-}));
-
-vi.mock('@/utils/infrastructureSummaryCache', () => ({
- fetchInfrastructureSummaryAndCache: mockFetchInfrastructureSummaryAndCache,
- readInfrastructureSummaryCache: mockReadInfrastructureSummaryCache,
-}));
-
-vi.mock('@/utils/apiClient', async () => {
- const actual = await vi.importActual<typeof import('@/utils/apiClient')>('@/utils/apiClient');
- return {
- ...actual,
- getOrgID: () => 'default',
- };
-});
-
-const now = Date.now();
-const twoPointSeries = [
- { timestamp: now - 60_000, value: 12 },
- { timestamp: now, value: 18 },
-];
-
-const makeResource = (id: string, name: string): Resource =>
- ({
- id,
- type: 'agent',
- name,
- displayName: name,
- platformId: id,
- platformType: 'agent',
- sourceType: 'hybrid',
- status: 'online',
- lastSeen: now,
- platformData: { sources: ['agent'] },
- }) as Resource;
-
-describe('useInfrastructureSummaryState', () => {
- beforeEach(() => {
- mockFetchInfrastructureSummaryAndCache.mockReset();
- mockReadInfrastructureSummaryCache.mockReset();
- mockReadInfrastructureSummaryCache.mockReturnValue(null);
- __resetInMemoryChartCacheForTests();
- localStorage.clear();
- });
-
- afterEach(() => {
- vi.clearAllMocks();
- });
-
- it('keeps infrastructure summaries page-scoped when a focused resource is selected', async () => {
- mockFetchInfrastructureSummaryAndCache.mockResolvedValue({
- map: new Map([
- [
- 'host-1',
- {
- cpu: twoPointSeries,
- memory: twoPointSeries,
- disk: [],
- diskread: twoPointSeries,
- diskwrite: twoPointSeries,
- netin: twoPointSeries,
- netout: twoPointSeries,
- },
- ],
- [
- 'host-2',
- {
- cpu: twoPointSeries,
- memory: twoPointSeries,
- disk: [],
- diskread: twoPointSeries,
- diskwrite: twoPointSeries,
- netin: twoPointSeries,
- netout: twoPointSeries,
- },
- ],
- ]),
- oldestDataTimestamp: now - 60_000,
- });
-
- const resources = [makeResource('host-1', 'Host 1'), makeResource('host-2', 'Host 2')];
-
- const { result } = renderHook(() =>
- useInfrastructureSummaryState({
- resources,
- timeRange: '1h',
- focusedResourceId: 'host-1',
- }),
- );
-
- await waitFor(() => {
- expect(result.effectiveFocusedResourceId()).toBe('host-1');
- expect(result.focusedResourceName()).toBe('Host 1');
- expect(result.seriesFor('cpu')).toHaveLength(2);
- expect(result.networkSeries()).toHaveLength(2);
- });
- expect(result.hasInteractiveResourceId('host-1')).toBe(true);
- });
-
- it('derives infrastructure and workload scope from the passed resource snapshot', async () => {
- const stateSource = await import('../useInfrastructureSummaryState.ts?raw');
-
- expect(stateSource.default).not.toContain('useResources(');
- expect(stateSource.default).toContain('props.resources.filter((resource) => isWorkload(resource))');
- expect(stateSource.default).toContain(
- 'props.resources.filter((resource) => isAgentFacetInfrastructureResource(resource))',
- );
- });
-
-});
diff --git a/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts b/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts
deleted file mode 100644
index 1afc3c2505..0000000000
--- a/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts
+++ /dev/null
@@ -1,385 +0,0 @@
-import type { ChartData, MetricPoint, TimeRange } from '@/api/charts';
-import {
- getActionableAgentIdFromResource,
- getMetricsChartKeyCandidatesFromResource,
- getPlatformAgentRecord,
- getPlatformDataRecord,
- hasAgentFacet,
-} from '@/utils/agentResources';
-import {
- getPreferredInfrastructureDisplayName,
- getPreferredResourceHostname,
- getResourceIdentityAliases,
- getNormalizedIdentityLookupVariants,
-} from '@/utils/resourceIdentity';
-import { asTrimmedString } from '@/utils/stringUtils';
-import { getChartSeriesColor } from '@/utils/chartSeriesPresentation';
-import type { Resource } from '@/types/resource';
-import { getDiskPercent } from '@/types/resource';
-import type { SummaryChartHoverSync } from '@/components/shared/contextualFocus';
-import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
-
-export interface InfrastructureSummaryProps {
- resources: Resource[];
- timeRange?: TimeRange;
- hoveredGroupScope?: SummarySeriesGroupScope | null;
- focusedGroupScope?: SummarySeriesGroupScope | null;
- hoveredResourceId?: string | null;
- focusedResourceId?: string | null;
- chartHoverSync?: SummaryChartHoverSync | null;
- onTimeRangeChange?: (range: TimeRange) => void;
- onChartHoverSyncChange?: (value: SummaryChartHoverSync | null) => void;
- showJumpToActiveRow?: boolean;
- onJumpToActiveRow?: () => void;
-}
-
-export interface InfrastructureSummarySeries {
- key: string;
- id: string;
- cpu: MetricPoint[];
- memory: MetricPoint[];
- disk: MetricPoint[];
- netin: MetricPoint[];
- netout: MetricPoint[];
- network: MetricPoint[];
- diskio: MetricPoint[];
- color: string;
- name: string;
-}
-
-export type InfrastructureSummarySparkMetric = 'cpu' | 'memory' | 'disk';
-
-export interface InfrastructureWorkloadStats {
- total: number;
- running: number;
- stopped: number;
- vms: number;
- containers: number;
-}
-
-export interface InfrastructureResourceCounts {
- total: number;
- online: number;
- offline: number;
- degraded: number;
- alerting: number;
-}
-
-export interface InfrastructureSummaryMetricSeriesEntry {
- id: string;
- data: MetricPoint[];
- color: string;
- name: string;
-}
-
-const getNormalizedResourceIdentifiers = (resource: Resource): Set<string> =>
- new Set<string>([
- ...getNormalizedIdentityLookupVariants(resource.id),
- ...getNormalizedIdentityLookupVariants(resource.platformId),
- ...getNormalizedIdentityLookupVariants(getPreferredInfrastructureDisplayName(resource)),
- ...getNormalizedIdentityLookupVariants(getPreferredResourceHostname(resource)),
- ...getResourceIdentityAliases(resource).flatMap((value) =>
- getNormalizedIdentityLookupVariants(value),
- ),
- ]);
-
-const getLinkedNodeIdFromResource = (resource: Resource): string | null =>
- asTrimmedString(getPlatformDataRecord(resource)?.linkedNodeId) ||
- asTrimmedString(getPlatformAgentRecord(resource)?.linkedNodeId) ||
- null;
-
-// Combine a resource's net in/out into a single throughput series.
-// Buckets points into 30-second windows and sums rates from both directions.
-export function combineResourceThroughputSeries(
- inSeries: MetricPoint[],
- outSeries: MetricPoint[],
-): MetricPoint[] {
- const bucketSize = 30_000; // 30 seconds
- const buckets = new Map<number, number>();
- for (const point of inSeries) {
- const bucket = Math.round(point.timestamp / bucketSize) * bucketSize;
- buckets.set(bucket, (buckets.get(bucket) || 0) + point.value);
- }
- for (const point of outSeries) {
- const bucket = Math.round(point.timestamp / bucketSize) * bucketSize;
- buckets.set(bucket, (buckets.get(bucket) || 0) + point.value);
- }
-
- return Array.from(buckets.entries())
- .sort((left, right) => left[0] - right[0])
- .map(([timestamp, value]) => ({ timestamp, value }));
-}
-
-export function findInfrastructureChartData(
- resource: Resource,
- chartMap: Map<string, ChartData>,
-): ChartData | undefined {
- if (chartMap.size === 0) return undefined;
-
- for (const key of getMetricsChartKeyCandidatesFromResource(resource)) {
- const match = chartMap.get(key);
- if (match) return match;
- }
-
- if (resource.clusterId && resource.platformId) {
- const clusterKey = `${resource.clusterId}-${resource.platformId}`;
- const clusterMatch = chartMap.get(clusterKey);
- if (clusterMatch) return clusterMatch;
- }
-
- const nameToMatch =
- getPreferredResourceHostname(resource) || resource.platformId || resource.name;
- if (nameToMatch) {
- const suffix = `-${nameToMatch}`;
- for (const [key, data] of chartMap) {
- if (key.endsWith(suffix)) return data;
- }
- }
-
- return undefined;
-}
-
-export function findInfrastructureAgentChartData(
- resource: Resource,
- chartMap: Map<string, ChartData>,
- agentFacetResources: Resource[],
-): ChartData | undefined {
- if (chartMap.size === 0) return undefined;
-
- const directAgentCandidates: string[] = [];
- const actionableAgentId = getActionableAgentIdFromResource(resource);
- if (actionableAgentId) {
- directAgentCandidates.push(actionableAgentId);
- }
- if (resource.platformType === 'agent') {
- const discoveryResourceId = asTrimmedString(resource.discoveryTarget?.resourceId);
- const discoveryHostId = asTrimmedString(resource.discoveryTarget?.agentId);
- if (discoveryResourceId) directAgentCandidates.push(discoveryResourceId);
- if (discoveryHostId) directAgentCandidates.push(discoveryHostId);
- }
-
- for (const key of Array.from(new Set(directAgentCandidates))) {
- const direct = chartMap.get(key);
- if (direct) return direct;
- }
-
- if (agentFacetResources.length === 0) return undefined;
-
- const nodeRefCandidates = new Set<string>(
- [resource.id, resource.platformId, getPreferredResourceHostname(resource)]
- .map((value) => value?.trim().toLowerCase())
- .filter((value): value is string => Boolean(value)),
- );
- const resourceNameCandidates = getNormalizedResourceIdentifiers(resource);
-
- for (const agentResource of agentFacetResources) {
- const linkedNodeId = getLinkedNodeIdFromResource(agentResource);
- const normalizedLinkedNodeId = linkedNodeId?.toLowerCase();
-
- const linkedMatch = normalizedLinkedNodeId
- ? nodeRefCandidates.has(normalizedLinkedNodeId)
- : false;
- const agentResourceNames = Array.from(getNormalizedResourceIdentifiers(agentResource));
- const hostnameMatch = agentResourceNames.some((candidate) =>
- resourceNameCandidates.has(candidate),
- );
-
- if (linkedMatch || hostnameMatch) {
- for (const key of getMetricsChartKeyCandidatesFromResource(agentResource)) {
- const agentData = chartMap.get(key);
- if (agentData) return agentData;
- }
- }
- }
- return undefined;
-}
-
-export function buildInfrastructureSummarySeries(
- resources: Resource[],
- chartMap: Map<string, ChartData>,
- agentFacetResources: Resource[],
-): InfrastructureSummarySeries[] {
- return resources.map((resource, index) => {
- const primaryData = findInfrastructureChartData(resource, chartMap);
- const agentData = findInfrastructureAgentChartData(resource, chartMap, agentFacetResources);
- const seriesId = resource.id || resource.platformId || resource.name || `resource-${index}`;
-
- const metricSeries = (metric: keyof ChartData): MetricPoint[] => {
- const primary = primaryData?.[metric];
- if (primary && primary.length > 0) return primary;
- const fallback = agentData?.[metric];
- if (fallback && fallback.length > 0) return fallback;
- return [];
- };
-
- return {
- key: seriesId,
- id: seriesId,
- cpu: metricSeries('cpu'),
- memory: metricSeries('memory'),
- disk: metricSeries('disk'),
- netin: metricSeries('netin'),
- netout: metricSeries('netout'),
- network: combineResourceThroughputSeries(metricSeries('netin'), metricSeries('netout')),
- diskio: combineResourceThroughputSeries(
- metricSeries('diskread'),
- metricSeries('diskwrite'),
- ),
- color: getChartSeriesColor(index),
- name: getPreferredInfrastructureDisplayName(resource),
- };
- });
-}
-
-export function buildInfrastructureDisplaySeries(
- allSeries: InfrastructureSummarySeries[],
- focusedResourceId?: string | null,
-): InfrastructureSummarySeries[] {
- if (!focusedResourceId) return allSeries;
- const match = allSeries.find((series) => series.id === focusedResourceId);
- return match ? [match] : allSeries;
-}
-
-export function getFocusedInfrastructureResourceName(
- allSeries: InfrastructureSummarySeries[],
- focusedResourceId?: string | null,
-): string | null {
- if (!focusedResourceId) return null;
- const match = allSeries.find((series) => series.id === focusedResourceId);
- return match?.name ?? null;
-}
-
-export function getSingleDisplayedOnlineInfrastructureResource(
- resources: Resource[],
- displaySeries: InfrastructureSummarySeries[],
-): Resource | null {
- if (displaySeries.length !== 1) return null;
- const [displayedSeries] = displaySeries;
- if (!displayedSeries) return null;
- const resource = resources.find((entry) => entry.id === displayedSeries.id);
- if (!resource) return null;
- return resource.status?.toLowerCase() === 'online' ? resource : null;
-}
-
-export function isInfrastructureAwaitingFirstSample(options: {
- resource: Resource | null;
- isCurrentRangeLoaded: boolean;
- fetchFailed: boolean;
- oldestDataTimestamp: number | null;
-}): boolean {
- if (
- !options.resource ||
- !options.isCurrentRangeLoaded ||
- options.fetchFailed
- ) {
- return false;
- }
-
- if (options.oldestDataTimestamp === null) {
- return true;
- }
-
- return options.resource.lastSeen >= options.oldestDataTimestamp;
-}
-
-export function buildInfrastructureEmptyHistoryLabel(isAwaitingFirstSample: boolean): string {
- return isAwaitingFirstSample ? 'Gathering first sample…' : 'Building trend history…';
-}
-
-export function buildInfrastructureEmptyMessage(
- fetchFailed: boolean,
- emptyHistoryLabel: string,
-): string {
- return fetchFailed ? 'Trend data unavailable' : emptyHistoryLabel;
-}
-
-export function buildInfrastructureMetricSeries(
- displaySeries: InfrastructureSummarySeries[],
- metric: InfrastructureSummarySparkMetric | 'network' | 'diskio',
-): InfrastructureSummaryMetricSeriesEntry[] {
- return displaySeries.map((series) => ({
- id: series.id,
- data: series[metric],
- color: series.color,
- name: series.name,
- }));
-}
-
-export function hasInfrastructureSeriesData(
- displaySeries: InfrastructureSummarySeries[],
- metric: InfrastructureSummarySparkMetric | 'network' | 'diskio',
-): boolean {
- return displaySeries.some((series) => series[metric].length >= 1);
-}
-
-export function buildInfrastructureWorkloadStats(
- workloads: Resource[],
-): InfrastructureWorkloadStats {
- let running = 0;
- let stopped = 0;
- let vms = 0;
- let containers = 0;
- for (const workload of workloads) {
- if (workload.status === 'running' || workload.status === 'online') {
- running++;
- } else {
- stopped++;
- }
- if (workload.type === 'vm') {
- vms++;
- } else {
- containers++;
- }
- }
- return { total: workloads.length, running, stopped, vms, containers };
-}
-
-export function buildInfrastructureResourceCounts(
- resources: Resource[],
-): InfrastructureResourceCounts {
- let total = 0;
- let online = 0;
- let offline = 0;
- let degraded = 0;
- let alerting = 0;
- for (const resource of resources) {
- total++;
- if (resource.status === 'online') {
- if ((resource.alerts?.length ?? 0) > 0) {
- alerting++;
- } else {
- online++;
- }
- } else if (resource.status === 'degraded') {
- degraded++;
- } else {
- offline++;
- }
- }
- return { total, online, offline, degraded, alerting };
-}
-
-export function getAverageDiskCapacity(resources: Resource[]): number | null {
- const diskResources = resources.filter((resource) => resource.disk && resource.disk.total);
- if (diskResources.length === 0) return null;
- const average =
- diskResources.reduce((sum, resource) => sum + getDiskPercent(resource), 0) /
- diskResources.length;
- return Math.round(average);
-}
-
-export function hasInfrastructureNetworkCapability(resources: Resource[]): boolean {
- return resources.some((resource) => {
- if (resource.type === 'docker-host' || hasAgentFacet(resource)) return true;
- const rx = resource.network?.rxBytes ?? 0;
- const tx = resource.network?.txBytes ?? 0;
- return rx > 0 || tx > 0;
- });
-}
-
-export function shouldShowInfrastructureNetworkCard(
- hasNetworkData: boolean,
- resources: Resource[],
-): boolean {
- return hasNetworkData || hasInfrastructureNetworkCapability(resources);
-}
diff --git a/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts b/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
deleted file mode 100644
index fc55a22cc8..0000000000
--- a/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
+++ /dev/null
@@ -1,347 +0,0 @@
-import { createEffect, createMemo, createSignal, onCleanup } from 'solid-js';
-import type { ChartData, TimeRange } from '@/api/charts';
-import { isWorkload } from '@/types/resource';
-import {
- useSummaryContextualFocusState,
- type SummaryChartHoverSync,
-} from '@/components/shared/contextualFocus';
-import {
- fetchInfrastructureSummaryAndCache,
- readInfrastructureSummaryCache,
-} from '@/utils/infrastructureSummaryCache';
-import { isAgentFacetInfrastructureResource } from '@/utils/agentResources';
-import { getOrgID } from '@/utils/apiClient';
-import { normalizeOrgScope } from '@/utils/orgScope';
-import { eventBus } from '@/stores/events';
-import {
- type InfrastructureSummaryProps,
- type InfrastructureSummarySparkMetric,
- buildInfrastructureDisplaySeries,
- buildInfrastructureEmptyHistoryLabel,
- buildInfrastructureEmptyMessage,
- buildInfrastructureMetricSeries,
- buildInfrastructureResourceCounts,
- buildInfrastructureSummarySeries,
- buildInfrastructureWorkloadStats,
- getAverageDiskCapacity,
- getSingleDisplayedOnlineInfrastructureResource,
- hasInfrastructureSeriesData,
- isInfrastructureAwaitingFirstSample,
- shouldShowInfrastructureNetworkCard,
-} from './infrastructureSummaryModel';
-
-// In-memory full-resolution cache keyed by "org::range".
-// Survives component unmount/remount (page navigation) without the
-// downsampling artifacts that localStorage cache introduces.
-// Capped at MAX_IN_MEMORY_INFRA_ENTRIES to prevent unbounded growth.
-const MAX_IN_MEMORY_INFRA_ENTRIES = 20;
-const INFRA_SUMMARY_IN_MEMORY_CACHE_VERSION = 1;
-const inMemoryChartCache = new Map<string, Map<string, ChartData>>();
-
-function inMemoryCacheKey(range: TimeRange): string {
- return `${INFRA_SUMMARY_IN_MEMORY_CACHE_VERSION}::${normalizeOrgScope(getOrgID())}::${range}`;
-}
-
-/** @internal Test-only reset for in-memory chart cache. */
-export function __resetInMemoryChartCacheForTests(): void {
- inMemoryChartCache.clear();
-}
-
-const unsubscribeInfraOrgSwitch = eventBus.on('org_switched', () => {
- inMemoryChartCache.clear();
-});
-
-if (import.meta.hot) {
- import.meta.hot.dispose(() => {
- unsubscribeInfraOrgSwitch();
- });
-}
-
-export function useInfrastructureSummaryState(props: InfrastructureSummaryProps) {
- const [chartMap, setChartMap] = createSignal<Map<string, ChartData>>(new Map());
- const [chartRange, setChartRange] = createSignal<TimeRange | null>(null);
- const [loadedRange, setLoadedRange] = createSignal<TimeRange | null>(null);
- const [oldestDataTimestamp, setOldestDataTimestamp] = createSignal<number | null>(null);
- const [fetchFailed, setFetchFailed] = createSignal(false);
- const [localChartHoverSync, setLocalChartHoverSync] = createSignal<SummaryChartHoverSync | null>(
- null,
- );
- const chartHoverSync = () => props.chartHoverSync ?? localChartHoverSync();
- const setChartHoverSync = (value: SummaryChartHoverSync | null) => {
- if (props.chartHoverSync === undefined) {
- setLocalChartHoverSync(value);
- }
- props.onChartHoverSyncChange?.(value);
- };
- const selectedRange = createMemo<TimeRange>(() => props.timeRange || '1h');
- const hasCurrentRangeCharts = createMemo(() => chartRange() === selectedRange());
- const isCurrentRangeLoaded = createMemo(() => loadedRange() === selectedRange());
- const agentResources = createMemo(() =>
- props.resources.filter((resource) => isAgentFacetInfrastructureResource(resource)),
- );
- const workloadResources = createMemo(() =>
- props.resources.filter((resource) => isWorkload(resource)),
- );
-
- const [orgVersion, setOrgVersion] = createSignal(0);
- const unsubscribeOrgSwitch = eventBus.on('org_switched', () => {
- setOrgVersion((value) => value + 1);
- });
-
- let refreshTimer: ReturnType<typeof setInterval> | undefined;
- let activeFetchController: AbortController | null = null;
- let activeFetchRequest = 0;
- let activeScopeKey: string | null = null;
-
- const awaitAbortable = <T>(promise: Promise<T>, signal: AbortSignal): Promise<T> => {
- if (signal.aborted) {
- return Promise.reject(new DOMException('Aborted', 'AbortError'));
- }
- return new Promise<T>((resolve, reject) => {
- const onAbort = () => {
- reject(new DOMException('Aborted', 'AbortError'));
- };
- signal.addEventListener('abort', onAbort, { once: true });
- promise.then(
- (value) => {
- signal.removeEventListener('abort', onAbort);
- resolve(value);
- },
- (error) => {
- signal.removeEventListener('abort', onAbort);
- reject(error);
- },
- );
- });
- };
-
- const fetchCharts = async (options?: { prioritize?: boolean }) => {
- if (props.resources.length === 0) {
- return;
- }
-
- const prioritize = options?.prioritize === true;
- if (activeFetchController && !prioritize) {
- return;
- }
- if (activeFetchController && prioritize) {
- activeFetchController.abort();
- }
-
- const requestedRange = selectedRange();
- const controller = new AbortController();
- const requestId = ++activeFetchRequest;
- activeFetchController = controller;
-
- try {
- const fetched = await awaitAbortable(
- fetchInfrastructureSummaryAndCache(requestedRange, { caller: 'InfrastructureSummary' }),
- controller.signal,
- );
- if (requestId !== activeFetchRequest) {
- return;
- }
- const fetchedMap = fetched.map;
- const currentMapMatchesRequestedRange = chartRange() === requestedRange;
- if (fetchedMap.size > 0 || chartMap().size === 0 || !currentMapMatchesRequestedRange) {
- const cacheKey = inMemoryCacheKey(requestedRange);
- if (
- !inMemoryChartCache.has(cacheKey) &&
- inMemoryChartCache.size >= MAX_IN_MEMORY_INFRA_ENTRIES
- ) {
- const oldest = inMemoryChartCache.keys().next().value;
- if (oldest !== undefined) inMemoryChartCache.delete(oldest);
- }
- inMemoryChartCache.set(cacheKey, fetchedMap);
- setChartMap(fetchedMap);
- setChartRange(requestedRange);
- }
- setOldestDataTimestamp(fetched.oldestDataTimestamp);
- setFetchFailed(false);
- } catch (error) {
- if (error instanceof Error && error.name === 'AbortError') {
- return;
- }
- if (requestId === activeFetchRequest) {
- setFetchFailed(true);
- if (chartRange() !== requestedRange) {
- const cached = readInfrastructureSummaryCache(requestedRange);
- if (cached) {
- setChartMap(cached.map);
- setChartRange(requestedRange);
- setOldestDataTimestamp(cached.oldestDataTimestamp);
- }
- }
- }
- } finally {
- if (activeFetchController === controller) {
- activeFetchController = null;
- }
- if (requestId === activeFetchRequest) {
- setLoadedRange(requestedRange);
- }
- }
- };
-
- createEffect(() => {
- const hasResources = props.resources.length > 0;
- const currentOrg = orgVersion();
- if (!hasResources) {
- if (refreshTimer) {
- clearInterval(refreshTimer);
- refreshTimer = undefined;
- }
- if (activeFetchController) {
- activeFetchController.abort();
- activeFetchController = null;
- }
- activeScopeKey = null;
- setChartMap(new Map());
- setChartRange(null);
- setLoadedRange(null);
- setOldestDataTimestamp(null);
- return;
- }
-
- if (!refreshTimer) {
- refreshTimer = setInterval(() => void fetchCharts(), 30_000);
- }
-
- const nextRange = selectedRange();
- const nextScopeKey = `${currentOrg}::${nextRange}`;
- if (activeScopeKey !== nextScopeKey) {
- activeScopeKey = nextScopeKey;
- const inMemoryCached = inMemoryChartCache.get(inMemoryCacheKey(nextRange));
- if (inMemoryCached && inMemoryCached.size > 0) {
- setChartMap(inMemoryCached);
- setChartRange(nextRange);
- setLoadedRange(nextRange);
- const cached = readInfrastructureSummaryCache(nextRange);
- setOldestDataTimestamp(cached?.oldestDataTimestamp ?? null);
- } else {
- setChartMap(new Map());
- setChartRange(null);
- setLoadedRange(null);
- setOldestDataTimestamp(null);
- }
- setFetchFailed(false);
- void fetchCharts({ prioritize: true });
- }
- });
-
- onCleanup(() => {
- if (refreshTimer) clearInterval(refreshTimer);
- if (activeFetchController) {
- activeFetchController.abort();
- activeFetchController = null;
- }
- unsubscribeOrgSwitch();
- });
-
- const resourceSeries = createMemo(() =>
- hasCurrentRangeCharts()
- ? buildInfrastructureSummarySeries(props.resources, chartMap(), agentResources())
- : buildInfrastructureSummarySeries(props.resources, new Map(), agentResources()),
- );
- const summaryFocus = useSummaryContextualFocusState({
- chartHoveredSeriesId: () => chartHoverSync()?.seriesId ?? null,
- interactiveSeries: resourceSeries,
- focusedGroupScope: () => props.focusedGroupScope,
- hoveredGroupScope: () => props.hoveredGroupScope,
- hoveredSeriesId: () => props.hoveredResourceId,
- focusedSeriesId: () => props.focusedResourceId,
- isSeriesInteractive: (series) =>
- series.cpu.length >= 1 ||
- series.memory.length >= 1 ||
- series.diskio.length >= 1 ||
- series.network.length >= 1,
- });
-
- const displaySeries = createMemo(() => {
- return summaryFocus.filterSeriesForActiveScope(
- buildInfrastructureDisplaySeries(resourceSeries(), null),
- );
- });
-
- const focusedResourceName = createMemo(() => {
- return summaryFocus.getActiveSeriesName(displaySeries());
- });
-
- createEffect(() => {
- const hovered = chartHoverSync();
- if (!hovered) return;
- if (!summaryFocus.isSeriesIdVisibleInActiveScope(hovered.seriesId)) {
- setChartHoverSync(null);
- }
- });
-
- const singleDisplayedOnlineResource = createMemo(() => {
- return getSingleDisplayedOnlineInfrastructureResource(props.resources, displaySeries());
- });
-
- const isAwaitingFirstSample = createMemo(() => {
- return isInfrastructureAwaitingFirstSample({
- resource: singleDisplayedOnlineResource(),
- isCurrentRangeLoaded: isCurrentRangeLoaded(),
- fetchFailed: fetchFailed(),
- oldestDataTimestamp: oldestDataTimestamp(),
- });
- });
-
- const emptyHistoryLabel = createMemo(() =>
- summaryFocus.activeGroupScope()
- ? 'No group history yet'
- : buildInfrastructureEmptyHistoryLabel(isAwaitingFirstSample()),
- );
-
- const hasData = (metric: InfrastructureSummarySparkMetric) =>
- hasInfrastructureSeriesData(displaySeries(), metric);
-
- const networkSeries = createMemo(() =>
- buildInfrastructureMetricSeries(displaySeries(), 'network'),
- );
-
- const hasNetData = createMemo(() => hasInfrastructureSeriesData(displaySeries(), 'network'));
-
- const diskioSeries = createMemo(() => buildInfrastructureMetricSeries(displaySeries(), 'diskio'));
-
- const hasDiskIOData = createMemo(() => hasInfrastructureSeriesData(displaySeries(), 'diskio'));
-
- const avgDiskCapacity = createMemo(() => getAverageDiskCapacity(props.resources));
- const shouldShowNetworkCard = createMemo(() =>
- shouldShowInfrastructureNetworkCard(hasNetData(), props.resources),
- );
- const workloadStats = createMemo(() => buildInfrastructureWorkloadStats(workloadResources()));
- const resourceCounts = createMemo(() => buildInfrastructureResourceCounts(props.resources));
- const emptyMessage = createMemo(() =>
- buildInfrastructureEmptyMessage(fetchFailed(), emptyHistoryLabel()),
- );
- const seriesFor = (metric: InfrastructureSummarySparkMetric) =>
- buildInfrastructureMetricSeries(displaySeries(), metric);
-
- return {
- selectedRange,
- chartHoverSync,
- isCurrentRangeLoaded,
- emptyHistoryLabel,
- emptyMessage,
- activeSeriesId: summaryFocus.activeSeriesId,
- setChartHoverSync,
- effectiveFocusedResourceId: summaryFocus.effectiveFocusedSeriesId,
- focusedResourceName,
- hasInteractiveResourceId: summaryFocus.hasInteractiveSeriesId,
- interactionStateFor: summaryFocus.interactionStateFor,
- resourceCounts,
- workloadStats,
- avgDiskCapacity,
- shouldShowNetworkCard,
- networkSeries,
- hasNetData,
- diskioSeries,
- hasDiskIOData,
- hasData,
- seriesFor,
- };
-}
-
-export type InfrastructureSummaryState = ReturnType<typeof useInfrastructureSummaryState>;
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index c4c26ecfea..fb28dc1bdb 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -32,7 +32,6 @@ import infrastructureDetailsDrawerSource from '@/components/shared/Infrastructur
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';
import pulseDataGridSource from '@/components/shared/PulseDataGrid.tsx?raw';
import pulseDataGridModelSource from '@/components/shared/pulseDataGridModel.ts?raw';
import progressBarSource from '@/components/shared/ProgressBar.tsx?raw';
@@ -78,7 +77,6 @@ import infrastructureSourceManagerSource from '@/components/Settings/Infrastruct
import configuredNodeTablesSource from '@/components/Settings/ConfiguredNodeTables.tsx?raw';
import infrastructureSummaryTableSource from '@/components/shared/InfrastructureSummaryTable.tsx?raw';
import infrastructureSummaryTableRowSource from '@/components/shared/InfrastructureSummaryTableRow.tsx?raw';
-import infrastructureSelectorModelSource from '@/components/shared/infrastructureSelectorModel.ts?raw';
import infrastructureSummaryTableModelSource from '@/components/shared/infrastructureSummaryTableModel.ts?raw';
import infrastructureSummaryTableStateSource from '@/components/shared/useInfrastructureSummaryTableState.ts?raw';
import selectionCardGroupSource from '@/components/shared/SelectionCardGroup.tsx?raw';
@@ -101,7 +99,6 @@ 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';
import searchFieldStateSource from '@/components/shared/useSearchFieldState.ts?raw';
import searchInputStateSource from '@/components/shared/useSearchInputState.ts?raw';
@@ -124,7 +121,6 @@ import workloadPanelSource from '@/components/Workloads/WorkloadPanel.tsx?raw';
import guestRowStateSource from '@/components/Workloads/useGuestRowState.ts?raw';
import workloadSelectionStateSource from '@/components/Workloads/useWorkloadSelectionState.ts?raw';
import proxmoxNodesTableSource from '@/features/proxmox/ProxmoxNodesTable.tsx?raw';
-import infrastructureSummarySource from '@/components/Infrastructure/InfrastructureSummary.tsx?raw';
import infrastructureSummaryStateSource from '@/components/Infrastructure/useInfrastructureSummaryState.ts?raw';
import unifiedResourceHostTableCardSource from '@/components/Infrastructure/UnifiedResourceHostTableCard.tsx?raw';
import unifiedResourceServiceInfrastructureCardSource from '@/components/Infrastructure/UnifiedResourceServiceInfrastructureCard.tsx?raw';
@@ -466,8 +462,6 @@ describe('shared primitive guardrails', () => {
);
expect(densityMapModelSource).toContain('buildDensityMapSynchronizedReadout');
- expect(infrastructureSummarySource).toContain('SummarySynchronizedReadout');
- expect(infrastructureSummarySource).toContain('headerValue={');
expect(workloadsSummarySource).toContain('SummarySynchronizedReadout');
expect(workloadsSummarySource).toContain('headerValue={');
expect(storageSummarySource).toContain('SummarySynchronizedReadout');
@@ -907,25 +901,8 @@ describe('shared primitive guardrails', () => {
});
it('keeps infrastructure selector on shell, runtime, and model owners', () => {
- expect(infrastructureSelectorSource).toContain('useInfrastructureSelectorState');
- expect(infrastructureSelectorSource).toContain('InfrastructureSummaryTable');
- expect(infrastructureSelectorSource).not.toContain('useResources');
- expect(infrastructureSelectorSource).not.toContain('createSignal');
- expect(infrastructureSelectorSource).not.toContain("resource.type === 'truenas'");
-
- expect(infrastructureSelectorStateSource).toContain('useUnifiedResources');
- expect(infrastructureSelectorStateSource).toContain('enabled: showNodeSummary');
- expect(infrastructureSelectorStateSource).toContain('useRecoveryRollups');
- expect(infrastructureSelectorStateSource).toContain('createSignal');
- expect(infrastructureSelectorStateSource).toContain('document.addEventListener');
- expect(infrastructureSelectorStateSource).toContain(
- 'export function useInfrastructureSelectorState',
- );
- expect(infrastructureSelectorModelSource).toContain('buildInfrastructureSelectorAgents');
- expect(infrastructureSelectorModelSource).toContain('buildInfrastructureSelectorBackupCounts');
- expect(infrastructureSelectorModelSource).toContain('buildInfrastructureSelectorUnifiedNodes');
- expect(infrastructureSelectorModelSource).toContain('isAgentFacetInfrastructureResource');
+
});
it('keeps interactive sparkline on shell, runtime, and model owners', () => {
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index a3d8142727..33b86947ab 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -35,7 +35,6 @@ import historyChartModelSource from '@/components/shared/historyChartModel.ts?ra
import historyChartTooltipSource from '@/components/shared/HistoryChartTooltip.tsx?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';
import pulseDataGridSource from '@/components/shared/PulseDataGrid.tsx?raw';
import pulseDataGridModelSource from '@/components/shared/pulseDataGridModel.ts?raw';
import searchFieldSource from '@/components/shared/SearchField.tsx?raw';
@@ -61,7 +60,6 @@ import infrastructureSummaryTableSource from '@/components/shared/Infrastructure
import infrastructureSummaryTableRowSource from '@/components/shared/InfrastructureSummaryTableRow.tsx?raw';
import interactiveSparklineSource from '@/components/shared/InteractiveSparkline.tsx?raw';
import interactiveSparklineModelSource from '@/components/shared/interactiveSparklineModel.ts?raw';
-import infrastructureSelectorModelSource from '@/components/shared/infrastructureSelectorModel.ts?raw';
import selectionCardGroupSource from '@/components/shared/SelectionCardGroup.tsx?raw';
import selectionCardGroupModelSource from '@/components/shared/selectionCardGroupModel.ts?raw';
import sharedInfrastructureSummaryTableModelSource from '@/components/shared/infrastructureSummaryTableModel.ts?raw';
@@ -75,7 +73,6 @@ import filterButtonGroupStateSource from '@/components/shared/useFilterButtonGro
import helpIconStateSource from '@/components/shared/useHelpIconState.ts?raw';
import historyChartStateSource from '@/components/shared/useHistoryChartState.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';
import searchFieldStateSource from '@/components/shared/useSearchFieldState.ts?raw';
import searchInputStateSource from '@/components/shared/useSearchInputState.ts?raw';
@@ -289,7 +286,6 @@ import resourceDetailDrawerShellSource from '@/components/Infrastructure/Resourc
import resourceDetailDrawerOverviewSource from '@/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx?raw';
import resourceDetailDrawerDebugSource from '@/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx?raw';
import resourceDetailSummarySource from '@/components/Infrastructure/ResourceDetailSummary.tsx?raw';
-import infrastructureSummarySource from '@/components/Infrastructure/InfrastructureSummary.tsx?raw';
import infrastructureSummaryStateSource from '@/components/Infrastructure/useInfrastructureSummaryState.ts?raw';
import infrastructureSummaryModelSource from '@/components/Infrastructure/infrastructureSummaryModel.ts?raw';
import resourceDetailDrawerDiscoveryModelSource from '@/components/Infrastructure/resourceDetailDiscoveryModel.ts?raw';
@@ -881,10 +877,6 @@ describe('frontend resource type boundaries', () => {
expect(useWorkloadsSource).not.toContain('const normalizeOrgScope =');
expect(useUnifiedResourcesSource).toContain('normalizeOrgScope(getOrgID())');
expect(useUnifiedResourcesSource).not.toContain('const normalizeOrgScope =');
- expect(infrastructureSummarySource).toContain('useInfrastructureSummaryState');
- expect(infrastructureSummarySource).not.toContain('fetchInfrastructureSummaryAndCache');
- expect(infrastructureSummarySource).not.toContain('setInterval(');
- expect(infrastructureSummarySource).not.toContain('AbortController');
expect(infrastructureSummaryStateSource).toContain('normalizeOrgScope(getOrgID())');
expect(infrastructureSummaryStateSource).toContain('buildInfrastructureDisplaySeries');
expect(infrastructureSummaryStateSource).toContain('buildInfrastructureMetricSeries');
@@ -2715,21 +2707,6 @@ describe('frontend resource type boundaries', () => {
expect(sharedInfrastructureSummaryTableModelSource).toContain(
'resolveInfrastructureSummaryLinkedAgent',
);
- expect(infrastructureSelectorSource).toContain('useInfrastructureSelectorState');
- expect(infrastructureSelectorSource).toContain('InfrastructureSummaryTable');
- expect(infrastructureSelectorSource).not.toContain('useResources');
- expect(infrastructureSelectorSource).not.toContain('createSignal');
- expect(infrastructureSelectorSource).not.toContain("resource.type === 'truenas'");
- expect(infrastructureSelectorStateSource).toContain('useUnifiedResources');
- expect(infrastructureSelectorStateSource).toContain('enabled: showNodeSummary');
- expect(infrastructureSelectorStateSource).toContain('useRecoveryRollups');
- expect(infrastructureSelectorStateSource).toContain('createSignal');
- expect(infrastructureSelectorStateSource).toContain('document.addEventListener');
- expect(infrastructureSelectorModelSource).toContain('buildInfrastructureSelectorAgents');
- expect(infrastructureSelectorModelSource).toContain('buildInfrastructureSelectorBackupCounts');
- expect(infrastructureSelectorModelSource).toContain('buildInfrastructureSelectorUnifiedNodes');
- expect(infrastructureSelectorModelSource).toContain('isAgentFacetInfrastructureResource');
- expect(infrastructureSelectorModelSource).not.toContain("resource.type === 'truenas'");
expect(interactiveSparklineSource).toContain('useInteractiveSparklineState');
expect(interactiveSparklineSource).not.toContain('scheduleSparkline');
expect(interactiveSparklineSource).not.toContain('downsampleLTTB');