mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-18 03:26:17 +00:00
Update AppImage
This commit is contained in:
@@ -163,14 +163,49 @@ const groupAndSortTemperatures = (temperatures: any[]) => {
|
||||
}
|
||||
|
||||
export default function Hardware() {
|
||||
// Static data - load once without refresh
|
||||
const {
|
||||
data: hardwareData,
|
||||
error,
|
||||
isLoading,
|
||||
data: staticHardwareData,
|
||||
error: staticError,
|
||||
isLoading: staticLoading,
|
||||
} = useSWR<HardwareData>("/api/hardware", fetcher, {
|
||||
refreshInterval: 5000,
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnReconnect: false,
|
||||
refreshInterval: 0, // No auto-refresh for static data
|
||||
})
|
||||
|
||||
// Dynamic data - refresh every 5 seconds for temperatures, fans, power, ups
|
||||
const {
|
||||
data: dynamicHardwareData,
|
||||
error: dynamicError,
|
||||
isLoading: dynamicLoading,
|
||||
} = useSWR<HardwareData>("/api/hardware", fetcher, {
|
||||
refreshInterval: 5000, // 5 second refresh for dynamic data
|
||||
})
|
||||
|
||||
// Merge static and dynamic data, preferring static for CPU/memory/PCI/disks
|
||||
const hardwareData = staticHardwareData
|
||||
? {
|
||||
...dynamicHardwareData,
|
||||
// Keep static data from initial load
|
||||
cpu: staticHardwareData.cpu,
|
||||
motherboard: staticHardwareData.motherboard,
|
||||
memory_modules: staticHardwareData.memory_modules,
|
||||
pci_devices: staticHardwareData.pci_devices,
|
||||
storage_devices: staticHardwareData.storage_devices,
|
||||
gpus: staticHardwareData.gpus,
|
||||
// Use dynamic data for these
|
||||
temperatures: dynamicHardwareData?.temperatures,
|
||||
fans: dynamicHardwareData?.fans,
|
||||
power_meter: dynamicHardwareData?.power_meter,
|
||||
power_supplies: dynamicHardwareData?.power_supplies,
|
||||
ups: dynamicHardwareData?.ups,
|
||||
}
|
||||
: undefined
|
||||
|
||||
const error = staticError || dynamicError
|
||||
const isLoading = staticLoading
|
||||
|
||||
useEffect(() => {
|
||||
if (hardwareData?.storage_devices) {
|
||||
console.log("[v0] Storage devices data from backend:", hardwareData.storage_devices)
|
||||
|
||||
Reference in New Issue
Block a user