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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
feat: Add Fahrenheit temperature unit option. Related to #957
rcourtman0c3ebef31248
diff --git a/frontend-modern/src/components/Alerts/Thresholds/components/ThresholdBadge.tsx b/frontend-modern/src/components/Alerts/Thresholds/components/ThresholdBadge.tsxindex a3b1af499e..07f0db8ec2 100644--- a/frontend-modern/src/components/Alerts/Thresholds/components/ThresholdBadge.tsx+++ b/frontend-modern/src/components/Alerts/Thresholds/components/ThresholdBadge.tsx@@ -7,6 +7,7 @@import { Component, Show } from 'solid-js';import { getThresholdSeverityColor, SEVERITY_COLORS } from '../types';+import { formatTemperature } from '@/utils/temperature';export interface ThresholdBadgeProps {/** The metric key (cpu, memory, disk, etc.) */@@ -43,7 +44,7 @@ const formatDisplayValue = (metric: string, value: number | undefined): string =// Temperatureif (metric === 'temperature') {- return `${value}°C`;+ return formatTemperature(value);}// Time-baseddiff --git a/frontend-modern/src/components/Alerts/Thresholds/sections/ProxmoxNodesSection.tsx b/frontend-modern/src/components/Alerts/Thresholds/sections/ProxmoxNodesSection.tsxindex bafc28dd00..8bb700fc5e 100644--- a/frontend-modern/src/components/Alerts/Thresholds/sections/ProxmoxNodesSection.tsx+++ b/frontend-modern/src/components/Alerts/Thresholds/sections/ProxmoxNodesSection.tsx@@ -13,6 +13,7 @@ import { GlobalDefaultsRow } from '../components/GlobalDefaultsRow';import type { ThresholdResource, ThresholdValues, ThresholdColumn } from '../types';import type { Alert, Node } from '@/types/api';import type { RawOverrideConfig } from '@/types/alerts';+import { formatTemperature, getTemperatureSymbol } from '@/utils/temperature';/*** Column definitions for Proxmox nodes@@ -21,7 +22,7 @@ const NODE_COLUMNS: ThresholdColumn[] = [{ key: 'cpu', label: 'CPU %', unit: '%' },{ key: 'memory', label: 'Memory %', unit: '%' },{ key: 'disk', label: 'Disk %', unit: '%' },- { key: 'temperature', label: 'Temp °C', unit: '°C' },+ { key: 'temperature', label: `Temp ${getTemperatureSymbol()}`, unit: getTemperatureSymbol() },];export interface ProxmoxNodesSectionProps {@@ -174,7 +175,7 @@ export const ProxmoxNodesSection: Component<ProxmoxNodesSectionProps> = (props)if (value === undefined || value === null) return '—';if (value <= 0) return 'Off';- if (metric === 'temperature') return `${value}°C`;+ if (metric === 'temperature') return formatTemperature(value);if (['cpu', 'memory', 'disk'].includes(metric)) return `${value}%`;return String(value);};diff --git a/frontend-modern/src/components/Alerts/ThresholdsTable.tsx b/frontend-modern/src/components/Alerts/ThresholdsTable.tsxindex da225b07c2..89b045095d 100644--- a/frontend-modern/src/components/Alerts/ThresholdsTable.tsx+++ b/frontend-modern/src/components/Alerts/ThresholdsTable.tsx@@ -42,6 +42,7 @@ import type {import { ResourceTable, Resource, GroupHeaderMeta } from './ResourceTable';import { useAlertsActivation } from '@/stores/alertsActivation';import { logger } from '@/utils/logger';+import { formatTemperature } from '@/utils/temperature';type OverrideType =| 'guest'| 'node'@@ -574,9 +575,9 @@ export function ThresholdsTable(props: ThresholdsTableProps) {return `${value}%`;}- // Temperature in Celsius+ // Temperatureif (metric === 'temperature') {- return `${value}°C`;+ return formatTemperature(value);}if (metric === 'restartWindow') {diff --git a/frontend-modern/src/components/Dashboard/ThresholdSlider.tsx b/frontend-modern/src/components/Dashboard/ThresholdSlider.tsxindex 051783094d..3f884b8281 100644--- a/frontend-modern/src/components/Dashboard/ThresholdSlider.tsx+++ b/frontend-modern/src/components/Dashboard/ThresholdSlider.tsx@@ -1,4 +1,5 @@import { createSignal, createEffect, onMount } from 'solid-js';+import { formatTemperature, getTemperatureSymbol } from '@/utils/temperature';interface ThresholdSliderProps {value: number;@@ -77,15 +78,14 @@ export function ThresholdSlider(props: ThresholdSliderProps) {{/* Colored fill */}<div- class={`absolute left-0 h-3.5 rounded ${- props.type === 'cpu'+ class={`absolute left-0 h-3.5 rounded ${props.type === 'cpu'? 'bg-blue-500/30': props.type === 'memory'? 'bg-green-500/30': props.type === 'disk'? 'bg-amber-500/30': 'bg-rose-500/30'- }`}+ }`}style={{ width: `${calculateVisualPosition(props.value)}%` }}></div>@@ -103,7 +103,7 @@ export function ThresholdSlider(props: ThresholdSliderProps) {style={{ 'touch-action': 'none' }}title={props.type === 'temperature'- ? `Temperature: ${props.value}°C`+ ? `Temperature: ${formatTemperature(props.value)}`: `${props.type.toUpperCase()}: ${props.value}%`}/>@@ -114,19 +114,18 @@ export function ThresholdSlider(props: ThresholdSliderProps) {class={`absolute top-1/2 pointer-events-none z-10 ${colorMap[props.type]}`}style={{left: `${thumbPosition()}%`,- transform: `translateY(-50%) translateX(${- thumbPosition() <= 1+ transform: `translateY(-50%) translateX(${thumbPosition() <= 1? '0%' // At 0-1%, keep at left edge: thumbPosition() >= 99? '-100%' // At 99-100%, keep at right edge: '-50%' // Otherwise center- })`,+ })`,}}><div class="relative"><div class="w-9 h-4 bg-white dark:bg-gray-800 rounded-full shadow-md border-2 border-current flex items-center justify-center"><span class="text-[9px] font-semibold">- {props.type === 'temperature' ? `${props.value}°` : `${props.value}%`}+ {props.type === 'temperature' ? `${props.value}${getTemperatureSymbol().replace('°', '°')}` : `${props.value}%`}</span></div></div>diff --git a/frontend-modern/src/components/Hosts/HostsOverview.tsx b/frontend-modern/src/components/Hosts/HostsOverview.tsxindex b7369e10ae..64e23fa87e 100644--- a/frontend-modern/src/components/Hosts/HostsOverview.tsx+++ b/frontend-modern/src/components/Hosts/HostsOverview.tsx@@ -4,6 +4,7 @@ import { Portal } from 'solid-js/web';import { useNavigate } from '@solidjs/router';import type { Host, HostRAIDArray } from '@/types/api';import { formatBytes, formatRelativeTime, formatUptime } from '@/utils/format';+import { formatTemperature } from '@/utils/temperature';import { Card } from '@/components/shared/Card';import { EmptyState } from '@/components/shared/EmptyState';import { StackedDiskBar } from '@/components/Dashboard/StackedDiskBar';@@ -285,7 +286,7 @@ function HostTemperatureCell(props: { sensors: HostSensorSummaryForCell | null |onMouseLeave={handleMouseLeave}><Show when={primaryTemp() !== null} fallback={<span class="text-gray-400">—</span>}>- {Math.round(primaryTemp()!)}°C+ {formatTemperature(primaryTemp())}</Show></span>@@ -312,7 +313,7 @@ function HostTemperatureCell(props: { sensors: HostSensorSummaryForCell | null |return (<div class="flex justify-between gap-3 py-0.5"><span class="text-gray-400 truncate max-w-[140px]">{formatSensorName(name)}</span>- <span class={`font-medium font-mono ${colorClass}`}>{Math.round(temp)}°C</span>+ <span class={`font-medium font-mono ${colorClass}`}>{formatTemperature(temp)}</span></div>);}}@@ -346,7 +347,7 @@ function HostTemperatureCell(props: { sensors: HostSensorSummaryForCell | null |<span class="text-gray-400 truncate max-w-[140px]" title={disk.model}>{disk.device}</span>- <span class={`font-medium font-mono ${colorClass}`}>{temp}°C</span>+ <span class={`font-medium font-mono ${colorClass}`}>{formatTemperature(temp)}</span></div>);}}@@ -383,7 +384,7 @@ function HostTemperatureCell(props: { sensors: HostSensorSummaryForCell | null |return (<div class="flex justify-between gap-3 py-0.5"><span class="text-gray-400 truncate max-w-[140px]">{formatSensorName(name)}</span>- <span class={`font-medium font-mono ${colorClass}`}>{Math.round(temp)}°C</span>+ <span class={`font-medium font-mono ${colorClass}`}>{formatTemperature(temp)}</span></div>);}}diff --git a/frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx b/frontend-modern/src/components/Settings/GeneralSettingsPanel.tsxindex 73d20baf89..8f1e1b8056 100644--- a/frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx+++ b/frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx@@ -6,6 +6,8 @@ import Sliders from 'lucide-solid/icons/sliders-horizontal';import Activity from 'lucide-solid/icons/activity';import Sun from 'lucide-solid/icons/sun';import Moon from 'lucide-solid/icons/moon';+import Thermometer from 'lucide-solid/icons/thermometer';+import { temperatureStore } from '@/utils/temperature';const PVE_POLLING_MIN_SECONDS = 10;const PVE_POLLING_MAX_SECONDS = 3600;@@ -56,8 +58,8 @@ export const GeneralSettingsPanel: Component<GeneralSettingsPanelProps> = (props<div class="flex items-center gap-3">{/* Animated theme icon */}<div class={`relative p-2.5 rounded-xl transition-all duration-300 ${props.darkMode()- ? 'bg-gradient-to-br from-indigo-500 to-purple-600 shadow-lg shadow-indigo-500/25'- : 'bg-gradient-to-br from-amber-400 to-orange-500 shadow-lg shadow-amber-500/25'+ ? 'bg-gradient-to-br from-indigo-500 to-purple-600 shadow-lg shadow-indigo-500/25'+ : 'bg-gradient-to-br from-amber-400 to-orange-500 shadow-lg shadow-amber-500/25'}`}><div class="relative w-5 h-5"><Sun class={`absolute inset-0 w-5 h-5 text-white transition-all duration-300 ${props.darkMode() ? 'opacity-0 rotate-90 scale-50' : 'opacity-100 rotate-0 scale-100'@@ -85,6 +87,45 @@ export const GeneralSettingsPanel: Component<GeneralSettingsPanelProps> = (props}}/></div>++ {/* Temperature Unit Selector */}+ <div class="flex items-center justify-between gap-4 pt-4 border-t border-gray-200 dark:border-gray-700">+ <div class="flex items-center gap-3">+ <div class="p-2.5 rounded-xl bg-gradient-to-br from-orange-400 to-red-500 shadow-lg shadow-orange-500/25">+ <Thermometer class="w-5 h-5 text-white" strokeWidth={2} />+ </div>+ <div class="text-sm text-gray-600 dark:text-gray-400">+ <p class="font-medium text-gray-900 dark:text-gray-100">+ Temperature unit+ </p>+ <p class="text-xs text-gray-500 dark:text-gray-400">+ Display temperatures in Celsius or Fahrenheit+ </p>+ </div>+ </div>+ <div class="flex items-center gap-1 bg-gray-100 dark:bg-gray-800 rounded-lg p-1">+ <button+ type="button"+ class={`px-3 py-1.5 text-xs font-medium rounded-md transition-all ${temperatureStore.unit() === 'celsius'+ ? 'bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm'+ : 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200'+ }`}+ onClick={() => temperatureStore.setUnit('celsius')}+ >+ °C+ </button>+ <button+ type="button"+ class={`px-3 py-1.5 text-xs font-medium rounded-md transition-all ${temperatureStore.unit() === 'fahrenheit'+ ? 'bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm'+ : 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200'+ }`}+ onClick={() => temperatureStore.setUnit('fahrenheit')}+ >+ °F+ </button>+ </div>+ </div></div></Card>diff --git a/frontend-modern/src/components/Storage/DiskList.tsx b/frontend-modern/src/components/Storage/DiskList.tsxindex 35abb08a7b..62cc9b115f 100644--- a/frontend-modern/src/components/Storage/DiskList.tsx+++ b/frontend-modern/src/components/Storage/DiskList.tsx@@ -1,6 +1,7 @@import { Component, For, Show, createMemo } from 'solid-js';import { Card } from '@/components/shared/Card';import { formatBytes } from '@/utils/format';+import { formatTemperature } from '@/utils/temperature';import type { PhysicalDisk } from '@/types/api';import { useWebSocket } from '@/App';@@ -267,7 +268,7 @@ export const DiskList: Component<DiskListProps> = (props) => {: 'text-green-600 dark:text-green-400'}`}>- {disk.temperature}°C+ {formatTemperature(disk.temperature)}</span></Show></td>diff --git a/frontend-modern/src/components/shared/NodeSummaryTable.tsx b/frontend-modern/src/components/shared/NodeSummaryTable.tsxindex 2e2476d654..120e714c78 100644--- a/frontend-modern/src/components/shared/NodeSummaryTable.tsx+++ b/frontend-modern/src/components/shared/NodeSummaryTable.tsx@@ -5,7 +5,7 @@ import { useWebSocket } from '@/App';import { getAlertStyles } from '@/utils/alerts';import { Card } from '@/components/shared/Card';import { getNodeDisplayName, hasAlternateDisplayName } from '@/utils/nodes';-import { getCpuTemperature } from '@/utils/temperature';+import { getCpuTemperature, formatTemperature } from '@/utils/temperature';import { useAlertsActivation } from '@/stores/alertsActivation';import { buildMetricKey } from '@/utils/metricsKeys';import { StatusDot } from '@/components/shared/StatusDot';@@ -696,7 +696,7 @@ export const NodeSummaryTable: Component<NodeSummaryTableProps> = (props) => {const max = typeof cpuMaxValue === 'number' ? Math.round(cpuMaxValue) : undefined;return (- <div title={`Min: ${min ?? '-'}°C, Max: ${max ?? '-'}°C${hasGPU ? `\nGPU: ${gpus.map(g => `${g.edge ?? g.junction ?? g.mem}°C`).join(', ')}` : ''}`}>+ <div title={`Min: ${min !== undefined ? formatTemperature(min) : '-'}, Max: ${max !== undefined ? formatTemperature(max) : '-'}${hasGPU ? `\nGPU: ${gpus.map(g => formatTemperature(g.edge ?? g.junction ?? g.mem)).join(', ')}` : ''}`}><TemperatureGaugevalue={value}min={min}diff --git a/frontend-modern/src/components/shared/TemperatureGauge.tsx b/frontend-modern/src/components/shared/TemperatureGauge.tsxindex ca43e148a8..8e89281929 100644--- a/frontend-modern/src/components/shared/TemperatureGauge.tsx+++ b/frontend-modern/src/components/shared/TemperatureGauge.tsx@@ -1,4 +1,5 @@import { Component, createMemo } from 'solid-js';+import { formatTemperature } from '@/utils/temperature';interface TemperatureGaugeProps {value: number;@@ -21,7 +22,7 @@ export const TemperatureGauge: Component<TemperatureGaugeProps> = (props) => {return (<span class={`text-xs whitespace-nowrap ${textColorClass()} ${props.class || ''}`}>- {Math.round(props.value)}°C+ {formatTemperature(props.value)}</span>);};diff --git a/frontend-modern/src/utils/alertFormatters.ts b/frontend-modern/src/utils/alertFormatters.tsindex 8ae4f08016..4bc0ebf9d7 100644--- a/frontend-modern/src/utils/alertFormatters.ts+++ b/frontend-modern/src/utils/alertFormatters.ts@@ -1,10 +1,12 @@/*** Utility functions for formatting alert values based on their metric type.- * Temperature metrics should show °C, not percentages.+ * Temperature metrics show the user-selected unit (°C or °F).*/+import { getTemperatureSymbol } from './temperature';+/**- * Metric types that are measured in degrees Celsius rather than percentages.+ * Metric types that are measured in degrees (temperature) rather than percentages.*/const TEMPERATURE_METRIC_TYPES = new Set(['temperature', 'temp']);@@ -16,14 +18,14 @@ const THROUGHPUT_METRIC_TYPES = new Set(['diskRead', 'diskWrite', 'networkIn', '/*** Returns the appropriate unit suffix for a given metric type.* @param metricType The alert's metric type (e.g., 'cpu', 'memory', 'temperature')- * @returns The unit suffix to append to values (e.g., '%', '°C', ' MB/s')+ * @returns The unit suffix to append to values (e.g., '%', '°C', '°F', ' MB/s')*/export function getAlertUnit(metricType?: string): string {if (!metricType) return '%';const typeLower = metricType.toLowerCase();if (TEMPERATURE_METRIC_TYPES.has(typeLower)) {- return '°C';+ return getTemperatureSymbol();}if (THROUGHPUT_METRIC_TYPES.has(typeLower)) {diff --git a/frontend-modern/src/utils/localStorage.ts b/frontend-modern/src/utils/localStorage.tsindex 90bc803e42..fc8c1d66b9 100644--- a/frontend-modern/src/utils/localStorage.ts+++ b/frontend-modern/src/utils/localStorage.ts@@ -110,6 +110,9 @@ export const STORAGE_KEYS = {METRICS_VIEW_MODE: 'metricsViewMode', // 'bars' | 'sparklines'METRICS_TIME_RANGE: 'metricsTimeRange', // '15m' | '1h' | '4h' | '24h'+ // Temperature display+ TEMPERATURE_UNIT: 'temperatureUnit', // 'celsius' | 'fahrenheit'+// Column visibilityDASHBOARD_HIDDEN_COLUMNS: 'dashboardHiddenColumns',HOSTS_HIDDEN_COLUMNS: 'hostsHiddenColumns',diff --git a/frontend-modern/src/utils/temperature.ts b/frontend-modern/src/utils/temperature.tsindex 137bd257c3..3703eec036 100644--- a/frontend-modern/src/utils/temperature.ts+++ b/frontend-modern/src/utils/temperature.ts@@ -1,4 +1,67 @@import type { Temperature } from '@/types/api';+import { createSignal, createRoot } from 'solid-js';+import { STORAGE_KEYS } from './localStorage';++export type TemperatureUnit = 'celsius' | 'fahrenheit';++// Reactive temperature unit store - created once and shared across the app+const createTemperatureStore = () => {+ // Load initial value from localStorage+ const stored = localStorage.getItem(STORAGE_KEYS.TEMPERATURE_UNIT);+ const initial: TemperatureUnit = stored === 'fahrenheit' ? 'fahrenheit' : 'celsius';++ const [unit, setUnitInternal] = createSignal<TemperatureUnit>(initial);++ const setUnit = (newUnit: TemperatureUnit) => {+ localStorage.setItem(STORAGE_KEYS.TEMPERATURE_UNIT, newUnit);+ setUnitInternal(newUnit);+ };++ return { unit, setUnit };+};++// Create the store at module level using createRoot to avoid context issues+export const temperatureStore = createRoot(createTemperatureStore);++/**+ * Convert Celsius to Fahrenheit+ */+export const celsiusToFahrenheit = (celsius: number): number => {+ return (celsius * 9) / 5 + 32;+};++/**+ * Format a temperature value with the appropriate unit symbol.+ * Uses the global temperature unit preference.+ * @param celsius - Temperature in Celsius+ * @param options - Formatting options+ * @returns Formatted temperature string (e.g., "72°C" or "162°F")+ */+export const formatTemperature = (+ celsius: number | null | undefined,+ options: { showUnit?: boolean; decimals?: number } = {}+): string => {+ const { showUnit = true, decimals = 0 } = options;++ if (celsius === null || celsius === undefined || !Number.isFinite(celsius)) {+ return '—';+ }++ const unit = temperatureStore.unit();+ const value = unit === 'fahrenheit' ? celsiusToFahrenheit(celsius) : celsius;+ const symbol = unit === 'fahrenheit' ? '°F' : '°C';++ const formatted = decimals > 0 ? value.toFixed(decimals) : Math.round(value).toString();++ return showUnit ? `${formatted}${symbol}` : formatted;+};++/**+ * Get the current temperature unit symbol+ */+export const getTemperatureSymbol = (): string => {+ return temperatureStore.unit() === 'fahrenheit' ? '°F' : '°C';+};const isValidTemperature = (value: unknown): value is number =>typeof value === 'number' && Number.isFinite(value);