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"