diff --git a/AppImage/components/hardware.tsx b/AppImage/components/hardware.tsx index 206dc50..aa8dd8c 100644 --- a/AppImage/components/hardware.tsx +++ b/AppImage/components/hardware.tsx @@ -72,6 +72,26 @@ export default function Hardware() { const [selectedDisk, setSelectedDisk] = useState(null) const [selectedNetwork, setSelectedNetwork] = useState(null) + const findPCIDeviceForGPU = (gpu: GPU): PCIDevice | null => { + if (!hardwareData?.pci_devices || !gpu.slot) return null + + // Try to find exact match first (e.g., "00:02.0") + let pciDevice = hardwareData.pci_devices.find((d) => d.slot === gpu.slot) + + // If not found, try to match by partial slot (e.g., "00" matches "00:02.0") + if (!pciDevice && gpu.slot.length <= 2) { + pciDevice = hardwareData.pci_devices.find( + (d) => + d.slot.startsWith(gpu.slot + ":") && + (d.type.toLowerCase().includes("vga") || + d.type.toLowerCase().includes("graphics") || + d.type.toLowerCase().includes("display")), + ) + } + + return pciDevice || null + } + return (
{/* System Information - CPU & Motherboard */} @@ -378,215 +398,222 @@ export default function Hardware() { PCI Device Information - {selectedGPU && ( -
- {/* Basic PCI Device Information - Same format as PCI Device modal */} -
-
- Device Type - Graphics Card -
+ {selectedGPU && + (() => { + const pciDevice = findPCIDeviceForGPU(selectedGPU) -
- PCI Slot - {selectedGPU.slot} -
- -
- Device Name - {selectedGPU.name} -
- -
- Vendor - {selectedGPU.vendor} -
- - {selectedGPU.pci_class && ( -
- Class - {selectedGPU.pci_class} -
- )} - - {selectedGPU.pci_driver && ( -
- Driver - {selectedGPU.pci_driver} -
- )} - - {selectedGPU.pci_kernel_module && ( -
- Kernel Module - {selectedGPU.pci_kernel_module} -
- )} - -
- Type - {selectedGPU.type} -
- - {selectedGPU.driver_version && ( -
- Driver Version - {selectedGPU.driver_version} -
- )} - - {selectedGPU.pcie_gen && ( -
- PCIe Generation - Gen {selectedGPU.pcie_gen} -
- )} - - {selectedGPU.pcie_width && ( -
- PCIe Width - {selectedGPU.pcie_width} -
- )} -
- - {/* Memory Info - Only show if available */} - {selectedGPU.memory_total && ( -
-

Memory

-
+ return ( +
+ {/* Basic PCI Device Information - Same format as PCI Device modal */} +
- Total - {selectedGPU.memory_total} + Device Type + Graphics Card
-
- Used - {selectedGPU.memory_used} -
-
- Free - {selectedGPU.memory_free} -
- {selectedGPU.utilization_memory !== undefined && ( -
-
- Memory Utilization - {selectedGPU.utilization_memory}% -
- -
- )} -
-
- )} - {/* Performance - Only show if realtime data available */} - {hasRealtimeData(selectedGPU) && ( -
-

Performance

-
- {selectedGPU.temperature !== undefined && selectedGPU.temperature > 0 && ( -
-
- Temperature - {selectedGPU.temperature}°C -
- -
- )} - {selectedGPU.utilization_gpu !== undefined && ( -
-
- GPU Utilization - {selectedGPU.utilization_gpu}% -
- -
- )} - {selectedGPU.power_draw && selectedGPU.power_draw !== "N/A" && ( +
+ PCI Slot + {pciDevice?.slot || selectedGPU.slot} +
+ +
+ Device Name + {pciDevice?.device || selectedGPU.name} +
+ +
+ Vendor + {pciDevice?.vendor || selectedGPU.vendor} +
+ +
+ Class + {pciDevice?.class || selectedGPU.pci_class || "N/A"} +
+ + {(pciDevice?.driver || selectedGPU.pci_driver) && (
- Power Draw - {selectedGPU.power_draw} -
- )} - {selectedGPU.power_limit && ( -
- Power Limit - {selectedGPU.power_limit} -
- )} - {selectedGPU.fan_speed && ( -
- Fan Speed - - {selectedGPU.fan_speed} {selectedGPU.fan_unit} + Driver + + {pciDevice?.driver || selectedGPU.pci_driver}
)} -
-
- )} - {/* Clock Speeds - Only show if available */} - {(selectedGPU.clock_graphics || selectedGPU.clock_memory) && ( -
-

Clock Speeds

-
- {selectedGPU.clock_graphics && ( + {(pciDevice?.kernel_module || selectedGPU.pci_kernel_module) && (
- Graphics Clock - {selectedGPU.clock_graphics} + Kernel Module + + {pciDevice?.kernel_module || selectedGPU.pci_kernel_module} +
)} - {selectedGPU.clock_memory && ( -
- Memory Clock - {selectedGPU.clock_memory} -
- )} -
-
- )} - {/* Running Processes - Only show if available */} - {selectedGPU.processes && selectedGPU.processes.length > 0 && ( -
-

Running Processes

-
- {selectedGPU.processes.map((proc, idx) => ( -
-
- PID: {proc.pid} - {proc.memory} -
-

{proc.name}

-
- ))} -
-
- )} - - {!hasRealtimeData(selectedGPU) && ( -
-
- -
-

Extended Monitoring Not Available

-

- {getMonitoringToolRecommendation(selectedGPU.vendor)} -

+
+ Type + {selectedGPU.type}
-
-
- )} - {selectedGPU.note && ( -
-

{selectedGPU.note}

+ {selectedGPU.driver_version && ( +
+ Driver Version + {selectedGPU.driver_version} +
+ )} + + {selectedGPU.pcie_gen && ( +
+ PCIe Generation + Gen {selectedGPU.pcie_gen} +
+ )} + + {selectedGPU.pcie_width && ( +
+ PCIe Width + {selectedGPU.pcie_width} +
+ )} +
+ + {/* Memory Info - Only show if available */} + {selectedGPU.memory_total && ( +
+

Memory

+
+
+ Total + {selectedGPU.memory_total} +
+
+ Used + {selectedGPU.memory_used} +
+
+ Free + {selectedGPU.memory_free} +
+ {selectedGPU.utilization_memory !== undefined && ( +
+
+ Memory Utilization + {selectedGPU.utilization_memory}% +
+ +
+ )} +
+
+ )} + + {/* Performance - Only show if realtime data available */} + {hasRealtimeData(selectedGPU) && ( +
+

Performance

+
+ {selectedGPU.temperature !== undefined && selectedGPU.temperature > 0 && ( +
+
+ Temperature + {selectedGPU.temperature}°C +
+ +
+ )} + {selectedGPU.utilization_gpu !== undefined && ( +
+
+ GPU Utilization + {selectedGPU.utilization_gpu}% +
+ +
+ )} + {selectedGPU.power_draw && selectedGPU.power_draw !== "N/A" && ( +
+ Power Draw + {selectedGPU.power_draw} +
+ )} + {selectedGPU.power_limit && ( +
+ Power Limit + {selectedGPU.power_limit} +
+ )} + {selectedGPU.fan_speed && ( +
+ Fan Speed + + {selectedGPU.fan_speed} {selectedGPU.fan_unit} + +
+ )} +
+
+ )} + + {/* Clock Speeds - Only show if available */} + {(selectedGPU.clock_graphics || selectedGPU.clock_memory) && ( +
+

Clock Speeds

+
+ {selectedGPU.clock_graphics && ( +
+ Graphics Clock + {selectedGPU.clock_graphics} +
+ )} + {selectedGPU.clock_memory && ( +
+ Memory Clock + {selectedGPU.clock_memory} +
+ )} +
+
+ )} + + {/* Running Processes - Only show if available */} + {selectedGPU.processes && selectedGPU.processes.length > 0 && ( +
+

Running Processes

+
+ {selectedGPU.processes.map((proc, idx) => ( +
+
+ PID: {proc.pid} + {proc.memory} +
+

{proc.name}

+
+ ))} +
+
+ )} + + {!hasRealtimeData(selectedGPU) && ( +
+
+ +
+

Extended Monitoring Not Available

+

+ {getMonitoringToolRecommendation(pciDevice?.vendor || selectedGPU.vendor)} +

+
+
+
+ )} + + {selectedGPU.note && ( +
+

{selectedGPU.note}

+
+ )}
- )} -
- )} + ) + })()}