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.

Extract infrastructure summary model owner

rcourtman9d5e28e5eea8
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index d43be0bd52..f774bc6bce 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -122,7 +122,7 @@ regression protection.
1. `frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts` shared with `unified-resources`: the infrastructure selector pipeline is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
2. `frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx` shared with `unified-resources`: the infrastructure summary surface is both a canonical unified-resource consumer and a fleet-scale summary chart hot-path boundary.
-3. `frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts` shared with `unified-resources`: infrastructure summary chart matching and series derivation are both a canonical unified-resource consumer surface and a fleet-scale summary chart hot-path boundary.
+3. `frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts` shared with `unified-resources`: infrastructure summary chart matching, focused-summary view derivation, and metric-series shaping are both a canonical unified-resource consumer surface and a fleet-scale summary chart hot-path boundary.
4. `frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts` shared with `unified-resources`: resource detail mappers are both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
5. `frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx` shared with `unified-resources`: the unified resource host table card is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
6. `frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx` shared with `unified-resources`: the unified resource PBS section is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
@@ -343,9 +343,10 @@ That hot-path contract now includes policy badge rendering on resource rows.
The infrastructure summary hot path is now explicit shared ownership too:
`InfrastructureSummary.tsx` stays a render shell,
`useInfrastructureSummaryState.ts` owns chart polling and cache lifecycle, and
-`infrastructureSummaryModel.ts` owns chart matching plus summary-series
-derivation. Future summary-chart work must not put polling, cache hydration,
-and series math back into the shell.
+`infrastructureSummaryModel.ts` owns chart matching, focused-summary display
+selection, empty-state wording, and summary-series/metric derivation. Future
+summary-chart work must not put polling, cache hydration, and series math
+back into the shell.
It now also includes the compact resource-facet summary chips rendered next
to policy metadata, and those chips must stay within the same bounded
windowing and mounted-row budget proved by
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index cb9e57834a..337629d030 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -75,7 +75,7 @@
},
{
"path": "frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts",
- "rationale": "infrastructure summary chart matching and series derivation are both a canonical unified-resource consumer surface and a fleet-scale summary chart hot-path boundary",
+ "rationale": "infrastructure summary chart matching, focused-summary view derivation, and metric-series shaping are both a canonical unified-resource consumer surface and a fleet-scale summary chart hot-path boundary",
"subsystems": [
"performance-and-scalability",
"unified-resources"
@@ -2873,6 +2873,7 @@
"frontend-modern/src/components/Dashboard/MetricBar.test.tsx",
"frontend-modern/src/components/Dashboard/StackedMemoryBar.test.tsx",
"frontend-modern/src/components/Dashboard/ThresholdSlider.test.tsx",
+ "frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts",
"frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx",
"frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts"
]
@@ -3354,6 +3355,7 @@
"test_prefixes": [],
"exact_files": [
"frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts",
+ "frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts",
"frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.discovery.test.ts",
"frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx",
"frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerIdentityModel.test.ts",
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index b5bcef20cd..7801175b49 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -78,7 +78,7 @@ cross-source deduplication.
1. `frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts` shared with `performance-and-scalability`: the infrastructure selector pipeline is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
2. `frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx` shared with `performance-and-scalability`: the infrastructure summary surface is both a canonical unified-resource consumer and a fleet-scale summary chart hot-path boundary.
-3. `frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts` shared with `performance-and-scalability`: infrastructure summary chart matching and series derivation are both a canonical unified-resource consumer surface and a fleet-scale summary chart hot-path boundary.
+3. `frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts` shared with `performance-and-scalability`: infrastructure summary chart matching, focused-summary view derivation, and metric-series shaping are both a canonical unified-resource consumer surface and a fleet-scale summary chart hot-path boundary.
4. `frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts` shared with `performance-and-scalability`: resource detail mappers are both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
5. `frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx` shared with `performance-and-scalability`: the unified resource host table card is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
6. `frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx` shared with `performance-and-scalability`: the unified resource PBS section is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
@@ -198,8 +198,8 @@ The infrastructure summary surface now follows the same shell/runtime/model
shape: `InfrastructureSummary.tsx` is the render shell,
`useInfrastructureSummaryState.ts` owns chart polling, cache hydration,
org-scope lifecycle, and focused-summary state, and
-`infrastructureSummaryModel.ts` owns chart matching plus summary-series
-derivation.
+`infrastructureSummaryModel.ts` owns chart matching, focused-summary display
+selection, empty-state wording, and summary-series/metric derivation.
The backend AI and Patrol context renderers now derive their canonical change
kind, source type, source adapter, actor, reason, and related-resource
fragments from `internal/unifiedresources/change_presentation.go`, so the
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 675e3248ec..6f5de0049e 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
@@ -232,12 +232,34 @@ describe('UnifiedResourceTable performance contract', () => {
expect(infrastructureSummaryStateSource).toContain('setInterval(');
expect(infrastructureSummaryStateSource).toContain('AbortController');
expect(infrastructureSummaryStateSource).toContain("eventBus.on('org_switched'");
+ expect(infrastructureSummaryStateSource).toContain('buildInfrastructureDisplaySeries');
+ expect(infrastructureSummaryStateSource).toContain('buildInfrastructureMetricSeries');
+ expect(infrastructureSummaryStateSource).toContain('buildInfrastructureEmptyMessage');
+ expect(infrastructureSummaryStateSource).not.toContain(
+ 'const match = allSeries.find((series) => series.id === focused);',
+ );
+ expect(infrastructureSummaryStateSource).not.toContain(
+ "displaySeries().map((series) => ({",
+ );
+ expect(infrastructureSummaryStateSource).not.toContain(
+ "isAwaitingFirstSample() ? 'Waiting for first sample' : 'No history yet'",
+ );
+ expect(infrastructureSummaryStateSource).not.toContain("fetchFailed() ? 'Trend data unavailable' : emptyHistoryLabel()");
expect(infrastructureSummaryModelSource).toContain(
'export function buildInfrastructureSummarySeries',
);
expect(infrastructureSummaryModelSource).toContain(
'export function combineResourceThroughputSeries',
);
+ expect(infrastructureSummaryModelSource).toContain(
+ 'export function buildInfrastructureDisplaySeries',
+ );
+ expect(infrastructureSummaryModelSource).toContain(
+ 'export function buildInfrastructureMetricSeries',
+ );
+ expect(infrastructureSummaryModelSource).toContain(
+ 'export function shouldShowInfrastructureNetworkCard',
+ );
});
it('keeps source filtering on the shared canonical source-platform helper', () => {
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts
new file mode 100644
index 0000000000..a8f9d4368a
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts
@@ -0,0 +1,140 @@
+import { describe, expect, it } from 'vitest';
+
+import type { Resource } from '@/types/resource';
+import type { InfrastructureSummarySeries } from '@/components/Infrastructure/infrastructureSummaryModel';
+import {
+ buildInfrastructureDisplaySeries,
+ buildInfrastructureEmptyHistoryLabel,
+ buildInfrastructureEmptyMessage,
+ buildInfrastructureMetricSeries,
+ 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('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('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('Waiting for first sample');
+ expect(buildInfrastructureEmptyHistoryLabel(false)).toBe('No history yet');
+ expect(buildInfrastructureEmptyMessage(true, 'No history yet')).toBe('Trend data unavailable');
+ expect(buildInfrastructureEmptyMessage(false, 'No history yet')).toBe('No history yet');
+ });
+
+ it('shows the network card when either data or network capability exists', () => {
+ expect(
+ shouldShowInfrastructureNetworkCard(false, [
+ makeResource({
+ type: 'vm',
+ platformType: 'proxmox-vm',
+ network: { rxBytes: 10, txBytes: 0 },
+ }),
+ ]),
+ ).toBe(true);
+ expect(shouldShowInfrastructureNetworkCard(true, [makeResource()])).toBe(true);
+ expect(
+ shouldShowInfrastructureNetworkCard(false, [
+ makeResource({
+ type: 'vm',
+ platformType: 'proxmox-vm',
+ network: { rxBytes: 0, txBytes: 0 },
+ platformData: { sources: ['proxmox'] },
+ }),
+ ]),
+ ).toBe(false);
+ });
+});
diff --git a/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts b/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts
index a7924f5a08..e6d6ec7e3e 100644
--- a/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts
+++ b/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts
@@ -55,6 +55,13 @@ export interface InfrastructureResourceCounts {
offline: number;
}
+export interface InfrastructureSummaryMetricSeriesEntry {
+ id: string;
+ data: MetricPoint[];
+ color: string;
+ name: string;
+}
+
const getNormalizedResourceIdentifiers = (resource: Resource): Set<string> =>
new Set<string>([
...getNormalizedIdentityLookupVariants(resource.id),
@@ -214,6 +221,85 @@ export function buildInfrastructureSummarySeries(
});
}
+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 || resources.length !== 1) return null;
+ const [resource] = resources;
+ 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 ? 'Waiting for first sample' : 'No history yet';
+}
+
+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 {
@@ -265,3 +351,10 @@ export function hasInfrastructureNetworkCapability(resources: Resource[]): boole
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
index 5a4a38c2bf..61da9d277e 100644
--- a/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
+++ b/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
@@ -12,11 +12,19 @@ import { eventBus } from '@/stores/events';
import {
type InfrastructureSummaryProps,
type InfrastructureSummarySparkMetric,
+ buildInfrastructureDisplaySeries,
+ buildInfrastructureEmptyHistoryLabel,
+ buildInfrastructureEmptyMessage,
+ buildInfrastructureMetricSeries,
buildInfrastructureResourceCounts,
buildInfrastructureSummarySeries,
buildInfrastructureWorkloadStats,
+ getFocusedInfrastructureResourceName,
getAverageDiskCapacity,
- hasInfrastructureNetworkCapability,
+ getSingleDisplayedOnlineInfrastructureResource,
+ hasInfrastructureSeriesData,
+ isInfrastructureAwaitingFirstSample,
+ shouldShowInfrastructureNetworkCard,
} from './infrastructureSummaryModel';
// In-memory full-resolution cache keyed by "org::range".
@@ -229,83 +237,56 @@ export function useInfrastructureSummaryState(props: InfrastructureSummaryProps)
);
const displaySeries = createMemo(() => {
- const focused = props.focusedResourceId;
- const allSeries = resourceSeries();
- if (!focused) return allSeries;
- const match = allSeries.find((series) => series.id === focused);
- return match ? [match] : allSeries;
+ return buildInfrastructureDisplaySeries(resourceSeries(), props.focusedResourceId);
});
const focusedResourceName = createMemo(() => {
- const focused = props.focusedResourceId;
- if (!focused) return null;
- const match = resourceSeries().find((series) => series.id === focused);
- return match?.name ?? null;
+ return getFocusedInfrastructureResourceName(resourceSeries(), props.focusedResourceId);
});
const singleDisplayedOnlineResource = createMemo(() => {
- if (displaySeries().length !== 1 || props.resources.length !== 1) return null;
- const [resource] = props.resources;
- if (!resource) return null;
- return resource.status?.toLowerCase() === 'online' ? resource : null;
+ return getSingleDisplayedOnlineInfrastructureResource(props.resources, displaySeries());
});
const isAwaitingFirstSample = createMemo(() => {
- const resource = singleDisplayedOnlineResource();
- if (!resource || !isCurrentRangeLoaded() || fetchFailed()) return false;
-
- const oldest = oldestDataTimestamp();
- if (oldest === null) return true;
- return resource.lastSeen >= oldest;
+ return isInfrastructureAwaitingFirstSample({
+ resource: singleDisplayedOnlineResource(),
+ isCurrentRangeLoaded: isCurrentRangeLoaded(),
+ fetchFailed: fetchFailed(),
+ oldestDataTimestamp: oldestDataTimestamp(),
+ });
});
const emptyHistoryLabel = createMemo(() =>
- isAwaitingFirstSample() ? 'Waiting for first sample' : 'No history yet',
+ buildInfrastructureEmptyHistoryLabel(isAwaitingFirstSample()),
);
const hasData = (metric: InfrastructureSummarySparkMetric) =>
- displaySeries().some((series) => series[metric].length >= 1);
+ hasInfrastructureSeriesData(displaySeries(), metric);
const networkSeries = createMemo(() =>
- displaySeries().map((series) => ({
- id: series.id,
- data: series.network,
- color: series.color,
- name: series.name,
- })),
+ buildInfrastructureMetricSeries(displaySeries(), 'network'),
);
- const hasNetData = createMemo(() => displaySeries().some((series) => series.network.length >= 1));
+ const hasNetData = createMemo(() => hasInfrastructureSeriesData(displaySeries(), 'network'));
const diskioSeries = createMemo(() =>
- displaySeries().map((series) => ({
- id: series.id,
- data: series.diskio,
- color: series.color,
- name: series.name,
- })),
+ buildInfrastructureMetricSeries(displaySeries(), 'diskio'),
);
- const hasDiskIOData = createMemo(() =>
- displaySeries().some((series) => series.diskio.length >= 1),
- );
+ const hasDiskIOData = createMemo(() => hasInfrastructureSeriesData(displaySeries(), 'diskio'));
const avgDiskCapacity = createMemo(() => getAverageDiskCapacity(props.resources));
const shouldShowNetworkCard = createMemo(
- () => hasNetData() || hasInfrastructureNetworkCapability(props.resources),
+ () => shouldShowInfrastructureNetworkCard(hasNetData(), props.resources),
);
const workloadStats = createMemo(() => buildInfrastructureWorkloadStats(workloads()));
const resourceCounts = createMemo(() => buildInfrastructureResourceCounts(props.resources));
const emptyMessage = createMemo(() =>
- fetchFailed() ? 'Trend data unavailable' : emptyHistoryLabel(),
+ buildInfrastructureEmptyMessage(fetchFailed(), emptyHistoryLabel()),
);
const seriesFor = (metric: InfrastructureSummarySparkMetric) =>
- displaySeries().map((series) => ({
- id: series.id,
- data: series[metric],
- color: series.color,
- name: series.name,
- }));
+ buildInfrastructureMetricSeries(displaySeries(), metric);
return {
selectedRange,
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index c7f707b868..d90f53a8d0 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -957,6 +957,16 @@ describe('frontend resource type boundaries', () => {
expect(infrastructureSummarySource).not.toContain('setInterval(');
expect(infrastructureSummarySource).not.toContain('AbortController');
expect(infrastructureSummaryStateSource).toContain('normalizeOrgScope(getOrgID())');
+ expect(infrastructureSummaryStateSource).toContain('buildInfrastructureDisplaySeries');
+ expect(infrastructureSummaryStateSource).toContain('buildInfrastructureMetricSeries');
+ expect(infrastructureSummaryStateSource).toContain('buildInfrastructureEmptyMessage');
+ expect(infrastructureSummaryStateSource).not.toContain(
+ 'const match = allSeries.find((series) => series.id === focused);',
+ );
+ expect(infrastructureSummaryStateSource).not.toContain("displaySeries().map((series) => ({");
+ expect(infrastructureSummaryStateSource).not.toContain(
+ "isAwaitingFirstSample() ? 'Waiting for first sample' : 'No history yet'",
+ );
expect(infrastructureSummaryStateSource).not.toContain("getOrgID() || 'default'");
expect(storageSummarySource).toContain('normalizeOrgScope(getOrgID())');
expect(storageSummarySource).not.toContain("getOrgID() || 'default'");
@@ -2719,6 +2729,9 @@ describe('frontend resource type boundaries', () => {
expect(chatIdentifiersSource).toContain('normalizeChatMentionKeyPart');
expect(chatIdentifiersSource).toContain('normalizeChatToolName');
expect(infrastructureSummaryModelSource).toContain('getNormalizedIdentityLookupVariants');
+ expect(infrastructureSummaryModelSource).toContain('buildInfrastructureDisplaySeries');
+ expect(infrastructureSummaryModelSource).toContain('buildInfrastructureMetricSeries');
+ expect(infrastructureSummaryModelSource).toContain('buildInfrastructureEmptyMessage');
expect(sharedInfrastructureSummaryTableModelSource).toContain(
'getNormalizedIdentityLookupVariants',
);
diff --git a/scripts/release_control/canonical_completion_guard_test.py b/scripts/release_control/canonical_completion_guard_test.py
index e773feaec7..fed33a3da6 100644
--- a/scripts/release_control/canonical_completion_guard_test.py
+++ b/scripts/release_control/canonical_completion_guard_test.py
@@ -504,6 +504,7 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx",
"frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.workloads-link.test.tsx",
"frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts",
+ "frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts",
"frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerIdentityModel.test.ts",
"frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts",
"frontend-modern/src/components/Infrastructure/__tests__/resourceDetailMappers.test.ts",
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index 6564b9bc1f..1fe82508d4 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -238,6 +238,62 @@ class SubsystemLookupTest(unittest.TestCase):
unified_resources_match["verification_requirement"]["exact_files"],
)
+ def test_lookup_paths_assigns_infrastructure_summary_model_to_shared_infrastructure_hot_path(
+ self,
+ ) -> None:
+ result = lookup_paths(
+ ["frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts"]
+ )
+ self.assertEqual(result["unowned_runtime_files"], [])
+ self.assertEqual(
+ {item["subsystem"] for item in result["impacted_subsystems"]},
+ {"performance-and-scalability", "unified-resources"},
+ )
+
+ file_entry = result["files"][0]
+ self.assertEqual(file_entry["classification"], "runtime")
+ self.assertEqual(
+ {match["subsystem"] for match in file_entry["matches"]},
+ {"performance-and-scalability", "unified-resources"},
+ )
+ self.assertEqual(
+ file_entry["shared_ownership"]["subsystems"],
+ ["performance-and-scalability", "unified-resources"],
+ )
+
+ matches_by_subsystem = {
+ match["subsystem"]: match for match in file_entry["matches"]
+ }
+ performance_match = matches_by_subsystem["performance-and-scalability"]
+ self.assertEqual(
+ performance_match["contract"],
+ "docs/release-control/v6/internal/subsystems/performance-and-scalability.md",
+ )
+ self.assertEqual(performance_match["lane_context"]["lane_id"], "L10")
+ self.assertEqual(
+ performance_match["verification_requirement"]["id"],
+ "dashboard-workload-hot-path",
+ )
+ self.assertIn(
+ "frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts",
+ performance_match["verification_requirement"]["exact_files"],
+ )
+
+ unified_resources_match = matches_by_subsystem["unified-resources"]
+ self.assertEqual(
+ unified_resources_match["contract"],
+ "docs/release-control/v6/internal/subsystems/unified-resources.md",
+ )
+ self.assertEqual(unified_resources_match["lane_context"]["lane_id"], "L13")
+ self.assertEqual(
+ unified_resources_match["verification_requirement"]["id"],
+ "resource-consumers",
+ )
+ self.assertIn(
+ "frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts",
+ unified_resources_match["verification_requirement"]["exact_files"],
+ )
+
def test_lookup_paths_assigns_resource_detail_drawer_discovery_model_to_unified_resources(self) -> None:
result = lookup_paths(
["frontend-modern/src/components/Infrastructure/resourceDetailDiscoveryModel.ts"]
@@ -4111,6 +4167,7 @@ class SubsystemLookupTest(unittest.TestCase):
"frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx",
"frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.workloads-link.test.tsx",
"frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts",
+ "frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts",
"frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerIdentityModel.test.ts",
"frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts",
"frontend-modern/src/components/Infrastructure/__tests__/resourceDetailMappers.test.ts",