From f6ba5329cebfdc7ae38459d05e8958e742bbe1cd Mon Sep 17 00:00:00 2001 From: MacRimi Date: Tue, 21 Oct 2025 19:05:38 +0200 Subject: [PATCH] Update AppImage --- AppImage/components/metrics-dialog.tsx | 12 ++-- AppImage/components/virtual-machines.tsx | 85 +++++++++++++++++++----- 2 files changed, 76 insertions(+), 21 deletions(-) diff --git a/AppImage/components/metrics-dialog.tsx b/AppImage/components/metrics-dialog.tsx index 365f1a7..d437a2a 100644 --- a/AppImage/components/metrics-dialog.tsx +++ b/AppImage/components/metrics-dialog.tsx @@ -4,7 +4,7 @@ import { useState, useEffect } from "react" import { Button } from "@/components/ui/button" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { ArrowLeft, Loader2 } from "lucide-react" -import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from "recharts" +import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Legend } from "recharts" interface MetricsViewProps { vmid: number @@ -259,6 +259,7 @@ export function MetricsView({ vmid, vmName, vmType, onBack }: MetricsViewProps) borderRadius: "6px", }} /> + @@ -312,6 +313,7 @@ export function MetricsView({ vmid, vmName, vmType, onBack }: MetricsViewProps) borderRadius: "6px", }} /> + diff --git a/AppImage/components/virtual-machines.tsx b/AppImage/components/virtual-machines.tsx index a4de90f..e2533e8 100644 --- a/AppImage/components/virtual-machines.tsx +++ b/AppImage/components/virtual-machines.tsx @@ -72,6 +72,12 @@ interface VMDetails extends VMData { config?: VMConfig node?: string vm_type?: string + os_info?: { + id?: string + version_id?: string + name?: string + pretty_name?: string + } } const fetcher = async (url: string) => { @@ -172,27 +178,72 @@ const getModalProgressColor = (percent: number): string => { return "[&>div]:bg-blue-500" } -// Placeholder for the undeclared getOSIcon function -const getOSIcon = (ostype: string | undefined, vmType: string): React.ReactNode => { - if (vmType === "lxc") { - return +const getOSIcon = (osInfo: VMDetails["os_info"] | undefined, vmType: string): React.ReactNode => { + // Only show logo for LXCs, VMs show nothing + if (vmType !== "lxc") { + return null } - switch (ostype) { + const osId = osInfo?.id?.toLowerCase() + + // Try to use SVG icons for common distributions + switch (osId) { case "debian": - return Debian + return ( + Debian { + // Fallback to Container icon if SVG doesn't exist + e.currentTarget.style.display = "none" + e.currentTarget.parentElement!.innerHTML = + '
' + }} + /> + ) case "ubuntu": - return Ubuntu - case "centos": - return CentOS - case "fedora": - return Fedora - case "windows": - return Windows + return ( + Ubuntu { + e.currentTarget.style.display = "none" + e.currentTarget.parentElement!.innerHTML = + '
' + }} + /> + ) case "alpine": - return Alpine + return ( + Alpine { + e.currentTarget.style.display = "none" + e.currentTarget.parentElement!.innerHTML = + '
' + }} + /> + ) + case "arch": + return ( + Arch { + e.currentTarget.style.display = "none" + e.currentTarget.parentElement!.innerHTML = + '
' + }} + /> + ) default: - return + // Generic LXC container icon + return } } @@ -887,7 +938,9 @@ export function VirtualMachines() { -
{/* Empty space - no logo */}
+
+ {getOSIcon(vmDetails?.os_info, selectedVM.type)} +