From 1ef938071a9aa80e7e62af257c8d44daee65aec7 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Wed, 1 Oct 2025 08:21:50 +0000 Subject: [PATCH] fix: merge temperature data from WebSocket state into Settings node list - Settings page now merges live temperature data from WebSocket state - Temperature badge will now appear when SSH monitoring is active - Fix missing onMount import in GuestRow.tsx The Settings page loads node config from /api/config/nodes which doesn't include runtime temperature data. This change merges temperature from the WebSocket state (which has live monitoring data) so the temperature badge displays correctly. --- .../src/components/Dashboard/GuestRow.tsx | 2 +- .../src/components/Settings/Settings.tsx | 26 +++++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/frontend-modern/src/components/Dashboard/GuestRow.tsx b/frontend-modern/src/components/Dashboard/GuestRow.tsx index 499c50c6b..74e65a6af 100644 --- a/frontend-modern/src/components/Dashboard/GuestRow.tsx +++ b/frontend-modern/src/components/Dashboard/GuestRow.tsx @@ -1,4 +1,4 @@ -import { Show, createMemo, createSignal, createEffect } from 'solid-js'; +import { Show, createMemo, createSignal, createEffect, onMount } from 'solid-js'; import type { VM, Container } from '@/types/api'; import { formatBytes, formatUptime } from '@/utils/format'; import { MetricBar } from './MetricBar'; diff --git a/frontend-modern/src/components/Settings/Settings.tsx b/frontend-modern/src/components/Settings/Settings.tsx index 9a36ac298..3977e94bd 100644 --- a/frontend-modern/src/components/Settings/Settings.tsx +++ b/frontend-modern/src/components/Settings/Settings.tsx @@ -258,14 +258,24 @@ const Settings: Component = () => { const loadNodes = async () => { try { const nodesList = await NodesAPI.getNodes(); - // Add status and other UI fields - const nodesWithStatus = nodesList.map((node) => ({ - ...node, - // Use the hasPassword/hasToken from the API if available, otherwise check local fields - hasPassword: node.hasPassword ?? !!node.password, - hasToken: node.hasToken ?? !!node.tokenValue, - status: node.status || ('pending' as const), - })); + // Merge temperature data from WebSocket state + const currentState = state(); + const nodesWithStatus = nodesList.map((node) => { + // Find matching node in state to get temperature data + const stateNode = + currentState?.pveNodes?.find((n) => n.id === node.id || n.name === node.name) || + currentState?.pbsNodes?.find((n) => n.id === node.id || n.name === node.name); + + return { + ...node, + // Use the hasPassword/hasToken from the API if available, otherwise check local fields + hasPassword: node.hasPassword ?? !!node.password, + hasToken: node.hasToken ?? !!node.tokenValue, + status: node.status || ('pending' as const), + // Merge temperature data from state + temperature: stateNode?.temperature || node.temperature, + }; + }); setNodes(nodesWithStatus); } catch (error) { console.error('Failed to load nodes:', error);