From be7a2d7f41cb3269d6ccf307db453513cb7c89f4 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Mon, 6 Oct 2025 14:17:14 +0200 Subject: [PATCH] Update AppImage --- AppImage/components/hardware.tsx | 187 ++++++++++++++++++++++++++++++- AppImage/types/hardware.ts | 76 +++++++++++++ 2 files changed, 259 insertions(+), 4 deletions(-) create mode 100644 AppImage/types/hardware.ts diff --git a/AppImage/components/hardware.tsx b/AppImage/components/hardware.tsx index 5e41eb2..4e7ee1c 100644 --- a/AppImage/components/hardware.tsx +++ b/AppImage/components/hardware.tsx @@ -3,7 +3,18 @@ import { Card } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Progress } from "@/components/ui/progress" -import { Thermometer, CpuIcon, ChevronDown, ChevronUp, Zap } from "lucide-react" +import { + Thermometer, + CpuIcon, + ChevronDown, + ChevronUp, + Zap, + HardDrive, + Network, + FanIcon, + PowerIcon, + Battery, +} from "lucide-react" import useSWR from "swr" import { useState } from "react" import { type HardwareData, fetcher } from "@/types/hardware" @@ -94,9 +105,62 @@ export default function Hardware() { )} - {/* Network Summary */} - {/* Storage Summary */} + {hardwareData?.storage_devices && hardwareData.storage_devices.length > 0 && ( + +
+ +

Storage Summary

+ + {hardwareData.storage_devices.length} devices + +
+ +
+ {hardwareData.storage_devices.map((device, index) => ( +
+
+ {device.name} + {device.type} +
+ {device.size &&

{device.size}

} + {device.model &&

{device.model}

} +
+ ))} +
+
+ )} + + {/* Network Summary */} + {hardwareData?.pci_devices && + hardwareData.pci_devices.filter((d) => d.type.toLowerCase().includes("network")).length > 0 && ( + +
+ +

Network Summary

+ + {hardwareData.pci_devices.filter((d) => d.type.toLowerCase().includes("network")).length} interfaces + +
+ +
+ {hardwareData.pci_devices + .filter((d) => d.type.toLowerCase().includes("network")) + .map((device, index) => ( +
+
+ {device.device} + Ethernet +
+

{device.vendor}

+
+ ))} +
+

+ For detailed network information, see the Network section +

+
+ )} {/* PCI Devices */} {hardwareData?.pci_devices && hardwareData.pci_devices.length > 0 && ( @@ -218,7 +282,122 @@ export default function Hardware() { )} - {/* ... existing code for Fans, Power Supply, UPS sections ... */} + {/* Fans */} + {hardwareData?.fans && hardwareData.fans.length > 0 && ( + +
+ +

System Fans

+ + {hardwareData.fans.length} fans + +
+ +
+ {hardwareData.fans.map((fan, index) => ( +
+
+ {fan.name} + + {fan.speed.toFixed(1)} {fan.unit} + +
+ +
+ ))} +
+
+ )} + + {/* Power Supplies */} + {hardwareData?.power_supplies && hardwareData.power_supplies.length > 0 && ( + +
+ +

Power Supplies

+ + {hardwareData.power_supplies.length} PSUs + +
+ +
+ {hardwareData.power_supplies.map((psu, index) => ( +
+
+ {psu.name} + {psu.status && {psu.status}} +
+

{psu.watts} W

+

Current Output

+
+ ))} +
+
+ )} + + {/* UPS */} + {hardwareData?.ups && ( + +
+ +

UPS Status

+
+ +
+
+
+ {hardwareData.ups.name} + + {hardwareData.ups.status} + +
+ +
+ {hardwareData.ups.battery_charge !== undefined && ( +
+
+ Battery Charge + {hardwareData.ups.battery_charge}% +
+ +
+ )} + + {hardwareData.ups.load !== undefined && ( +
+
+ Load + {hardwareData.ups.load}% +
+ +
+ )} + + {hardwareData.ups.battery_runtime !== undefined && ( +
+ Runtime +

{Math.floor(hardwareData.ups.battery_runtime / 60)} min

+
+ )} + + {hardwareData.ups.input_voltage !== undefined && ( +
+ Input Voltage +

{hardwareData.ups.input_voltage} V

+
+ )} + + {hardwareData.ups.output_voltage !== undefined && ( +
+ Output Voltage +

{hardwareData.ups.output_voltage} V

+
+ )} +
+
+
+
+ )} ) } diff --git a/AppImage/types/hardware.ts b/AppImage/types/hardware.ts new file mode 100644 index 0000000..e55043a --- /dev/null +++ b/AppImage/types/hardware.ts @@ -0,0 +1,76 @@ +export interface Temperature { + name: string + current: number + high?: number + critical?: number + adapter?: string +} + +export interface PowerMeter { + name: string + watts: number + adapter?: string +} + +export interface NetworkInterface { + name: string + type: string + speed?: string + status?: string +} + +export interface StorageDevice { + name: string + type: string + size?: string + model?: string +} + +export interface PCIDevice { + slot: string + type: string + device: string + vendor: string + class: string + driver?: string + kernel_module?: string + irq?: string + memory_address?: string + link_speed?: string + capabilities?: string[] +} + +export interface Fan { + name: string + speed: number + unit: string +} + +export interface PowerSupply { + name: string + watts: number + status?: string +} + +export interface UPS { + name: string + status: string + battery_charge?: number + battery_runtime?: number + load?: number + input_voltage?: number + output_voltage?: number +} + +export interface HardwareData { + temperatures?: Temperature[] + power_meter?: PowerMeter + network_cards?: NetworkInterface[] + storage_devices?: StorageDevice[] + pci_devices?: PCIDevice[] + fans?: Fan[] + power_supplies?: PowerSupply[] + ups?: UPS +} + +export const fetcher = (url: string) => fetch(url).then((res) => res.json())