Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Add health-state indicators to Infrastructure, Storage, Workloads, and Recovery summaries

rcourtman329f59eddbc5
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 333cabd21d..7a2cd885b0 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -583,6 +583,11 @@ Shared alert presentation surfaces (`OverviewTab.tsx`, `HistoryTab.tsx`,
`hasAIAlertsFeature` or `runtimeCapabilitiesLoading` props. Feature gating for
AI alerts flows through the shared entitlements layer; surfaces must not
re-introduce per-surface capability fetch props.
+`frontend-modern/src/components/Recovery/RecoverySummary.tsx` gained an
+aggregate health-state summary row. Per the Extension Points constraint, this
+surface must continue to stay outside the shared hover-synchronization dialect;
+new additions to `RecoverySummary.tsx` must not introduce row/group/chart hover
+wiring without a separate governed product decision.
The frontend already has several guardrail tests. The next step is to keep
turning repeated local patterns into explicit shared primitives with hard usage
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 cff59ceac4..3c37dad541 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -297,6 +297,16 @@ regression protection.
## Current State
+Summary cards for Infrastructure, Storage, Workloads, and Recovery now surface
+health-state counts (offline, degraded, alerting) instead of raw online/offline
+splits. `InfrastructureSummary.tsx` and `infrastructureSummaryModel.ts` add
+`degraded` and `alerting` resource counts; `StorageSummary.tsx` and
+`useStoragePageSummary.ts` add `poolsDegraded` and `disksFailing` indicators;
+`WorkloadsSummary.tsx` and `useDashboardWorkloadDerivedState.ts` add an
+alerting count derived from `activeAlerts`. These additions must remain
+read-only projections from existing websocket state — they must not introduce
+new polling loops or widen fetch scope on the hot-path boundary.
+
This lane already has strong evidence and guardrails, but it still trails on
score because critical hot paths need more complete protection and verification.
Compact physical-disk drawer charts now also belong to the protected hot path.
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index 55955490ca..0560f55ad6 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -4564,6 +4564,7 @@
"frontend-modern/src/components/Storage/__tests__/StorageControls.test.tsx",
"frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx",
"frontend-modern/src/components/Storage/__tests__/StoragePoolDetail.test.tsx",
+ "frontend-modern/src/components/Storage/__tests__/useStoragePageSummary.test.ts",
"frontend-modern/src/components/Storage/code_standards.test.ts",
"frontend-modern/src/features/storageBackups/__tests__/resourceStorageMapping.test.ts",
"frontend-modern/src/features/storageBackups/__tests__/storageAdapters.test.ts",
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 7e6a9ffc17..2083165e82 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -526,6 +526,12 @@ querying, and the operator-facing storage health presentation layer.
## Current State
+`StorageSummary.tsx`, `StoragePageSummary.tsx`, and `useStoragePageSummary.ts`
+now surface `poolsDegraded` and `disksFailing` health indicators alongside
+pool/disk counts. `RecoverySummary.tsx` gains an aggregate health-state summary
+row. These additions project from existing websocket pool/disk state; they must
+not introduce new API polling or widen the storage-fetch boundary.
+
This subsystem now sits under the dedicated storage and recovery lane so the
operator-facing storage page, recovery timeline, and recovery-point persistence
engine stop hiding inside broader monitoring and E2E buckets.
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 225a7fa278..ee0e800e34 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -374,6 +374,13 @@ assembly branch.
## Current State
+`InfrastructureSummary.tsx` and `infrastructureSummaryModel.ts` now surface
+`degraded` and `alerting` resource counts alongside the existing `online` and
+`offline` totals. `buildInfrastructureResourceCounts` is the canonical owner of
+this health-state projection: it must derive counts only from the resources
+accessor already available to the summary state, not from a separate API call or
+a re-projection of websocket state outside the shared summary pipeline.
+
This subsystem now sits under the dedicated core monitoring runtime lane so
canonical resource identity, discovery normalization, and platform-runtime
coverage stay governed as a first-class Pulse product surface, including the
diff --git a/frontend-modern/src/components/Dashboard/useDashboardState.ts b/frontend-modern/src/components/Dashboard/useDashboardState.ts
index 4ae1f2d56c..bc2a083f4e 100644
--- a/frontend-modern/src/components/Dashboard/useDashboardState.ts
+++ b/frontend-modern/src/components/Dashboard/useDashboardState.ts
@@ -253,6 +253,8 @@ export function useDashboardState(props: DashboardProps) {
workloadsSummaryFallbackSnapshots,
workloadsSummaryVisibleIds,
} = useDashboardWorkloadDerivedState({
+ activeAlerts: () => activeAlerts,
+ alertsEnabled,
allGuests,
filteredGuests,
groupingMode,
diff --git a/frontend-modern/src/components/Dashboard/useDashboardWorkloadDerivedState.ts b/frontend-modern/src/components/Dashboard/useDashboardWorkloadDerivedState.ts
index 683ceec111..75164ab9d4 100644
--- a/frontend-modern/src/components/Dashboard/useDashboardWorkloadDerivedState.ts
+++ b/frontend-modern/src/components/Dashboard/useDashboardWorkloadDerivedState.ts
@@ -1,6 +1,6 @@
import { createMemo, type Accessor } from 'solid-js';
-import type { Node } from '@/types/api';
+import type { Alert, Node } from '@/types/api';
import type { WorkloadGuest } from '@/types/workloads';
import type { WorkloadSummarySnapshot } from '@/components/Workloads/WorkloadsSummary';
import { getNodeDisplayName } from '@/utils/nodes';
@@ -31,6 +31,8 @@ const workloadMetricPercent = (value: number | null | undefined): number => {
};
interface DashboardWorkloadDerivedStateOptions {
+ activeAlerts: Accessor<Record<string, Alert>>;
+ alertsEnabled: Accessor<boolean>;
allGuests: Accessor<WorkloadGuest[]>;
filteredGuests: Accessor<WorkloadGuest[]>;
groupingMode: Accessor<GroupingMode>;
@@ -55,10 +57,27 @@ export function useDashboardWorkloadDerivedState(
const running = guests.filter(
(guest) => guest.status === 'running' || guest.status === 'online',
).length;
+ let alerting = 0;
+ if (options.alertsEnabled()) {
+ const alertingResourceIds = new Set<string>();
+ for (const alert of Object.values(options.activeAlerts())) {
+ if (!alert.acknowledged && alert.resourceId) {
+ alertingResourceIds.add(alert.resourceId);
+ }
+ }
+ if (alertingResourceIds.size > 0) {
+ for (const guest of guests) {
+ if (alertingResourceIds.has(getCanonicalWorkloadId(guest))) {
+ alerting++;
+ }
+ }
+ }
+ }
return {
total: guests.length,
running,
stopped: Math.max(0, guests.length - running),
+ alerting,
};
});
diff --git a/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx b/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx
index 780ef898a8..5287c37f0b 100644
--- a/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx
+++ b/frontend-modern/src/components/Infrastructure/InfrastructureSummary.tsx
@@ -89,15 +89,35 @@ export const InfrastructureSummary: Component<InfrastructureSummaryProps> = (pro
<>
<span class="font-medium text-base-content">
{state.resourceCounts().total}{' '}
- {state.resourceCounts().total === 1 ? 'resource' : 'resources'}
+ {state.resourceCounts().total === 1 ? 'system' : 'systems'}
</span>
- <Show when={state.resourceCounts().online > 0}>
- <span class="text-emerald-600 dark:text-emerald-400">
- {state.resourceCounts().online} online
- </span>
- </Show>
- <Show when={state.resourceCounts().offline > 0}>
- <span class="text-muted">{state.resourceCounts().offline} offline</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">
+ {state.resourceCounts().offline} offline
+ </span>
+ </Show>
+ <Show when={state.resourceCounts().degraded > 0}>
+ <span class="text-amber-600 dark:text-amber-400">
+ {state.resourceCounts().degraded} degraded
+ </span>
+ </Show>
+ <Show when={state.resourceCounts().alerting > 0}>
+ <span class="text-amber-600 dark:text-amber-400">
+ {state.resourceCounts().alerting} alerting
+ </span>
+ </Show>
</Show>
<Show when={props.showJumpToActiveRow && props.onJumpToActiveRow}>
<SummaryJumpToRowButton onClick={() => props.onJumpToActiveRow?.()} />
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts
index a8e0302d84..d5ea0d41e1 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSummaryModel.test.ts
@@ -12,6 +12,7 @@ import {
buildInfrastructureEmptyHistoryLabel,
buildInfrastructureEmptyMessage,
buildInfrastructureMetricSeries,
+ buildInfrastructureResourceCounts,
getFocusedInfrastructureResourceName,
getSingleDisplayedOnlineInfrastructureResource,
hasInfrastructureSeriesData,
@@ -354,4 +355,25 @@ describe('infrastructureSummaryModel', () => {
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/infrastructureSummaryModel.ts b/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts
index 2d356a32c0..1afc3c2505 100644
--- a/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts
+++ b/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts
@@ -61,6 +61,8 @@ export interface InfrastructureResourceCounts {
total: number;
online: number;
offline: number;
+ degraded: number;
+ alerting: number;
}
export interface InfrastructureSummaryMetricSeriesEntry {
@@ -335,13 +337,26 @@ export function buildInfrastructureWorkloadStats(
export function buildInfrastructureResourceCounts(
resources: Resource[],
): InfrastructureResourceCounts {
- const total = resources.length;
- const online = resources.filter((resource) => resource.status === 'online').length;
- return {
- total,
- online,
- offline: total - online,
- };
+ 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 {
diff --git a/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx b/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx
index 581bbb22b5..02dca4f105 100644
--- a/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx
+++ b/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx
@@ -64,7 +64,8 @@ describe('RecoverySummary', () => {
expect(screen.getByText(/^types$/i)).toBeInTheDocument();
expect(screen.getByText('2 platforms')).toBeInTheDocument();
expect(screen.getAllByText('1 healthy')).toHaveLength(1);
- expect(screen.getByText('1 stale')).toBeInTheDocument();
+ expect(screen.getAllByText('1 stale').length).toBeGreaterThan(0);
+ expect(screen.getByText('1 never succeeded')).toBeInTheDocument();
expect(screen.getByText('fresh in 24h')).toBeInTheDocument();
expect(screen.getByText(/^(Mar 9|9 Mar)$/)).toBeInTheDocument();
expect(screen.getByText('2 protected items')).toBeInTheDocument();
diff --git a/frontend-modern/src/components/Recovery/RecoverySummary.tsx b/frontend-modern/src/components/Recovery/RecoverySummary.tsx
index 8c323e33fe..f4d8ab46ea 100644
--- a/frontend-modern/src/components/Recovery/RecoverySummary.tsx
+++ b/frontend-modern/src/components/Recovery/RecoverySummary.tsx
@@ -119,6 +119,25 @@ export const RecoverySummary: Component<RecoverySummaryProps> = (props) => {
fallback={<div class="h-4 w-32 rounded bg-surface-hover animate-pulse" />}
>
<span class="font-medium text-base-content">{summary().total} protected items</span>
+ <Show
+ when={summary().stale > 0 || summary().neverSucceeded > 0}
+ fallback={
+ <Show when={summary().total > 0}>
+ <span class="text-emerald-600 dark:text-emerald-400">all fresh</span>
+ </Show>
+ }
+ >
+ <Show when={summary().neverSucceeded > 0}>
+ <span class="text-red-600 dark:text-red-400">
+ {summary().neverSucceeded} never succeeded
+ </span>
+ </Show>
+ <Show when={summary().stale > 0}>
+ <span class="text-amber-600 dark:text-amber-400">
+ {summary().stale} stale
+ </span>
+ </Show>
+ </Show>
</Show>
}
timeRange={props.timeRange()}
diff --git a/frontend-modern/src/components/Storage/Storage.tsx b/frontend-modern/src/components/Storage/Storage.tsx
index 5cbedc2a58..6b96df14d2 100644
--- a/frontend-modern/src/components/Storage/Storage.tsx
+++ b/frontend-modern/src/components/Storage/Storage.tsx
@@ -75,7 +75,7 @@ const Storage: Component = () => {
>
<StickySummarySection desktopOnly={false}>
<StoragePageSummary
- filteredRecordCount={() => filteredRecords().length}
+ filteredRecords={filteredRecords}
selectedNodeId={selectedNodeId}
nodeOptions={nodeOptions}
physicalDisks={physicalDisks}
diff --git a/frontend-modern/src/components/Storage/StoragePageSummary.tsx b/frontend-modern/src/components/Storage/StoragePageSummary.tsx
index ad180d648f..14c7bad430 100644
--- a/frontend-modern/src/components/Storage/StoragePageSummary.tsx
+++ b/frontend-modern/src/components/Storage/StoragePageSummary.tsx
@@ -1,13 +1,14 @@
import { Component } from 'solid-js';
import StorageSummary from '@/components/Storage/StorageSummary';
import type { Resource } from '@/types/resource';
+import type { StorageRecord } from '@/features/storageBackups/models';
import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import type { StoragePageNodeOption } from './storagePageState';
import { useStoragePageSummary } from './useStoragePageSummary';
import type { SummaryChartHoverSync } from '@/components/shared/contextualFocus';
type StoragePageSummaryProps = {
- filteredRecordCount: () => number;
+ filteredRecords: () => StorageRecord[];
selectedNodeId: () => string;
nodeOptions: () => StoragePageNodeOption[];
physicalDisks: () => Resource[];
@@ -22,8 +23,15 @@ type StoragePageSummaryProps = {
};
export const StoragePageSummary: Component<StoragePageSummaryProps> = (props) => {
- const { summaryTimeRange, setSummaryTimeRange, poolCount, diskCount } = useStoragePageSummary({
- filteredRecordCount: props.filteredRecordCount,
+ const {
+ summaryTimeRange,
+ setSummaryTimeRange,
+ poolCount,
+ diskCount,
+ poolsDegraded,
+ disksFailing,
+ } = useStoragePageSummary({
+ filteredRecords: props.filteredRecords,
selectedNodeId: props.selectedNodeId,
nodeOptions: props.nodeOptions,
physicalDisks: props.physicalDisks,
@@ -33,6 +41,8 @@ export const StoragePageSummary: Component<StoragePageSummaryProps> = (props) =>
<StorageSummary
poolCount={poolCount()}
diskCount={diskCount()}
+ poolsDegraded={poolsDegraded()}
+ disksFailing={disksFailing()}
timeRange={summaryTimeRange()}
onTimeRangeChange={setSummaryTimeRange}
nodeId={props.selectedNodeId()}
diff --git a/frontend-modern/src/components/Storage/StorageSummary.tsx b/frontend-modern/src/components/Storage/StorageSummary.tsx
index f1a73e8d0b..3f16de5110 100644
--- a/frontend-modern/src/components/Storage/StorageSummary.tsx
+++ b/frontend-modern/src/components/Storage/StorageSummary.tsx
@@ -37,6 +37,8 @@ const POLL_INTERVAL_MS = 30_000;
interface StorageSummaryProps {
poolCount: number;
diskCount: number;
+ poolsDegraded?: number;
+ disksFailing?: number;
timeRange: SummaryTimeRange;
onTimeRangeChange?: (range: SummaryTimeRange) => void;
nodeId?: string;
@@ -359,10 +361,31 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
<span class="font-medium text-base-content">
{props.poolCount} {props.poolCount === 1 ? 'pool' : 'pools'}
</span>
- <Show when={props.diskCount > 0}>
- <span class="text-muted">
- {props.diskCount} {props.diskCount === 1 ? 'disk' : 'disks'}
- </span>
+ <Show
+ when={(props.poolsDegraded ?? 0) > 0 || (props.disksFailing ?? 0) > 0}
+ fallback={
+ <>
+ <Show when={props.poolCount > 0 || props.diskCount > 0}>
+ <span class="text-emerald-600 dark:text-emerald-400">all healthy</span>
+ </Show>
+ <Show when={props.diskCount > 0}>
+ <span class="text-muted">
+ {props.diskCount} {props.diskCount === 1 ? 'disk' : 'disks'}
+ </span>
+ </Show>
+ </>
+ }
+ >
+ <Show when={(props.poolsDegraded ?? 0) > 0}>
+ <span class="text-amber-600 dark:text-amber-400">
+ {props.poolsDegraded} degraded
+ </span>
+ </Show>
+ <Show when={(props.disksFailing ?? 0) > 0}>
+ <span class="text-amber-600 dark:text-amber-400">
+ {props.disksFailing} {props.disksFailing === 1 ? 'disk failing' : 'disks failing'}
+ </span>
+ </Show>
</Show>
<Show when={props.showJumpToActiveRow && props.onJumpToActiveRow}>
<SummaryJumpToRowButton onClick={() => props.onJumpToActiveRow?.()} />
diff --git a/frontend-modern/src/components/Storage/__tests__/useStoragePageSummary.test.ts b/frontend-modern/src/components/Storage/__tests__/useStoragePageSummary.test.ts
index 30e2749f9d..cf46a3369e 100644
--- a/frontend-modern/src/components/Storage/__tests__/useStoragePageSummary.test.ts
+++ b/frontend-modern/src/components/Storage/__tests__/useStoragePageSummary.test.ts
@@ -2,11 +2,29 @@ import { renderHook } from '@solidjs/testing-library';
import { createSignal } from 'solid-js';
import { describe, expect, it } from 'vitest';
import type { Resource } from '@/types/resource';
+import type { StorageRecord } from '@/features/storageBackups/models';
import { useStoragePageSummary } from '@/components/Storage/useStoragePageSummary';
+const makeRecord = (id: string, health: StorageRecord['health']): StorageRecord => ({
+ id,
+ name: id,
+ category: 'pool',
+ health,
+ location: { label: 'pve1', scope: 'node' },
+ capacity: { totalBytes: null, usedBytes: null, freeBytes: null, usagePercent: null },
+ capabilities: [],
+ source: { platform: 'proxmox-pve', family: 'virtualization', origin: 'resource', adapterId: 'test' },
+ observedAt: Date.now(),
+});
+
describe('useStoragePageSummary', () => {
it('derives pool and visible disk counts canonically for the selected node', () => {
- const [filteredRecordCount] = createSignal(4);
+ const [filteredRecords] = createSignal<StorageRecord[]>([
+ makeRecord('pool-a', 'healthy'),
+ makeRecord('pool-b', 'healthy'),
+ makeRecord('pool-c', 'healthy'),
+ makeRecord('pool-d', 'healthy'),
+ ]);
const [selectedNodeId] = createSignal('node-1');
const [nodeOptions] = createSignal([
{ id: 'node-1', label: 'pve1', aliases: ['pve1.local'] },
@@ -44,7 +62,7 @@ describe('useStoragePageSummary', () => {
const { result } = renderHook(() =>
useStoragePageSummary({
- filteredRecordCount,
+ filteredRecords,
selectedNodeId,
nodeOptions,
physicalDisks,
@@ -53,6 +71,8 @@ describe('useStoragePageSummary', () => {
expect(result.poolCount()).toBe(4);
expect(result.diskCount()).toBe(1);
+ expect(result.poolsDegraded()).toBe(0);
+ expect(result.disksFailing()).toBe(0);
expect(result.summaryTimeRange()).toBe('1h');
});
});
diff --git a/frontend-modern/src/components/Storage/useStoragePageSummary.ts b/frontend-modern/src/components/Storage/useStoragePageSummary.ts
index 0d0377b633..3eda69594b 100644
--- a/frontend-modern/src/components/Storage/useStoragePageSummary.ts
+++ b/frontend-modern/src/components/Storage/useStoragePageSummary.ts
@@ -1,20 +1,23 @@
import { Accessor, createMemo, createSignal } from 'solid-js';
import type { SummaryTimeRange } from '@/components/shared/summaryTimeRange';
import type { Resource } from '@/types/resource';
+import type { StorageRecord } from '@/features/storageBackups/models';
import type { StoragePageNodeOption } from './storagePageState';
import { countVisiblePhysicalDisksForNode } from './storagePageState';
type UseStoragePageSummaryOptions = {
- filteredRecordCount: Accessor<number>;
+ filteredRecords: Accessor<StorageRecord[]>;
selectedNodeId: Accessor<string>;
nodeOptions: Accessor<StoragePageNodeOption[]>;
physicalDisks: Accessor<Resource[]>;
};
+const POOL_DEGRADED_HEALTHS = new Set(['warning', 'critical', 'offline']);
+
export const useStoragePageSummary = (options: UseStoragePageSummaryOptions) => {
const [summaryTimeRange, setSummaryTimeRange] = createSignal<SummaryTimeRange>('1h');
- const poolCount = createMemo(() => options.filteredRecordCount());
+ const poolCount = createMemo(() => options.filteredRecords().length);
const diskCount = createMemo(() =>
countVisiblePhysicalDisksForNode(
options.selectedNodeId(),
@@ -23,10 +26,33 @@ export const useStoragePageSummary = (options: UseStoragePageSummaryOptions) =>
),
);
+ const poolsDegraded = createMemo(
+ () => options.filteredRecords().filter((record) => POOL_DEGRADED_HEALTHS.has(record.health)).length,
+ );
+ const disksFailing = createMemo(() => {
+ const nodeId = options.selectedNodeId();
+ const isForSelectedNode = (disk: Resource): boolean => {
+ if (!nodeId || nodeId === 'all') return true;
+ const nodeOption = options.nodeOptions().find((option) => option.id === nodeId);
+ if (!nodeOption) return true;
+ const hostname = disk.identity?.hostname ?? disk.canonicalIdentity?.hostname;
+ if (!hostname) return false;
+ if (nodeOption.label === hostname) return true;
+ return (nodeOption.aliases ?? []).includes(hostname);
+ };
+ return options.physicalDisks().filter((disk) => {
+ if (!isForSelectedNode(disk)) return false;
+ if (disk.status === 'degraded' || disk.status === 'offline') return true;
+ return (disk.alerts?.length ?? 0) > 0;
+ }).length;
+ });
+
return {
summaryTimeRange,
setSummaryTimeRange,
poolCount,
diskCount,
+ poolsDegraded,
+ disksFailing,
};
};
diff --git a/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx b/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx
index 120a4c8f44..0e3293627f 100644
--- a/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx
+++ b/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx
@@ -35,6 +35,7 @@ interface WorkloadsSummaryProps {
total: number;
running: number;
stopped: number;
+ alerting?: number;
};
fallbackSnapshots?: WorkloadSummarySnapshot[];
hoveredWorkloadId?: string | null;
@@ -577,8 +578,10 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {
});
const guestCounts = createMemo(() => {
- if (props.fallbackGuestCounts) return props.fallbackGuestCounts;
- return { total: 0, running: 0, stopped: 0 };
+ if (props.fallbackGuestCounts) {
+ return { alerting: 0, ...props.fallbackGuestCounts };
+ }
+ return { total: 0, running: 0, stopped: 0, alerting: 0 };
});
const selectedNodeWorkloadIds = createMemo<Set<string> | null>(() => {
@@ -803,13 +806,22 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {
headerLeft={
<>
<span class="font-medium text-base-content">{guestCounts().total} workloads</span>
- <Show when={guestCounts().running > 0}>
- <span class="text-emerald-600 dark:text-emerald-400">
- {guestCounts().running} running
- </span>
- </Show>
- <Show when={guestCounts().stopped > 0}>
- <span class="text-muted">{guestCounts().stopped} stopped</span>
+ <Show
+ when={guestCounts().stopped > 0 || guestCounts().alerting > 0}
+ fallback={
+ <Show when={guestCounts().total > 0}>
+ <span class="text-emerald-600 dark:text-emerald-400">all running</span>
+ </Show>
+ }
+ >
+ <Show when={guestCounts().alerting > 0}>
+ <span class="text-amber-600 dark:text-amber-400">
+ {guestCounts().alerting} alerting
+ </span>
+ </Show>
+ <Show when={guestCounts().stopped > 0}>
+ <span class="text-muted">{guestCounts().stopped} stopped</span>
+ </Show>
</Show>
<Show when={props.showJumpToActiveRow && props.onJumpToActiveRow}>
<SummaryJumpToRowButton onClick={() => props.onJumpToActiveRow?.()} />
diff --git a/internal/api/license_limits_test_helpers_test.go b/internal/api/license_limits_test_helpers_test.go
index 16095fc1c7..b69e3e57fb 100644
--- a/internal/api/license_limits_test_helpers_test.go
+++ b/internal/api/license_limits_test_helpers_test.go
@@ -27,7 +27,7 @@ func setMaxMonitoredSystemsLicenseForTests(t *testing.T, maxMonitoredSystems int
t.Setenv("PULSE_LICENSE_DEV_MODE", "true")
service := pkglicensing.NewService()
- licenseKey, err := pkglicensing.GenerateLicenseForTesting("[email protected]", pkglicensing.TierPro, 24*time.Hour)
+ licenseKey, err := pkglicensing.GenerateLicenseForTesting("[email protected]", pkglicensing.TierEnterprise, 24*time.Hour)
if err != nil {
t.Fatalf("failed to generate test license: %v", err)
}
diff --git a/scripts/release_control/canonical_completion_guard_test.py b/scripts/release_control/canonical_completion_guard_test.py
index 5e5dc1730e..e50fa1c55c 100644
--- a/scripts/release_control/canonical_completion_guard_test.py
+++ b/scripts/release_control/canonical_completion_guard_test.py
@@ -1341,6 +1341,7 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"frontend-modern/src/components/Storage/__tests__/StorageControls.test.tsx",
"frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx",
"frontend-modern/src/components/Storage/__tests__/StoragePoolDetail.test.tsx",
+ "frontend-modern/src/components/Storage/__tests__/useStoragePageSummary.test.ts",
"frontend-modern/src/components/Storage/code_standards.test.ts",
"frontend-modern/src/features/storageBackups/__tests__/resourceStorageMapping.test.ts",
"frontend-modern/src/features/storageBackups/__tests__/storageAdapters.test.ts",
@@ -1390,6 +1391,7 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"frontend-modern/src/components/Storage/__tests__/StorageControls.test.tsx",
"frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx",
"frontend-modern/src/components/Storage/__tests__/StoragePoolDetail.test.tsx",
+ "frontend-modern/src/components/Storage/__tests__/useStoragePageSummary.test.ts",
"frontend-modern/src/components/Storage/code_standards.test.ts",
"frontend-modern/src/features/storageBackups/__tests__/resourceStorageMapping.test.ts",
"frontend-modern/src/features/storageBackups/__tests__/storageAdapters.test.ts",
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index df732f4073..c147bc48af 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -971,6 +971,7 @@ class SubsystemLookupTest(unittest.TestCase):
"frontend-modern/src/components/Storage/__tests__/StorageControls.test.tsx",
"frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx",
"frontend-modern/src/components/Storage/__tests__/StoragePoolDetail.test.tsx",
+ "frontend-modern/src/components/Storage/__tests__/useStoragePageSummary.test.ts",
"frontend-modern/src/components/Storage/code_standards.test.ts",
"frontend-modern/src/features/storageBackups/__tests__/resourceStorageMapping.test.ts",
"frontend-modern/src/features/storageBackups/__tests__/storageAdapters.test.ts",
@@ -1014,6 +1015,7 @@ class SubsystemLookupTest(unittest.TestCase):
"frontend-modern/src/components/Storage/__tests__/StorageControls.test.tsx",
"frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx",
"frontend-modern/src/components/Storage/__tests__/StoragePoolDetail.test.tsx",
+ "frontend-modern/src/components/Storage/__tests__/useStoragePageSummary.test.ts",
"frontend-modern/src/components/Storage/code_standards.test.ts",
"frontend-modern/src/features/storageBackups/__tests__/resourceStorageMapping.test.ts",
"frontend-modern/src/features/storageBackups/__tests__/storageAdapters.test.ts",