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.

Show a silent agent's retained disk temperatures as last known

rcourtman723f3165a129
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index ae4efc4a57..ecae82c5c7 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -5378,6 +5378,15 @@ Backend API payloads and `frontend-modern/src/types/api.ts` must preserve that
optional map without making it a required compatibility field, and clients must
keep it as descriptive host telemetry rather than a temperature metric,
resource identity, alert metric, or storage/recovery signal.
+Host sensor SMART rows (`smart[]`) also carry the optional per-field
+`collection` status (`PhysicalDiskCollectionStatus`). Backend API payloads and
+`frontend-modern/src/types/api.ts` (`HostDiskSMART.collection`) must preserve it
+on the agent facet. When a host agent passes its reporting lease, a SMART
+temperature that was current (`available`, or present without provenance) keeps
+its value and becomes `unavailable`. A state that was already not available is
+kept. Clients must read that state through the shared
+`isPhysicalDiskTemperatureCurrent` decision before treating the value as a
+current reading.
Agent resource-context sections expose host package posture only as bounded
operational facts: package manager, pending count, inventory state, inspection
freshness, and reboot-required state. Raw package identifiers, versions, and
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 85c281c011..f585ee45a4 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -7803,6 +7803,16 @@ never through the threshold colour classes, so a retained reading cannot look
hot or healthy. Table, drawer and pool surfaces share that one decision in
`frontend-modern/src/features/storageBackups/diskPresentation.ts` rather than
each re-reading `collection.temperature`.
+That decision and its class now live in the small
+`frontend-modern/src/features/storageBackups/diskTemperaturePresentation.ts`
+module, which `diskPresentation.ts` re-exports, so the Machines table and the
+machine drawer's Thermals rows apply the same treatment without pulling the
+Storage presenter into their chunks. Those surfaces and the guest drawer's
+Physical Disks card import it directly.
+When the cell's value is a retained host-agent SMART temperature, it renders
+muted with a dotted underline and screen-reader "last known", as does a
+retained value in the guest card. Tooltip and Thermals rows say "(last known)",
+and the Thermals row carries the collection reason as its title.
The focused browser proofs are
`frontend-modern/src/features/patrol/__tests__/patrolRunAcceptance.test.ts`,
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 87517e7399..a7f0088b89 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -2044,6 +2044,13 @@ render those sensor values already present on the selected resource payload,
but it must not add host powercap reads, sensor-specific history reads,
per-row polling, browser-side command assumptions, or table-wide aggregation
work.
+Host-agent SMART disk rows in `resourceDetailMappers.ts` mark a retained
+temperature "(last known)", with its collection reason as the title, from the
+payload's own `collection.temperature` state, through `getPhysicalDiskTemperaturePresentation`
+in `frontend-modern/src/features/storageBackups/diskTemperaturePresentation.ts`.
+That module stays separate from `diskPresentation.ts` so the drawer and
+Machines chunks take the decision without the Storage presenter, and the rows
+add no reads, polling or aggregation work.
The Proxmox node drawer overview should follow the existing guest drawer
compact detail-section pattern and expose node-specific context such as platform,
kernel, hardware, raw capacity, telemetry, and thermal facts rather than
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index cd2ec5bf9e..2397cd4bb5 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -3814,6 +3814,21 @@ or alert evaluation. Verification: `diskPresentation.test.ts`,
`diskDetailPresentation.test.ts`, `storagePoolDetailPresentation.test.ts`,
`DiskList.test.tsx` (a row moving between current, retained and legacy states)
and `DiskDetail.test.tsx`.
+The same decision reaches the disks that only a host agent's own SMART rows
+describe. `HostDiskSMART.collection` now crosses into the frontend type, and the
+helpers live in `frontend-modern/src/features/storageBackups/diskTemperaturePresentation.ts`
+(re-exported by `diskPresentation.ts`, one implementation) so the Machines
+table and the machine drawer can use them without loading the Storage
+presenter. The guest drawer's card already loads it for extraction and health.
+A silent agent's retained SMART temperature never becomes the Machines row's
+value while another disk has a current reading. When the machine has no
+positive direct or `temperatureCelsius` reading and no non-standby disk is
+current, the cell shows the hottest retained non-standby value as last known,
+without the per-disk-type threshold colour. The guest drawer's Physical Disks card marks a
+retained value the way the Physical Disks table does. Still presentation only.
+Verification: `diskPresentation.test.ts` (one implementation behind both import
+paths), `agentMachineTableModel.test.ts`, `AgentsMachinesTable.test.tsx`,
+`resourceDetailMappers.test.ts` and `GuestPhysicalDisks.test.tsx`.
Direct SATA, SAS, and NVMe device fallback identities remain compatible.
Controller-member fallback identities add controller/target scope only where
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 79650fb3d1..d14cbc296c 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -2269,6 +2269,20 @@ and temperature facts must also compose the frontend-primitives
`InfoCardKeyValueRow`. Mobile rows retain their condensed endpoint layout;
desktop rows use the shared fixed label track so labels and values remain
visually adjacent instead of spanning the full drawer width.
+A standalone host agent past its reporting lease reaches the Machines table as
+`warning` with `agent.stale`, not `offline`: by the time the lease expires the
+registry has marked its only source stale, which outranks offline. The offline
+metric fallback therefore does not blank its cells, and the temperature cell
+has no such gate. For SMART disk temperatures the provenance travels on
+`agent.sensors.smart[].collection`: the Machines temperature cell
+(`AgentsMachinesTable.tsx`, `agentMachineTableModel.ts`), its tooltip and the
+drawer's Thermals rows (`resourceDetailMappers.ts`) read it through
+`isPhysicalDiskTemperatureCurrent`, so a retained disk reading never stands for
+the machine while another disk has a current one. A positive direct
+`temperature` or `temperatureCelsius` reading carries no collection state and
+still leads the cell. Without one, and with no current non-standby disk, the
+hottest retained non-standby disk reading shows as last known without
+threshold colour.
The same boundary applies to availability facts, resource change-history
metadata, Docker/PBS/PMG service facts, nested PMG queue/mail breakdowns, and
Docker container-update management facts. It also covers action-history facts,
diff --git a/frontend-modern/browser-verification/47c60098fc12bf96.json b/frontend-modern/browser-verification/47c60098fc12bf96.json
new file mode 100644
index 0000000000..eb0d451e5a
--- /dev/null
+++ b/frontend-modern/browser-verification/47c60098fc12bf96.json
@@ -0,0 +1,54 @@
+{
+ "version": 1,
+ "base_sha": "dcb69cfb020193d05d9e4e668d19b820a0c46d31",
+ "verified_at": "2026-10-06T22:07:56Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts",
+ "frontend-modern/src/components/Workloads/GuestPhysicalDisks.tsx",
+ "frontend-modern/src/features/standalone/AgentsMachinesTable.tsx",
+ "frontend-modern/src/features/standalone/agentMachineTableModel.ts",
+ "frontend-modern/src/features/storageBackups/diskPresentation.ts",
+ "frontend-modern/src/features/storageBackups/diskTemperaturePresentation.ts",
+ "frontend-modern/src/types/api.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts": "6cdf797534d6ecba8f8007561195f9245899ff881a225f83c2c6c6293b557f8c",
+ "frontend-modern/src/components/Workloads/GuestPhysicalDisks.tsx": "98e9dc568360b5b6c9552433207e0e2fa78b91ba17da53fa513fb42484373ff5",
+ "frontend-modern/src/features/standalone/AgentsMachinesTable.tsx": "a1dfacc661118c77fea482d26ffbc6d1c6aca0d351d77744f7a2dbbd4770ef6f",
+ "frontend-modern/src/features/standalone/agentMachineTableModel.ts": "1f9be08ed7100a330142eab8900b04474360785e75c1b95a8a42d4bc35fa7233",
+ "frontend-modern/src/features/storageBackups/diskPresentation.ts": "debb0d30e95b84d010d5b7478d61ce5fa9487c0bfb43b3eb812e16b4a75acf2e",
+ "frontend-modern/src/features/storageBackups/diskTemperaturePresentation.ts": "c62e4d1e74b9278ef34d93e8101c3d41ab67b17885b6810116a2f96bd112301c",
+ "frontend-modern/src/types/api.ts": "bb2712595745499cc51ed5c6e54ea24998e00d42ce45c8715b1d6c3eed6afc3e"
+ },
+ "routes": [
+ "/standalone",
+ "/proxmox?q=analytics-batch-01"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "Private mock stack built from this tree (base dcb69cfb02) plus a local-only go build -overlay of internal/mock/generator.go: three standalone Linux agents get SMART rows; Apollo-114 (CPU sensors) and Meridian-731 (SMART only) are stamped as State.ExpireHostTelemetry does (status offline, temperatures kept, collection.temperature unavailable 'host agent stopped reporting', source kept), Europa-405 keeps reporting. /api/resources returned agent.sensors.smart[].collection end to end, status warning and agent.stale true for the silent agents.",
+ "Same-session control with the HEAD runtime files under the same Vite: Meridian-731's Temp cell rendered 52°C in threshold green, the tooltip and the drawer Thermals card listed the retained disks as plain current readings, and the guest Physical Disks card showed plain muted 52°C/41°C with no last-known cue.",
+ "After: Meridian-731's Temp cell renders '52°C' muted (slate-600 light, slate-400 dark) with a dotted underline, no threshold colour and screen-reader ', last known'; its tooltip lists both disks '(last known)' muted. Apollo-114 keeps its CPU package value (no collection state) while its disk tooltip rows read '(last known)'. Europa-405 is unchanged.",
+ "Machine drawer (Platform details > Machine details > Thermals) at desktop and phone: 'Disk nvme0n1 52°C (last known)' and 'Disk sda 41°C (last known)' with title 'Last known reading, not current: host agent stopped reporting'; cpu.package unchanged.",
+ "Guest drawer Physical Disks card at desktop and phone: Playwright routes add the agent version a VM-resident agent would carry to analytics-batch-01 and answer its physical_disk child query with Meridian-731's real registry disks (collection state untouched) re-parented to the VM, because mock mode never links an agent inside a VM. Both disks render muted, dotted, with the reason title and ', last known'.",
+ "Light and dark schemes on the Machines page. Bundle check: Standalone +0.22 kB, shared chunk +0.20 kB, WorkloadsSurface and InfrastructureWorkspace flat versus a same-machine main build, no tracked chunk renamed.",
+ "Not covered: a real host agent going silent on hardware, an agent genuinely running inside a VM, or stale-row CPU/memory/disk cells (flagged separately)."
+ ],
+ "interactions": [
+ "Enabled the Temp column from View > column picker on /standalone and read every row's cell text, class, computed colour and text decoration.",
+ "Hovered the Temp cell of the SMART-only and the CPU-sensor silent agents and read the tooltip rows and their muted state.",
+ "Opened the Apollo-114 drawer by row click (desktop) and CPU cell tap (phone), expanded Platform details and the Machine Show details, and read the Thermals rows with their titles.",
+ "Opened the analytics-batch-01 guest drawer from the Proxmox guest table at desktop and phone and read the Physical Disks card summaries, data-temperature-reading, titles and decoration.",
+ "Swapped the runtime files to HEAD under the running Vite for the same-session control, then restored and re-ran every pass on the final tree."
+ ]
+}
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailMappers.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailMappers.test.ts
index 0df9376977..5596569845 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailMappers.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailMappers.test.ts
@@ -10,7 +10,7 @@ import {
} from '@/components/Infrastructure/resourceDetailMappers';
import resourceDetailMappersSource from '@/components/Infrastructure/resourceDetailMappers.ts?raw';
import resourceDetailDiscoveryModelSource from '@/components/Infrastructure/resourceDetailDiscoveryModel.ts?raw';
-import type { Resource } from '@/types/resource';
+import type { PhysicalDiskCollectionStatus, Resource } from '@/types/resource';
const createHybridHostResource = (): Resource =>
({
@@ -203,6 +203,89 @@ describe('resourceDetailMappers', () => {
},
]);
});
+
+ it('marks a silent agent disk temperature as last known and drops disks without one', () => {
+ const rows = buildTemperatureRows({
+ smart: [
+ {
+ device: 'sda',
+ temperature: 71,
+ // A host agent past its reporting lease keeps its last reading.
+ collection: {
+ temperature: {
+ state: 'unavailable',
+ source: 'host_agent',
+ reason: 'host agent stopped reporting',
+ },
+ },
+ },
+ {
+ device: 'sdb',
+ temperature: 38,
+ collection: { temperature: { state: 'available', source: 'smartctl' } },
+ },
+ {
+ device: 'sdc',
+ temperature: 0,
+ collection: {
+ temperature: {
+ state: 'unsupported',
+ source: 'smartctl',
+ reason: 'device did not expose a temperature reading',
+ },
+ },
+ },
+ ],
+ });
+
+ expect(rows).toEqual([
+ {
+ label: 'Disk sda',
+ value: '71°C (last known)',
+ valueTitle: 'Last known reading, not current: host agent stopped reporting',
+ },
+ { label: 'Disk sdb', value: '38°C', valueTitle: '38.0°C' },
+ ]);
+ });
+
+ it('lists a SMART row only for a positive reading in any state, never a standby disk', () => {
+ const states: (PhysicalDiskCollectionStatus | undefined)[] = [
+ undefined,
+ { temperature: { state: 'available', source: 'smartctl' } },
+ { temperature: { state: 'unavailable', source: 'smartctl' } },
+ ];
+ for (const collection of states) {
+ for (const temperature of [0, -3]) {
+ expect(
+ buildTemperatureRows({ smart: [{ device: 'sda', temperature, collection }] }),
+ ).toEqual([]);
+ }
+ }
+
+ expect(
+ buildTemperatureRows({
+ smart: [
+ {
+ device: 'sda',
+ temperature: 44,
+ standby: true,
+ collection: { temperature: { state: 'unavailable', source: 'smartctl' } },
+ },
+ {
+ device: 'sdb',
+ temperature: 39,
+ collection: { temperature: { state: 'missing', source: 'smartctl' } },
+ },
+ ],
+ }),
+ ).toEqual([
+ {
+ label: 'Disk sdb',
+ value: '39°C (last known)',
+ valueTitle: 'Last known reading, not current',
+ },
+ ]);
+ });
});
describe('buildCustomSensorRows', () => {
diff --git a/frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts b/frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts
index 3a77a7aded..b6b94a7ea1 100644
--- a/frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts
+++ b/frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts
@@ -15,6 +15,7 @@ import type {
} from '@/types/api';
import type { Resource, ResourceMetric, ResourceVMwareMeta } from '@/types/resource';
import { formatTemperature } from '@/utils/temperature';
+import { getPhysicalDiskTemperaturePresentation } from '@/features/storageBackups/diskTemperaturePresentation';
import { formatBytes } from '@/utils/format';
import { getActionableAgentIdFromResource } from '@/utils/agentResources';
import {
@@ -502,13 +503,17 @@ export const buildTemperatureRows = (sensors?: HostSensorSummary) => {
const smart = sensors?.smart;
if (smart) {
smart
- .filter((disk) => !disk.standby && Number.isFinite(disk.temperature))
+ .filter((disk) => !disk.standby)
.sort((a, b) => a.device.localeCompare(b.device))
.forEach((disk) => {
+ const temperature = getPhysicalDiskTemperaturePresentation(disk);
+ if (!temperature) return;
+ // A retained reading, such as a silent agent's, says so in the value
+ // because this card has no other cue that it is not current.
rows.push({
label: `Disk ${disk.device}`,
- value: formatTemperature(disk.temperature),
- valueTitle: `${disk.temperature.toFixed(1)}°C`,
+ value: temperature.current ? temperature.label : `${temperature.label} (last known)`,
+ valueTitle: temperature.title ?? `${disk.temperature.toFixed(1)}°C`,
});
});
}
diff --git a/frontend-modern/src/components/Workloads/GuestPhysicalDisks.tsx b/frontend-modern/src/components/Workloads/GuestPhysicalDisks.tsx
index a9c75d3db7..ceeaa26a50 100644
--- a/frontend-modern/src/components/Workloads/GuestPhysicalDisks.tsx
+++ b/frontend-modern/src/components/Workloads/GuestPhysicalDisks.tsx
@@ -5,9 +5,12 @@ import {
extractPhysicalDiskPresentationData,
getPhysicalDiskHealthStatus,
} from '@/features/storageBackups/diskPresentation';
+import {
+ PHYSICAL_DISK_TEMPERATURE_LAST_KNOWN_CLASS,
+ getPhysicalDiskTemperaturePresentation,
+} from '@/features/storageBackups/diskTemperaturePresentation';
import type { Resource } from '@/types/resource';
import { formatBytes } from '@/utils/format';
-import { formatTemperature } from '@/utils/temperature';
// SMART history and chart controls are only needed after a disk row is opened.
// Keep their Storage detail module out of the initial Workloads surface.
@@ -19,6 +22,7 @@ const GuestPhysicalDiskRow: Component<{ disk: Resource }> = (props) => {
const [expanded, setExpanded] = createSignal(false);
const data = () => extractPhysicalDiskPresentationData(props.disk);
const health = () => getPhysicalDiskHealthStatus(data());
+ const temperature = () => getPhysicalDiskTemperaturePresentation(data());
const label = () => data().model || data().devPath || props.disk.name;
return (
@@ -35,8 +39,19 @@ const GuestPhysicalDiskRow: Component<{ disk: Resource }> = (props) => {
<span class={health().tone} title={health().summary}>
{health().label}
</span>
- <Show when={data().temperature > 0}>
- <span class="text-muted">{formatTemperature(data().temperature)}</span>
+ <Show when={temperature()}>
+ {(reading) => (
+ <span
+ class={reading().current ? 'text-muted' : PHYSICAL_DISK_TEMPERATURE_LAST_KNOWN_CLASS}
+ title={reading().title}
+ data-temperature-reading={reading().current ? 'current' : 'last-known'}
+ >
+ {reading().label}
+ <Show when={!reading().current}>
+ <span class="sr-only">, last known</span>
+ </Show>
+ </span>
+ )}
</Show>
<Show when={data().size > 0}>
<span class="text-muted">{formatBytes(data().size)}</span>
diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestPhysicalDisks.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestPhysicalDisks.test.tsx
index 0fa8f2c11a..0b316595db 100644
--- a/frontend-modern/src/components/Workloads/__tests__/GuestPhysicalDisks.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/GuestPhysicalDisks.test.tsx
@@ -1,10 +1,13 @@
import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-library';
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { createSignal } from 'solid-js';
+import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import type { Resource } from '@/types/resource';
import { GuestPhysicalDisks } from '../GuestPhysicalDisks';
const queryState = vi.hoisted(() => ({
resources: [] as Resource[],
+ // Set to a signal accessor to drive live resource updates.
+ accessor: undefined as (() => Resource[]) | undefined,
error: undefined as unknown,
query: '',
enabled: false,
@@ -14,7 +17,10 @@ vi.mock('@/hooks/useUnifiedResources', () => ({
useUnifiedResources: (options: { query: string; enabled: () => boolean }) => {
queryState.query = options.query;
queryState.enabled = options.enabled();
- return { resources: () => queryState.resources, error: () => queryState.error };
+ return {
+ resources: () => (queryState.accessor ? queryState.accessor() : queryState.resources),
+ error: () => queryState.error,
+ };
},
}));
@@ -41,8 +47,15 @@ const disk: Resource = {
};
describe('GuestPhysicalDisks', () => {
+ // The first expansion lazy-loads the Storage disk detail; a cold transform of
+ // that module can outlast findByText's default wait on a loaded machine.
+ beforeAll(async () => {
+ await import('@/components/Storage/DiskDetail');
+ }, 30_000);
+
beforeEach(() => {
queryState.resources = [];
+ queryState.accessor = undefined;
queryState.error = undefined;
queryState.query = '';
queryState.enabled = false;
@@ -84,6 +97,85 @@ describe('GuestPhysicalDisks', () => {
expect(screen.queryByTestId('guest-physical-disks')).toBeNull();
});
+ it('marks a retained disk temperature as last known', () => {
+ queryState.resources = [
+ disk,
+ {
+ ...disk,
+ id: 'disk-101-b',
+ displayName: 'Guest NVMe',
+ physicalDisk: {
+ ...disk.physicalDisk!,
+ devPath: '/dev/nvme0',
+ model: 'Guest NVMe',
+ temperature: 61,
+ collection: {
+ temperature: {
+ state: 'unavailable',
+ source: 'host_agent',
+ reason: 'host agent stopped reporting',
+ },
+ },
+ },
+ },
+ ];
+ render(() => <GuestPhysicalDisks parentId="vm-resource-101" />);
+
+ const [currentRow, retainedRow] = screen.getAllByTestId('guest-physical-disk');
+ const current = within(currentRow).getByText('45°C');
+ expect(current).toHaveAttribute('data-temperature-reading', 'current');
+ expect(current).not.toHaveAttribute('title');
+
+ const retained = retainedRow.querySelector('[data-temperature-reading="last-known"]');
+ expect(retained).not.toBeNull();
+ expect(retained).toHaveTextContent('61°C, last known');
+ expect(retained).toHaveClass('underline', 'decoration-dotted', 'text-muted');
+ expect(retained).toHaveAttribute(
+ 'title',
+ 'Last known reading, not current: host agent stopped reporting',
+ );
+ });
+
+ it('follows a disk between current and last known as its collection state changes', () => {
+ const withReading = (
+ temperature: number,
+ collection?: NonNullable<Resource['physicalDisk']>['collection'],
+ ): Resource => ({
+ ...disk,
+ physicalDisk: { ...disk.physicalDisk!, temperature, collection },
+ });
+ const [resources, setResources] = createSignal<Resource[]>([disk]);
+ queryState.accessor = resources;
+ render(() => <GuestPhysicalDisks parentId="vm-resource-101" />);
+ const reading = () =>
+ screen.getByTestId('guest-physical-disk').querySelector('[data-temperature-reading]');
+
+ expect(reading()).toHaveAttribute('data-temperature-reading', 'current');
+
+ setResources([
+ withReading(61, {
+ temperature: {
+ state: 'unavailable',
+ source: 'host_agent',
+ reason: 'host agent stopped reporting',
+ },
+ }),
+ ]);
+ expect(reading()).toHaveAttribute('data-temperature-reading', 'last-known');
+ expect(reading()).toHaveTextContent('61°C, last known');
+ expect(reading()).toHaveClass('decoration-dotted');
+
+ setResources([withReading(47, { temperature: { state: 'available', source: 'smartctl' } })]);
+ expect(reading()).toHaveAttribute('data-temperature-reading', 'current');
+ expect(reading()).toHaveTextContent('47°C');
+ expect(reading()).not.toHaveTextContent('last known');
+ expect(reading()).not.toHaveAttribute('title');
+ expect(reading()).not.toHaveClass('decoration-dotted');
+
+ setResources([withReading(0)]);
+ expect(reading()).toBeNull();
+ });
+
it('makes a failed child query visible rather than silently implying no disks', () => {
queryState.error = new Error('unavailable');
render(() => <GuestPhysicalDisks parentId="vm-resource-101" />);
diff --git a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
index 7e0f98124e..2609a62fa7 100644
--- a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
+++ b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
@@ -57,6 +57,7 @@ import {
type PlatformResourceStatusFilter,
withPlatformStatusCounts,
} from '@/features/platformPage/sharedPlatformPage';
+import { PHYSICAL_DISK_TEMPERATURE_LAST_KNOWN_CLASS } from '@/features/storageBackups/diskTemperaturePresentation';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import type { Disk } from '@/types/api';
import type { Resource, ResourceAvailabilityMeta } from '@/types/resource';
@@ -76,6 +77,7 @@ import {
import { asTrimmedString } from '@/utils/stringUtils';
import { getPreferredResourceIP } from '@/utils/resourceIdentity';
import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
+import { formatTemperature } from '@/utils/temperature';
import {
RESOURCE_METADATA_CHANGED_EVENT,
type ResourceMetadataChangedDetail,
@@ -101,6 +103,7 @@ import {
getAgentMachineTemperatureTitle,
getAgentMachineThermalPressurePresentation,
getNextAgentMachineSortState,
+ isAgentMachineTemperatureLastKnown,
sortAgentMachines,
type AgentMachineColumn,
type AgentMachineColumnId,
@@ -183,6 +186,8 @@ const AgentMachineMetricTooltip: Component<{
const AgentMachineTemperatureCell: Component<{
celsius: number | undefined;
+ /** The value is a retained reading, not a current one. */
+ lastKnown?: boolean;
metric: AgentMachineTemperatureMetric;
sections: AgentMachineTemperatureDetailSection[];
thresholds?: MetricDisplayThresholds | null;
@@ -222,7 +227,26 @@ const AgentMachineTemperatureCell: Component<{
}
>
{(value) => (
- <TemperatureGauge value={value()} metric={props.metric} thresholds={props.thresholds} />
+ <Show
+ when={!props.lastKnown}
+ fallback={
+ // A retained reading takes no threshold colour; its detail
+ // rows say it is last known.
+ <span
+ class={`text-xs whitespace-nowrap ${PHYSICAL_DISK_TEMPERATURE_LAST_KNOWN_CLASS}`}
+ data-temperature-reading="last-known"
+ >
+ {formatTemperature(value())}
+ <span class="sr-only">, last known</span>
+ </span>
+ }
+ >
+ <TemperatureGauge
+ value={value()}
+ metric={props.metric}
+ thresholds={props.thresholds}
+ />
+ </Show>
)}
</Show>
}
@@ -1565,6 +1589,7 @@ export const AgentsMachinesTable: Component<{
const raidArrays = () => getAgentMachineRaidArrayDetails(machine);
const raidSummary = () => getAgentMachineRaidSummary(machine);
const temperature = () => getAgentMachineTemperatureCelsius(machine);
+ const temperatureLastKnown = () => isAgentMachineTemperatureLastKnown(machine);
const temperatureMetric = () => getAgentMachineTemperatureMetric(machine);
const temperatureThresholds = () =>
temperatureMetric() === 'diskTemperature'
@@ -1791,6 +1816,7 @@ export const AgentsMachinesTable: Component<{
>
<AgentMachineTemperatureCell
celsius={temperature()}
+ lastKnown={temperatureLastKnown()}
metric={temperatureMetric()}
sections={temperatureSections()}
thresholds={temperatureThresholds()}
diff --git a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
index e27ca72c95..39b476ff18 100644
--- a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
+++ b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
@@ -1,4 +1,5 @@
import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
import { createStore, reconcile } from 'solid-js/store';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { AgentMetadataAPI } from '@/api/agentMetadata';
@@ -1159,6 +1160,153 @@ describe('AgentsMachinesTable', () => {
expect(screen.getByText('1400 RPM')).toBeInTheDocument();
});
+ it('shows a silent agent disk temperature as last known, never as a current reading', async () => {
+ // A host agent past its reporting lease is stale and keeps its last SMART
+ // temperatures with a non-available collection state.
+ const stoppedReporting = {
+ temperature: {
+ state: 'unavailable' as const,
+ source: 'smartctl',
+ reason: 'host agent stopped reporting',
+ },
+ };
+ const { container } = render(() => (
+ <AgentsMachinesTable
+ resources={[
+ resource({
+ id: 'silent-nas',
+ name: 'Silent NAS',
+ status: 'warning',
+ agent: {
+ stale: true,
+ sensors: {
+ smart: [
+ { device: '/dev/sda', model: 'Archive HDD', temperature: 71 },
+ { device: '/dev/sdb', model: 'Parity HDD', temperature: 66 },
+ ].map((disk) => ({ ...disk, collection: stoppedReporting })),
+ },
+ },
+ }),
+ resource({
+ id: 'mixed-host',
+ name: 'Mixed Host',
+ agent: {
+ sensors: {
+ smart: [
+ {
+ device: '/dev/sda',
+ model: 'Retained HDD',
+ temperature: 69,
+ collection: stoppedReporting,
+ },
+ { device: '/dev/nvme0', model: 'Fast SSD', temperature: 44 },
+ ],
+ },
+ },
+ }),
+ ]}
+ emptyIcon={emptyIcon}
+ emptyTitle="No machines"
+ emptyDescription="Install Pulse Agent."
+ />
+ ));
+
+ await openMachineColumnPicker();
+ await fireEvent.click(screen.getByLabelText('Temp'));
+
+ const triggerFor = (id: string) =>
+ container.querySelector(
+ `[data-agents-machine-row="${id}"] [data-agent-machine-temperature-trigger="true"]`,
+ ) as HTMLElement | null;
+
+ // Nothing is collected now, so the cell keeps the hottest retained value
+ // without a threshold colour and says it is last known.
+ const silent = triggerFor('silent-nas');
+ expect(silent).not.toBeNull();
+ if (!silent) return;
+ const retained = silent.querySelector('[data-temperature-reading="last-known"]');
+ expect(retained).not.toBeNull();
+ expect(retained).toHaveTextContent('71°C, last known');
+ expect(retained).toHaveClass('underline', 'decoration-dotted', 'text-muted');
+ expect(retained?.className).not.toMatch(/text-(green|yellow|red)-/);
+
+ await fireEvent.mouseEnter(silent);
+ const tooltip = await waitFor(() => {
+ const element = document.querySelector('[data-agent-machine-temperature-tooltip="true"]');
+ expect(element).not.toBeNull();
+ return element as HTMLElement;
+ });
+ expect(within(tooltip).getByText('71°C (last known)')).toHaveClass('text-muted');
+ expect(within(tooltip).getByText('66°C (last known)')).toHaveClass('text-muted');
+ await fireEvent.mouseLeave(silent);
+
+ // A disk collected now leads the cell even when a retained one is hotter.
+ const mixed = triggerFor('mixed-host');
+ expect(mixed).not.toBeNull();
+ if (!mixed) return;
+ expect(mixed).toHaveTextContent('44°C');
+ expect(mixed.querySelector('[data-temperature-reading="last-known"]')).toBeNull();
+ expect(within(mixed).queryByText('69°C')).toBeNull();
+ });
+
+ it('moves a machine temperature between current and last known as its disk reports change', async () => {
+ // Fresh objects per update, like parsed API payloads: the store reconciles
+ // into the objects it was given, so a reused fixture would be rewritten.
+ const collected = () => ({ temperature: { state: 'available' as const, source: 'smartctl' } });
+ const stoppedReporting = () => ({
+ temperature: {
+ state: 'unavailable' as const,
+ source: 'smartctl',
+ reason: 'host agent stopped reporting',
+ },
+ });
+ const nas = (
+ temperature: number,
+ collection?: ReturnType<typeof collected> | ReturnType<typeof stoppedReporting>,
+ ) =>
+ resource({
+ id: 'nas',
+ name: 'NAS',
+ agent: {
+ sensors: { smart: [{ device: '/dev/sda', type: 'sata', temperature, collection }] },
+ },
+ });
+ const [resources, setResources] = createSignal<Resource[]>([nas(52, collected())]);
+ const { container } = render(() => (
+ <AgentsMachinesTable
+ resources={resources()}
+ emptyIcon={emptyIcon}
+ emptyTitle="No machines"
+ emptyDescription="Install Pulse Agent."
+ />
+ ));
+
+ await openMachineColumnPicker();
+ await fireEvent.click(screen.getByLabelText('Temp'));
+ const cell = () =>
+ container.querySelector(
+ '[data-agents-machine-row="nas"] [data-agent-machine-temperature-trigger="true"]',
+ ) as HTMLElement;
+ const lastKnown = () => cell().querySelector('[data-temperature-reading="last-known"]');
+
+ expect(cell()).toHaveTextContent('52°C');
+ expect(lastKnown()).toBeNull();
+
+ setResources([nas(52, stoppedReporting())]);
+ await waitFor(() => expect(lastKnown()).not.toBeNull());
+ expect(cell()).toHaveTextContent('52°C, last known');
+
+ setResources([nas(47, collected())]);
+ await waitFor(() => expect(lastKnown()).toBeNull());
+ expect(cell()).toHaveTextContent('47°C');
+ expect(cell().querySelector('.decoration-dotted')).toBeNull();
+ expect(cell()).not.toHaveTextContent('last known');
+
+ setResources([nas(0)]);
+ await waitFor(() => expect(cell()).toHaveTextContent('—'));
+ expect(lastKnown()).toBeNull();
+ });
+
it('shows thermal pressure when macOS reports no Celsius temperature', async () => {
render(() => (
<AgentsMachinesTable
diff --git a/frontend-modern/src/features/standalone/__tests__/agentMachineTableModel.test.ts b/frontend-modern/src/features/standalone/__tests__/agentMachineTableModel.test.ts
index 84404cb6a3..6a947fc371 100644
--- a/frontend-modern/src/features/standalone/__tests__/agentMachineTableModel.test.ts
+++ b/frontend-modern/src/features/standalone/__tests__/agentMachineTableModel.test.ts
@@ -6,11 +6,14 @@ import {
getAgentMachineDiskIODetails,
getAgentMachineGPUTitle,
getAgentMachineGPUUtilizationPercent,
+ getAgentMachineHottestSmartDiskType,
getAgentMachineNetworkInterfaceDetails,
getAgentMachineRaidArrayDetails,
getAgentMachineTemperatureCelsius,
+ getAgentMachineTemperatureDetailSections,
getAgentMachineTemperatureMetric,
getAgentMachineTemperatureTitle,
+ isAgentMachineTemperatureLastKnown,
matchesAgentMachineSearch,
sortAgentMachines,
} from '../agentMachineTableModel';
@@ -227,6 +230,167 @@ describe('agentMachineTableModel', () => {
expect(getAgentMachineTemperatureMetric(machine)).toBe('diskTemperature');
});
+ it('shows a retained SMART temperature only as last known', () => {
+ // A host agent past its reporting lease keeps its last SMART temperature
+ // with a non-available collection state.
+ const stoppedReporting = {
+ temperature: {
+ state: 'unavailable' as const,
+ source: 'host_agent',
+ reason: 'host agent stopped reporting',
+ },
+ };
+ const mixed = resource({
+ agent: {
+ sensors: {
+ smart: [
+ {
+ device: '/dev/sda',
+ model: 'Retained HDD',
+ type: 'sas',
+ temperature: 71,
+ collection: stoppedReporting,
+ },
+ {
+ device: '/dev/nvme0',
+ model: 'Fast SSD',
+ type: 'nvme',
+ temperature: 44,
+ collection: { temperature: { state: 'available' as const, source: 'smartctl' } },
+ },
+ // Agents that predate collection state report no provenance.
+ { device: '/dev/sdb', temperature: 39 },
+ { device: '/dev/sdc', model: 'Cold Standby', temperature: 0, standby: true },
+ ],
+ },
+ },
+ });
+
+ // A disk collected now outranks a hotter retained one.
+ expect(getAgentMachineTemperatureCelsius(mixed)).toBe(44);
+ expect(isAgentMachineTemperatureLastKnown(mixed)).toBe(false);
+ expect(getAgentMachineTemperatureMetric(mixed)).toBe('diskTemperature');
+ expect(getAgentMachineHottestSmartDiskType(mixed)).toBe('nvme');
+ expect(getAgentMachineTemperatureTitle(mixed).split('\n')).toEqual([
+ 'Disk Temperatures',
+ 'Disk /dev/nvme0 Fast SSD: 44°C',
+ 'Disk /dev/sdb: 39°C',
+ 'Disk /dev/sda Retained HDD: 71°C (last known)',
+ 'Disk /dev/sdc Cold Standby: standby',
+ ]);
+ expect(getAgentMachineTemperatureDetailSections(mixed)[0].rows[2]).toEqual({
+ label: 'Disk /dev/sda Retained HDD',
+ value: '71°C (last known)',
+ muted: true,
+ });
+
+ // With nothing collected now, the cell keeps the hottest retained value
+ // and marks it last known.
+ const onlyRetained = resource({
+ agent: {
+ sensors: {
+ smart: [
+ { device: '/dev/sda', type: 'sata', temperature: 71, collection: stoppedReporting },
+ { device: '/dev/nvme0', type: 'nvme', temperature: 58, collection: stoppedReporting },
+ ],
+ },
+ },
+ });
+ expect(getAgentMachineTemperatureCelsius(onlyRetained)).toBe(71);
+ expect(isAgentMachineTemperatureLastKnown(onlyRetained)).toBe(true);
+ expect(getAgentMachineTemperatureMetric(onlyRetained)).toBe('diskTemperature');
+ expect(getAgentMachineHottestSmartDiskType(onlyRetained)).toBe('sata');
+ expect(getAgentMachineTemperatureTitle(onlyRetained)).toBe(
+ 'Disk Temperatures\nDisk /dev/sda: 71°C (last known)\nDisk /dev/nvme0: 58°C (last known)',
+ );
+
+ // CPU sensors carry no collection state, so they still lead the cell.
+ const withSensors = resource({
+ agent: {
+ sensors: {
+ temperatureCelsius: { 'cpu.package': 49 },
+ smart: [{ device: '/dev/sda', temperature: 71, collection: stoppedReporting }],
+ },
+ },
+ });
+ expect(getAgentMachineTemperatureCelsius(withSensors)).toBe(49);
+ expect(isAgentMachineTemperatureLastKnown(withSensors)).toBe(false);
+ expect(getAgentMachineTemperatureMetric(withSensors)).toBe('temperature');
+ });
+
+ it('offers only positive, non-standby SMART readings to the cell, behind direct and CPU sensors', () => {
+ const stoppedReporting = {
+ temperature: {
+ state: 'unavailable' as const,
+ source: 'smartctl',
+ reason: 'host agent stopped reporting',
+ },
+ };
+ const retainedDisk = (temperature: number) => ({
+ device: '/dev/sda',
+ temperature,
+ collection: stoppedReporting,
+ });
+
+ // A disk in standby is never a temperature candidate, retained or not.
+ const standbyOnly = resource({
+ agent: { sensors: { smart: [{ ...retainedDisk(52), standby: true }] } },
+ });
+ expect(getAgentMachineTemperatureCelsius(standbyOnly)).toBeUndefined();
+ expect(isAgentMachineTemperatureLastKnown(standbyOnly)).toBe(false);
+ expect(getAgentMachineTemperatureTitle(standbyOnly)).toBe(
+ 'Disk Temperatures\nDisk /dev/sda: standby',
+ );
+
+ // A direct machine temperature leads a retained disk.
+ const direct = resource({
+ temperature: 47,
+ agent: { sensors: { smart: [retainedDisk(71)] } },
+ });
+ expect(getAgentMachineTemperatureCelsius(direct)).toBe(47);
+ expect(isAgentMachineTemperatureLastKnown(direct)).toBe(false);
+ expect(getAgentMachineTemperatureMetric(direct)).toBe('temperature');
+
+ // Additional sensors never lead the cell, so the retained disk is shown.
+ const additionalOnly = resource({
+ agent: { sensors: { additional: { vrm: 49 }, smart: [retainedDisk(71)] } },
+ });
+ expect(getAgentMachineTemperatureCelsius(additionalOnly)).toBe(71);
+ expect(isAgentMachineTemperatureLastKnown(additionalOnly)).toBe(true);
+
+ // Sorting follows the value the cell shows: a hotter retained disk does not
+ // lift a machine whose shown reading is a cooler current one.
+ const machines = [
+ resource({
+ id: 'retained',
+ name: 'Retained',
+ agent: { sensors: { smart: [retainedDisk(71)] } },
+ }),
+ resource({
+ id: 'mixed',
+ name: 'Mixed',
+ agent: {
+ sensors: { smart: [retainedDisk(80), { device: '/dev/sdb', temperature: 35 }] },
+ },
+ }),
+ resource({
+ id: 'current',
+ name: 'Current',
+ agent: { sensors: { smart: [{ device: '/dev/sda', temperature: 50 }] } },
+ }),
+ ];
+ const sortedIds = (direction: 'asc' | 'desc') =>
+ sortAgentMachines(
+ machines,
+ 'temp',
+ direction,
+ () => '',
+ () => '',
+ ).map((machine) => machine.id);
+ expect(sortedIds('desc')).toEqual(['retained', 'current', 'mixed']);
+ expect(sortedIds('asc')).toEqual(['mixed', 'current', 'retained']);
+ });
+
it('prefers direct and sensor temperatures over SMART fallback temperatures', () => {
const direct = resource({
temperature: 55,
diff --git a/frontend-modern/src/features/standalone/agentMachineTableModel.ts b/frontend-modern/src/features/standalone/agentMachineTableModel.ts
index 5fe81f91f9..661e02c86c 100644
--- a/frontend-modern/src/features/standalone/agentMachineTableModel.ts
+++ b/frontend-modern/src/features/standalone/agentMachineTableModel.ts
@@ -2,6 +2,7 @@ import type { ColumnDef } from '@/hooks/useColumnVisibility';
import type { HostDiskIO, HostRAIDArray, HostRAIDDevice } from '@/types/api';
import type { Resource } from '@/types/resource';
import { getPlatformTableFiniteMetric } from '@/features/platformPage/sharedPlatformPage';
+import { isPhysicalDiskTemperatureCurrent } from '@/features/storageBackups/diskTemperaturePresentation';
import { formatBytes, normalizeDiskArray } from '@/utils/format';
import { asTrimmedString } from '@/utils/stringUtils';
@@ -155,6 +156,9 @@ type TemperatureReading = {
type SmartTemperatureReading = TemperatureReading & {
standby?: boolean;
diskType?: string;
+ // False for a retained value, such as the last temperature of a host agent
+ // that stopped reporting.
+ current: boolean;
};
export type AgentMachineTemperatureDetailRow = {
@@ -257,13 +261,21 @@ const getSmartTemperatureReadings = (machine: Resource): SmartTemperatureReading
value: temperature ?? 0,
standby: disk.standby,
diskType: asTrimmedString(disk.type),
+ current: isPhysicalDiskTemperatureCurrent(disk.collection),
});
return readings;
}, []);
-const getActiveSmartTemperatureReadings = (machine: Resource): TemperatureReading[] =>
+// Only a temperature collected now can stand for the machine or pick its
+// threshold. A retained one stays in the detail rows, marked last known.
+const getActiveSmartTemperatureReadings = (machine: Resource): SmartTemperatureReading[] =>
getSmartTemperatureReadings(machine).filter(
- (reading): reading is TemperatureReading => !reading.standby && reading.value > 0,
+ (reading) => !reading.standby && reading.value > 0 && reading.current,
+ );
+
+const getLastKnownSmartTemperatureReadings = (machine: Resource): SmartTemperatureReading[] =>
+ getSmartTemperatureReadings(machine).filter(
+ (reading) => !reading.standby && reading.value > 0 && !reading.current,
);
const byHighestTemperature = (left: TemperatureReading, right: TemperatureReading): number =>
@@ -536,22 +548,38 @@ export const getAgentMachineDiskIODetails = (machine: Resource): AgentMachineDis
}, []);
};
+const hasMachineSensorTemperature = (machine: Resource): boolean =>
+ positiveTemperature(machine.temperature) !== undefined ||
+ getSensorTemperatureReadings(machine).length > 0;
+
+// The SMART readings the cell falls back to: the ones collected now, or the
+// retained ones when no disk has a current reading.
+const getCellSmartTemperatureReadings = (machine: Resource): SmartTemperatureReading[] => {
+ const active = getActiveSmartTemperatureReadings(machine);
+ return active.length > 0 ? active : getLastKnownSmartTemperatureReadings(machine);
+};
+
export const getAgentMachineTemperatureCelsius = (machine: Resource): number | undefined => {
const direct = positiveTemperature(machine.temperature);
if (direct !== undefined) return direct;
return (
maxTemperatureReading(getSensorTemperatureReadings(machine)) ??
- maxTemperatureReading(getActiveSmartTemperatureReadings(machine))
+ maxTemperatureReading(getCellSmartTemperatureReadings(machine))
);
};
-// Disk type of the hottest active SMART reading — the disk whose temperature
-// the cell displays when it falls back to the diskTemperature metric.
+// True when the cell's value is a retained SMART reading, such as the last
+// disk temperature of a host agent that stopped reporting.
+export const isAgentMachineTemperatureLastKnown = (machine: Resource): boolean =>
+ !hasMachineSensorTemperature(machine) &&
+ getActiveSmartTemperatureReadings(machine).length === 0 &&
+ getLastKnownSmartTemperatureReadings(machine).length > 0;
+
+// Disk type of the hottest SMART reading the cell displays when it falls back
+// to the diskTemperature metric.
export const getAgentMachineHottestSmartDiskType = (machine: Resource): string | undefined => {
- const readings = getSmartTemperatureReadings(machine).filter(
- (reading) => !reading.standby && reading.value > 0,
- );
+ const readings = getCellSmartTemperatureReadings(machine);
if (readings.length === 0) return undefined;
return readings.reduce((worst, reading) => (reading.value > worst.value ? reading : worst))
.diskType;
@@ -560,13 +588,8 @@ export const getAgentMachineHottestSmartDiskType = (machine: Resource): string |
export const getAgentMachineTemperatureMetric = (
machine: Resource,
): AgentMachineTemperatureMetric => {
- if (positiveTemperature(machine.temperature) !== undefined) return 'temperature';
- if (maxTemperatureReading(getSensorTemperatureReadings(machine)) !== undefined) {
- return 'temperature';
- }
- if (maxTemperatureReading(getActiveSmartTemperatureReadings(machine)) !== undefined) {
- return 'diskTemperature';
- }
+ if (hasMachineSensorTemperature(machine)) return 'temperature';
+ if (getCellSmartTemperatureReadings(machine).length > 0) return 'diskTemperature';
return 'temperature';
};
@@ -585,6 +608,13 @@ export const getAgentMachineTemperatureDetailSections = (
label: `Disk ${reading.label}`,
value: formatTemperatureValue(reading),
}));
+ const lastKnownSmartReadings = getLastKnownSmartTemperatureReadings(machine)
+ .sort(byHighestTemperature)
+ .map((reading) => ({
+ label: `Disk ${reading.label}`,
+ value: `${formatTemperatureValue(reading)} (last known)`,
+ muted: true,
+ }));
const standbySmartReadings = getSmartTemperatureReadings(machine)
.filter((reading) => reading.standby)
.sort(byLabel)
@@ -609,7 +639,11 @@ export const getAgentMachineTemperatureDetailSections = (
...section('Temperatures', capTemperatureRows(sensorReadings)),
...section(
'Disk Temperatures',
- capTemperatureRows([...activeSmartReadings, ...standbySmartReadings]),
+ capTemperatureRows([
+ ...activeSmartReadings,
+ ...lastKnownSmartReadings,
+ ...standbySmartReadings,
+ ]),
),
...section('Fan Speeds', capTemperatureRows(fanReadings)),
...section('Other Sensors', capTemperatureRows(additionalReadings)),
diff --git a/frontend-modern/src/features/storageBackups/__tests__/diskPresentation.test.ts b/frontend-modern/src/features/storageBackups/__tests__/diskPresentation.test.ts
index a18d7ccdfe..c3c13377bd 100644
--- a/frontend-modern/src/features/storageBackups/__tests__/diskPresentation.test.ts
+++ b/frontend-modern/src/features/storageBackups/__tests__/diskPresentation.test.ts
@@ -18,6 +18,7 @@ import {
PHYSICAL_DISK_SOURCE_BADGE_CLASS,
PHYSICAL_DISK_TABLE_CLASS,
PHYSICAL_DISK_TABLE_ROW_HOVER_CLASS,
+ PHYSICAL_DISK_TEMPERATURE_LAST_KNOWN_CLASS,
getPhysicalDiskEmptyStatePresentation,
getPhysicalDiskCellPaddingClass,
getPhysicalDiskColumnWidthStyle,
@@ -27,6 +28,7 @@ import {
getPhysicalDiskHealthStatus,
getPhysicalDiskHealthSummary,
getPhysicalDiskHostLabel,
+ getPhysicalDiskLastKnownTemperatureTitle,
getPhysicalDiskLifeLabel,
getPhysicalDiskLifeTextClass,
getPhysicalDiskNormalizedHealth,
@@ -48,6 +50,7 @@ import {
normalizePhysicalDiskFacetFilter,
type PhysicalDiskPresentationData,
} from '@/features/storageBackups/diskPresentation';
+import * as diskTemperaturePresentation from '@/features/storageBackups/diskTemperaturePresentation';
function makeDiskData(
overrides: Partial<PhysicalDiskPresentationData> = {},
@@ -131,6 +134,23 @@ describe('diskPresentation', () => {
}
});
+ it('serves the same temperature decision the Machines table and drawers import directly', () => {
+ // Tables outside Storage import the small module so they do not pull this
+ // one into their chunks. Both paths must stay one implementation.
+ expect(isPhysicalDiskTemperatureCurrent).toBe(
+ diskTemperaturePresentation.isPhysicalDiskTemperatureCurrent,
+ );
+ expect(getPhysicalDiskTemperaturePresentation).toBe(
+ diskTemperaturePresentation.getPhysicalDiskTemperaturePresentation,
+ );
+ expect(getPhysicalDiskLastKnownTemperatureTitle).toBe(
+ diskTemperaturePresentation.getPhysicalDiskLastKnownTemperatureTitle,
+ );
+ expect(PHYSICAL_DISK_TEMPERATURE_LAST_KNOWN_CLASS).toBe(
+ diskTemperaturePresentation.PHYSICAL_DISK_TEMPERATURE_LAST_KNOWN_CLASS,
+ );
+ });
+
it('distinguishes unsupported, unavailable, and unexpectedly missing disk evidence', () => {
expect(
getPhysicalDiskFieldStatusMessage('Disk I/O', {
diff --git a/frontend-modern/src/features/storageBackups/diskPresentation.ts b/frontend-modern/src/features/storageBackups/diskPresentation.ts
index 2499be5969..fe1ad5ad4e 100644
--- a/frontend-modern/src/features/storageBackups/diskPresentation.ts
+++ b/frontend-modern/src/features/storageBackups/diskPresentation.ts
@@ -14,7 +14,6 @@ import { getAllFilterOptionLabel } from '@/components/shared/filterOptionPresent
import { getPhysicalDiskNodeIdentity } from '@/components/Storage/diskResourceUtils';
import { getInfrastructureSettingsLocationLabel } from '@/utils/infrastructureSettingsPresentation';
import { normalizeStorageSourceKey, storageSourceMatchesFilter } from '@/utils/storageSources';
-import { formatTemperature } from '@/utils/temperature';
import type { NormalizedHealth, StorageHealthFilter } from './models';
import { matchesStorageNodeTerms, parseStorageSearchQuery } from './storageSearchQuery';
@@ -254,11 +253,6 @@ export const PHYSICAL_DISK_HEALTH_WRAP_CLASS =
// that would compete with it for the track.
export const PHYSICAL_DISK_HEALTH_LABEL_CLASS = 'shrink-0 text-[11px] font-semibold';
export const PHYSICAL_DISK_TEMPERATURE_CLASS = 'text-[11px] font-medium';
-// A retained reading takes no threshold colour, so it cannot read as a disk
-// running hot or cool right now. The dotted underline marks the value as one
-// its title explains.
-export const PHYSICAL_DISK_TEMPERATURE_LAST_KNOWN_CLASS =
- 'text-muted underline decoration-dotted underline-offset-2 cursor-help';
export const PHYSICAL_DISK_SIZE_VALUE_CLASS = 'text-[11px] text-base-content';
const titleize = (value: string | undefined | null): string =>
@@ -473,44 +467,15 @@ export function getPhysicalDiskFieldStatusMessage(
}
}
-// Normalization may keep the last known temperature when the current
-// observation is not available, such as a disk in standby or a host agent that
-// stopped reporting. The value is a current reading only when its collection
-// state is available, or when the source predates collection state.
-export function isPhysicalDiskTemperatureCurrent(
- collection: PhysicalDiskCollectionStatus | null | undefined,
-): boolean {
- const state = collection?.temperature?.state;
- return !state || state === 'available';
-}
-
-export function getPhysicalDiskLastKnownTemperatureTitle(
- status: PhysicalDiskFieldStatus | null | undefined,
-): string {
- const reason = status?.reason?.trim();
- return reason ? `Last known reading, not current: ${reason}` : 'Last known reading, not current';
-}
-
-export interface PhysicalDiskTemperaturePresentation {
- label: string;
- current: boolean;
- /** Set only for a last-known reading: why the value is not current. */
- title?: string;
-}
-
-export function getPhysicalDiskTemperaturePresentation(
- disk: Pick<PhysicalDiskPresentationData, 'temperature' | 'collection'>,
-): PhysicalDiskTemperaturePresentation | null {
- if (!Number.isFinite(disk.temperature) || disk.temperature <= 0) return null;
- const current = isPhysicalDiskTemperatureCurrent(disk.collection);
- return {
- label: formatTemperature(disk.temperature),
- current,
- title: current
- ? undefined
- : getPhysicalDiskLastKnownTemperatureTitle(disk.collection?.temperature),
- };
-}
+// Whether a disk temperature is a current reading lives in its own module so
+// tables outside the Storage page can use it without this one.
+export {
+ PHYSICAL_DISK_TEMPERATURE_LAST_KNOWN_CLASS,
+ getPhysicalDiskLastKnownTemperatureTitle,
+ getPhysicalDiskTemperaturePresentation,
+ isPhysicalDiskTemperatureCurrent,
+ type PhysicalDiskTemperaturePresentation,
+} from './diskTemperaturePresentation';
export function getPhysicalDiskCollectionMessages(disk: PhysicalDiskPresentationData): string[] {
const collection = disk.collection;
diff --git a/frontend-modern/src/features/storageBackups/diskTemperaturePresentation.ts b/frontend-modern/src/features/storageBackups/diskTemperaturePresentation.ts
new file mode 100644
index 0000000000..acb63c612a
--- /dev/null
+++ b/frontend-modern/src/features/storageBackups/diskTemperaturePresentation.ts
@@ -0,0 +1,53 @@
+import type { PhysicalDiskCollectionStatus, PhysicalDiskFieldStatus } from '@/types/resource';
+import { formatTemperature } from '@/utils/temperature';
+
+// The canonical decision on whether a disk temperature is a current reading.
+// It lives apart from diskPresentation so the Machines table, the machine
+// drawer and the guest drawer can use it without pulling the Storage page
+// presentation module into their chunks.
+
+// A retained reading takes no threshold colour, so it cannot read as a disk
+// running hot or cool right now. The dotted underline marks the value as one
+// its title explains.
+export const PHYSICAL_DISK_TEMPERATURE_LAST_KNOWN_CLASS =
+ 'text-muted underline decoration-dotted underline-offset-2 cursor-help';
+
+// Normalization may keep the last known temperature when the current
+// observation is not available, such as a disk in standby or a host agent that
+// stopped reporting. The value is a current reading only when its collection
+// state is available, or when the source predates collection state.
+export function isPhysicalDiskTemperatureCurrent(
+ collection: PhysicalDiskCollectionStatus | null | undefined,
+): boolean {
+ const state = collection?.temperature?.state;
+ return !state || state === 'available';
+}
+
+export function getPhysicalDiskLastKnownTemperatureTitle(
+ status: PhysicalDiskFieldStatus | null | undefined,
+): string {
+ const reason = status?.reason?.trim();
+ return reason ? `Last known reading, not current: ${reason}` : 'Last known reading, not current';
+}
+
+export interface PhysicalDiskTemperaturePresentation {
+ label: string;
+ current: boolean;
+ /** Set only for a last-known reading: why the value is not current. */
+ title?: string;
+}
+
+export function getPhysicalDiskTemperaturePresentation(disk: {
+ temperature: number;
+ collection?: PhysicalDiskCollectionStatus | null;
+}): PhysicalDiskTemperaturePresentation | null {
+ if (!Number.isFinite(disk.temperature) || disk.temperature <= 0) return null;
+ const current = isPhysicalDiskTemperatureCurrent(disk.collection);
+ return {
+ label: formatTemperature(disk.temperature),
+ current,
+ title: current
+ ? undefined
+ : getPhysicalDiskLastKnownTemperatureTitle(disk.collection?.temperature),
+ };
+}
diff --git a/frontend-modern/src/types/api.ts b/frontend-modern/src/types/api.ts
index 5b15015d7a..eaa1bfcc3f 100644
--- a/frontend-modern/src/types/api.ts
+++ b/frontend-modern/src/types/api.ts
@@ -626,6 +626,9 @@ export interface HostDiskSMART {
temperature: number; // Temperature in Celsius
health?: string; // PASSED, FAILED, UNKNOWN
standby?: boolean; // True if disk was in standby
+ // A non-available temperature state marks the value as last known, such as
+ // a host agent that stopped reporting.
+ collection?: import('./resource').PhysicalDiskCollectionStatus;
}
export interface HostRAIDArray {