Update AppImage

This commit is contained in:
MacRimi
2025-10-05 21:59:44 +02:00
parent 4beba53675
commit 475b96178e
3 changed files with 55 additions and 50 deletions

View File

@@ -170,15 +170,15 @@ export default function Hardware() {
const storageSummary = hardwareData.storage_devices.reduce(
(acc, disk) => {
const sizeMatch = disk.size.match(/(\d+\.?\d*)\s*([KMGT]?B)/)
const sizeMatch = disk.size.match(/(\d+\.?\d*)\s*([KMGT]?B?)/)
if (sizeMatch) {
let sizeInGB = Number.parseFloat(sizeMatch[1])
let sizeInTB = Number.parseFloat(sizeMatch[1])
const unit = sizeMatch[2]
if (unit === "TB" || unit === "T") sizeInGB *= 1024
else if (unit === "GB" || unit === "G") sizeInGB *= 1
else if (unit === "MB" || unit === "M") sizeInGB /= 1024
else if (unit === "KB" || unit === "K") sizeInGB /= 1024 * 1024
acc.totalCapacity += sizeInGB
if (unit === "TB" || unit === "T") sizeInTB *= 1
else if (unit === "GB" || unit === "G") sizeInTB /= 1024
else if (unit === "MB" || unit === "M") sizeInTB /= 1024 * 1024
else if (unit === "KB" || unit === "K") sizeInTB /= 1024 * 1024 * 1024
acc.totalCapacity += sizeInTB
}
if (disk.rotation_rate === 0) acc.ssd++
@@ -331,7 +331,7 @@ export default function Hardware() {
</Card>
)}
{/* Storage Summary - Improved */}
{/* Storage Summary - Fixed to show TB */}
{hardwareData.storage_devices.length > 0 && (
<Card className="border-border/50 bg-card/50 p-6">
<div className="mb-4 flex items-center gap-2">
@@ -345,7 +345,11 @@ export default function Hardware() {
<div className="grid gap-4 md:grid-cols-3">
<div className="space-y-1">
<p className="text-sm text-muted-foreground">Total Capacity</p>
<p className="text-2xl font-semibold">{storageSummary.totalCapacity.toFixed(1)} GB</p>
<p className="text-2xl font-semibold">
{storageSummary.totalCapacity >= 1
? `${storageSummary.totalCapacity.toFixed(1)} TB`
: `${(storageSummary.totalCapacity * 1024).toFixed(1)} GB`}
</p>
</div>
{storageSummary.ssd > 0 && (
@@ -398,7 +402,9 @@ export default function Hardware() {
{gpu.temperature && gpu.temperature > 0 && (
<div className="flex justify-between">
<span className="text-muted-foreground">Temperature</span>
<span className={`font-mono ${getTempColor(gpu.temperature)}`}>{gpu.temperature}°C</span>
<span className={`font-mono font-medium ${getTempColor(gpu.temperature)}`}>
{gpu.temperature}°C
</span>
</div>
)}
{gpu.power_draw && (

View File

@@ -45,6 +45,7 @@ export function ProxmoxDashboard() {
const [isServerConnected, setIsServerConnected] = useState(true)
const [componentKey, setComponentKey] = useState(0)
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)
const [activeTab, setActiveTab] = useState("overview")
const fetchSystemData = useCallback(async () => {
console.log("[v0] Fetching system data from Flask server...")
@@ -259,7 +260,7 @@ export function ProxmoxDashboard() {
</header>
<div className="container mx-auto px-4 md:px-6 py-4 md:py-6">
<Tabs defaultValue="overview" className="space-y-4 md:space-y-6">
<Tabs value={activeTab} onValueChange={setActiveTab} className="space-y-4 md:space-y-6">
<TabsList className="hidden md:grid w-full grid-cols-6 bg-card border border-border">
<TabsTrigger
value="overview"
@@ -313,8 +314,7 @@ export function ProxmoxDashboard() {
<Button
variant="ghost"
onClick={() => {
const overviewTab = document.querySelector('[value="overview"]') as HTMLButtonElement
overviewTab?.click()
setActiveTab("overview")
setMobileMenuOpen(false)
}}
className="w-full justify-start"
@@ -324,8 +324,7 @@ export function ProxmoxDashboard() {
<Button
variant="ghost"
onClick={() => {
const storageTab = document.querySelector('[value="storage"]') as HTMLButtonElement
storageTab?.click()
setActiveTab("storage")
setMobileMenuOpen(false)
}}
className="w-full justify-start"
@@ -335,8 +334,7 @@ export function ProxmoxDashboard() {
<Button
variant="ghost"
onClick={() => {
const networkTab = document.querySelector('[value="network"]') as HTMLButtonElement
networkTab?.click()
setActiveTab("network")
setMobileMenuOpen(false)
}}
className="w-full justify-start"
@@ -346,8 +344,7 @@ export function ProxmoxDashboard() {
<Button
variant="ghost"
onClick={() => {
const vmsTab = document.querySelector('[value="vms"]') as HTMLButtonElement
vmsTab?.click()
setActiveTab("vms")
setMobileMenuOpen(false)
}}
className="w-full justify-start"
@@ -357,8 +354,7 @@ export function ProxmoxDashboard() {
<Button
variant="ghost"
onClick={() => {
const hardwareTab = document.querySelector('[value="hardware"]') as HTMLButtonElement
hardwareTab?.click()
setActiveTab("hardware")
setMobileMenuOpen(false)
}}
className="w-full justify-start"
@@ -368,8 +364,7 @@ export function ProxmoxDashboard() {
<Button
variant="ghost"
onClick={() => {
const logsTab = document.querySelector('[value="logs"]') as HTMLButtonElement
logsTab?.click()
setActiveTab("logs")
setMobileMenuOpen(false)
}}
className="w-full justify-start"

View File

@@ -1430,23 +1430,6 @@ def get_hardware_info():
storage_info = get_storage_info()
hardware_data['storage_devices'] = storage_info.get('disks', [])
# Network Cards
try:
result = subprocess.run(['lspci'], capture_output=True, text=True, timeout=5)
if result.returncode == 0:
for line in result.stdout.split('\n'):
if 'Ethernet controller' in line or 'Network controller' in line:
parts = line.split(':', 2)
if len(parts) >= 3:
hardware_data['network_cards'].append({
'name': parts[2].strip(),
'type': 'Ethernet' if 'Ethernet' in line else 'Network'
})
print(f"[v0] Network cards: {len(hardware_data['network_cards'])} found")
except Exception as e:
print(f"[v0] Error getting network cards: {e}")
# Graphics Cards
try:
# Try nvidia-smi first
@@ -1464,18 +1447,39 @@ def get_hardware_info():
'power_draw': parts[3].strip(),
'vendor': 'NVIDIA'
})
else:
# Fallback to lspci
result = subprocess.run(['lspci'], capture_output=True, text=True, timeout=5)
if result.returncode == 0:
for line in result.stdout.split('\n'):
if 'VGA compatible controller' in line or '3D controller' in line:
parts = line.split(':', 2)
if len(parts) >= 3:
# Always check lspci for all GPUs (integrated and discrete)
result = subprocess.run(['lspci'], capture_output=True, text=True, timeout=5)
if result.returncode == 0:
for line in result.stdout.split('\n'):
# Match VGA, 3D, Display controllers, and specific GPU keywords
if any(keyword in line for keyword in ['VGA compatible controller', '3D controller', 'Display controller', 'Graphics', 'GPU']):
parts = line.split(':', 2)
if len(parts) >= 3:
gpu_name = parts[2].strip()
# Determine vendor
vendor = 'Unknown'
if 'NVIDIA' in gpu_name or 'nVidia' in gpu_name:
vendor = 'NVIDIA'
elif 'AMD' in gpu_name or 'ATI' in gpu_name or 'Radeon' in gpu_name:
vendor = 'AMD'
elif 'Intel' in gpu_name:
vendor = 'Intel'
# Check if this GPU is already in the list (from nvidia-smi)
already_exists = False
for existing_gpu in hardware_data['graphics_cards']:
if gpu_name in existing_gpu['name'] or existing_gpu['name'] in gpu_name:
already_exists = True
break
if not already_exists:
hardware_data['graphics_cards'].append({
'name': parts[2].strip(),
'vendor': 'Unknown'
'name': gpu_name,
'vendor': vendor
})
print(f"[v0] Found GPU: {gpu_name} ({vendor})")
print(f"[v0] Graphics cards: {len(hardware_data['graphics_cards'])} found")
except Exception as e: