From 6479f14d3dc38cac4cdf040f177c2338fc976d7d Mon Sep 17 00:00:00 2001 From: MacRimi Date: Mon, 20 Oct 2025 20:56:54 +0200 Subject: [PATCH] Update AppImage --- AppImage/components/metrics-dialog.tsx | 48 +--- AppImage/components/virtual-machines.tsx | 299 +++++++---------------- 2 files changed, 94 insertions(+), 253 deletions(-) diff --git a/AppImage/components/metrics-dialog.tsx b/AppImage/components/metrics-dialog.tsx index aa894bb..8283e39 100644 --- a/AppImage/components/metrics-dialog.tsx +++ b/AppImage/components/metrics-dialog.tsx @@ -43,27 +43,19 @@ export function MetricsView({ vmid, vmName, vmType, metricType, onBack }: Metric setLoading(true) setError(null) - console.log("[v0] Fetching metrics for VMID:", vmid, "Timeframe:", timeframe, "Type:", vmType) - try { const baseUrl = typeof window !== "undefined" ? `${window.location.protocol}//${window.location.hostname}:8008` : "" const apiUrl = `${baseUrl}/api/vms/${vmid}/metrics?timeframe=${timeframe}` - console.log("[v0] Fetching from URL:", apiUrl) - const response = await fetch(apiUrl) - console.log("[v0] Response status:", response.status) - if (!response.ok) { const errorData = await response.json() - console.error("[v0] Error response:", errorData) throw new Error(errorData.error || "Failed to fetch metrics") } const result = await response.json() - console.log("[v0] Metrics data received:", result) const transformedData = result.data.map((item: any) => { const date = new Date(item.time * 1000) @@ -121,10 +113,8 @@ export function MetricsView({ vmid, vmName, vmType, metricType, onBack }: Metric } }) - console.log("[v0] Transformed data:", transformedData.length, "points") setData(transformedData) } catch (err: any) { - console.error("[v0] Error fetching metrics:", err) setError(err.message || "Error loading metrics") } finally { setLoading(false) @@ -166,9 +156,7 @@ export function MetricsView({ vmid, vmName, vmType, metricType, onBack }: Metric switch (metricType) { case "cpu": const maxCpuValue = Math.max(...data.map((d) => d.cpu || 0)) - const cpuDomainMax = Math.ceil(maxCpuValue * 1.15) // 15% margin - console.log("[v0] CPU - Max value:", maxCpuValue, "Domain max:", cpuDomainMax, "Data points:", data.length) - console.log("[v0] CPU - Sample data:", data.slice(0, 3)) + const cpuDomainMax = Math.ceil(maxCpuValue * 1.15) return ( @@ -216,16 +204,7 @@ export function MetricsView({ vmid, vmName, vmType, metricType, onBack }: Metric case "memory": const maxMemoryValue = Math.max(...data.map((d) => d.memory || 0)) - const memoryDomainMax = Math.ceil(maxMemoryValue * 1.15) // 15% margin - console.log( - "[v0] Memory - Max value:", - maxMemoryValue, - "Domain max:", - memoryDomainMax, - "Data points:", - data.length, - ) - console.log("[v0] Memory - Sample data:", data.slice(0, 3)) + const memoryDomainMax = Math.ceil(maxMemoryValue * 1.15) return ( @@ -273,24 +252,7 @@ export function MetricsView({ vmid, vmName, vmType, metricType, onBack }: Metric case "network": const maxNetworkValue = Math.max(...data.map((d) => Math.max(d.netin || 0, d.netout || 0))) - const networkDomainMax = Math.ceil(maxNetworkValue * 1.15) // 15% margin - console.log( - "[v0] Network - Max value:", - maxNetworkValue, - "Domain max:", - networkDomainMax, - "Data points:", - data.length, - ) - console.log("[v0] Network - Sample data:", data.slice(0, 3)) - console.log( - "[v0] Network - All netin values:", - data.map((d) => d.netin), - ) - console.log( - "[v0] Network - All netout values:", - data.map((d) => d.netout), - ) + const networkDomainMax = Math.ceil(maxNetworkValue * 1.15) return ( @@ -347,9 +309,7 @@ export function MetricsView({ vmid, vmName, vmType, metricType, onBack }: Metric case "disk": const maxDiskValue = Math.max(...data.map((d) => Math.max(d.diskread || 0, d.diskwrite || 0))) - const diskDomainMax = Math.ceil(maxDiskValue * 1.15) // 15% margin - console.log("[v0] Disk - Max value:", maxDiskValue, "Domain max:", diskDomainMax, "Data points:", data.length) - console.log("[v0] Disk - Sample data:", data.slice(0, 3)) + const diskDomainMax = Math.ceil(maxDiskValue * 1.15) return ( diff --git a/AppImage/components/virtual-machines.tsx b/AppImage/components/virtual-machines.tsx index 35f1e7e..2b03149 100644 --- a/AppImage/components/virtual-machines.tsx +++ b/AppImage/components/virtual-machines.tsx @@ -381,12 +381,6 @@ export function VirtualMachines() { return "text-green-500" } - console.log("[v0] Memory status:", { - physical: physicalMemoryGB, - allocated: allocatedMemoryGB, - isOvercommit: isMemoryOvercommit, - }) - if (isLoading) { return (
@@ -723,11 +717,12 @@ export function VirtualMachines() { {currentView === "main" ? ( <> - +
{selectedVM?.name} + ID: {selectedVM?.vmid}
{selectedVM && (
@@ -738,6 +733,9 @@ export function VirtualMachines() { {selectedVM.status.toUpperCase()} + {selectedVM.status === "running" && ( + Uptime: {formatUptime(selectedVM.uptime)} + )}
)}
@@ -747,25 +745,18 @@ export function VirtualMachines() {
{selectedVM && ( <> -
-

- Basic Information -

-
-
-
Name
-
{selectedVM.name}
-
-
-
VMID
-
{selectedVM.vmid}
-
-
-
CPU Usage
-
handleMetricClick("cpu")} - > +
+ {/* CPU & Memory Card */} +
handleMetricClick("cpu")} + > +

+ CPU & Memory +

+
+
+
CPU Usage
{(selectedVM.cpu * 100).toFixed(1)}%
@@ -774,13 +765,8 @@ export function VirtualMachines() { className={`h-1.5 ${getModalProgressColor(selectedVM.cpu * 100)}`} />
-
-
-
Memory
-
handleMetricClick("memory")} - > +
+
Memory
@@ -793,12 +779,19 @@ export function VirtualMachines() { />
-
-
Disk
-
handleMetricClick("disk")} - > +
+ + {/* Disk Usage Card */} +
handleMetricClick("disk")} + > +

+ Disk Usage +

+
+
+
Storage
@@ -811,66 +804,71 @@ export function VirtualMachines() { />
-
-
Uptime
-
{formatUptime(selectedVM.uptime)}
-
-
-
Disk I/O
-
handleMetricClick("disk")} - > -
- - {((selectedVM.diskread || 0) / 1024 ** 2).toFixed(2)} MB -
-
- - {((selectedVM.diskwrite || 0) / 1024 ** 2).toFixed(2)} MB -
+
+ + {/* Disk I/O Card */} +
handleMetricClick("disk")} + > +

+ Disk I/O +

+
+
+ ↓ Read + + {((selectedVM.diskread || 0) / 1024 ** 2).toFixed(2)} MB +
-
-
-
Network I/O
-
handleMetricClick("network")} - > -
- - {((selectedVM.netin || 0) / 1024 ** 2).toFixed(2)} MB -
-
- - {((selectedVM.netout || 0) / 1024 ** 2).toFixed(2)} MB -
+
+ ↑ Write + + {((selectedVM.diskwrite || 0) / 1024 ** 2).toFixed(2)} MB +
-
- {detailsLoading ? ( -
Loading configuration...
- ) : vmDetails?.config ? ( - <> -
-

- Resources -

-
+ {/* Network I/O Card */} +
handleMetricClick("network")} + > +

+ Network I/O +

+
+
+ ↓ Download + + {((selectedVM.netin || 0) / 1024 ** 2).toFixed(2)} MB + +
+
+ ↑ Upload + + {((selectedVM.netout || 0) / 1024 ** 2).toFixed(2)} MB + +
+
+
+ + {/* Resources & Configuration Card */} +
+

+ Configuration +

+ {detailsLoading ? ( +
Loading configuration...
+ ) : vmDetails?.config ? ( +
{vmDetails.config.cores && (
CPU Cores
{vmDetails.config.cores}
)} - {vmDetails.config.sockets && ( -
-
CPU Sockets
-
{vmDetails.config.sockets}
-
- )} {vmDetails.config.memory && (
Memory
@@ -883,138 +881,22 @@ export function VirtualMachines() {
{vmDetails.config.swap} MB
)} - {vmDetails.config.rootfs && ( -
-
Root Filesystem
-
- {vmDetails.config.rootfs} -
-
- )} - {Object.keys(vmDetails.config) - .filter((key) => key.match(/^(scsi|sata|ide|virtio)\d+$/)) - .map((diskKey) => ( -
-
- {diskKey.toUpperCase().replace(/(\d+)/, " $1")} -
-
- {vmDetails.config[diskKey]} -
-
- ))} -
-
- -
-

- Network -

-
- {Object.keys(vmDetails.config) - .filter((key) => key.match(/^net\d+$/)) - .map((netKey) => ( -
-
- Network Interface {netKey.replace("net", "")} -
-
- {vmDetails.config[netKey]} -
-
- ))} - {vmDetails.config.nameserver && ( -
-
DNS Nameserver
-
- {vmDetails.config.nameserver} -
-
- )} - {vmDetails.config.searchdomain && ( -
-
Search Domain
-
{vmDetails.config.searchdomain}
-
- )} - {vmDetails.config.hostname && ( -
-
Hostname
-
{vmDetails.config.hostname}
-
- )} -
-
- -
-

- Options -

-
- {vmDetails.config.onboot !== undefined && ( -
-
Start on Boot
- - {vmDetails.config.onboot ? "Yes" : "No"} - -
- )} - {vmDetails.config.unprivileged !== undefined && ( -
-
Unprivileged
- - {vmDetails.config.unprivileged ? "Yes" : "No"} - -
- )} {vmDetails.config.ostype && (
OS Type
{vmDetails.config.ostype}
)} - {vmDetails.config.arch && ( -
-
Architecture
-
{vmDetails.config.arch}
-
- )} - {vmDetails.config.boot && ( -
-
Boot Order
-
{vmDetails.config.boot}
-
- )} - {vmDetails.config.features && ( -
-
Features
-
{vmDetails.config.features}
-
- )}
-
- - ) : null} + ) : null} +
+
)}
-
+

Control Actions

@@ -1055,7 +937,6 @@ export function VirtualMachines() {
) : ( - /* Render metrics view when currentView is "metrics" */ selectedVM && selectedMetric && (