mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-18 03:26:17 +00:00
Update AppImage
This commit is contained in:
@@ -4,7 +4,7 @@ import { useState, useEffect } from "react"
|
|||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
||||||
import { ArrowLeft, Loader2 } from "lucide-react"
|
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 {
|
interface MetricsViewProps {
|
||||||
vmid: number
|
vmid: number
|
||||||
@@ -259,6 +259,7 @@ export function MetricsView({ vmid, vmName, vmType, onBack }: MetricsViewProps)
|
|||||||
borderRadius: "6px",
|
borderRadius: "6px",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Legend verticalAlign="top" height={36} iconType="line" wrapperStyle={{ paddingBottom: "10px" }} />
|
||||||
<Area
|
<Area
|
||||||
type="monotone"
|
type="monotone"
|
||||||
dataKey="diskread"
|
dataKey="diskread"
|
||||||
@@ -266,7 +267,7 @@ export function MetricsView({ vmid, vmName, vmType, onBack }: MetricsViewProps)
|
|||||||
fill="#10b981"
|
fill="#10b981"
|
||||||
fillOpacity={0.3}
|
fillOpacity={0.3}
|
||||||
strokeWidth={2}
|
strokeWidth={2}
|
||||||
name="Read (MB)"
|
name="Read"
|
||||||
/>
|
/>
|
||||||
<Area
|
<Area
|
||||||
type="monotone"
|
type="monotone"
|
||||||
@@ -275,7 +276,7 @@ export function MetricsView({ vmid, vmName, vmType, onBack }: MetricsViewProps)
|
|||||||
fill="#3b82f6"
|
fill="#3b82f6"
|
||||||
fillOpacity={0.3}
|
fillOpacity={0.3}
|
||||||
strokeWidth={2}
|
strokeWidth={2}
|
||||||
name="Write (MB)"
|
name="Write"
|
||||||
/>
|
/>
|
||||||
</AreaChart>
|
</AreaChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
@@ -312,6 +313,7 @@ export function MetricsView({ vmid, vmName, vmType, onBack }: MetricsViewProps)
|
|||||||
borderRadius: "6px",
|
borderRadius: "6px",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Legend verticalAlign="top" height={36} iconType="line" wrapperStyle={{ paddingBottom: "10px" }} />
|
||||||
<Area
|
<Area
|
||||||
type="monotone"
|
type="monotone"
|
||||||
dataKey="netin"
|
dataKey="netin"
|
||||||
@@ -319,7 +321,7 @@ export function MetricsView({ vmid, vmName, vmType, onBack }: MetricsViewProps)
|
|||||||
fill="#10b981"
|
fill="#10b981"
|
||||||
fillOpacity={0.3}
|
fillOpacity={0.3}
|
||||||
strokeWidth={2}
|
strokeWidth={2}
|
||||||
name="Download (MB)"
|
name="Download"
|
||||||
/>
|
/>
|
||||||
<Area
|
<Area
|
||||||
type="monotone"
|
type="monotone"
|
||||||
@@ -328,7 +330,7 @@ export function MetricsView({ vmid, vmName, vmType, onBack }: MetricsViewProps)
|
|||||||
fill="#3b82f6"
|
fill="#3b82f6"
|
||||||
fillOpacity={0.3}
|
fillOpacity={0.3}
|
||||||
strokeWidth={2}
|
strokeWidth={2}
|
||||||
name="Upload (MB)"
|
name="Upload"
|
||||||
/>
|
/>
|
||||||
</AreaChart>
|
</AreaChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
|
|||||||
@@ -72,6 +72,12 @@ interface VMDetails extends VMData {
|
|||||||
config?: VMConfig
|
config?: VMConfig
|
||||||
node?: string
|
node?: string
|
||||||
vm_type?: string
|
vm_type?: string
|
||||||
|
os_info?: {
|
||||||
|
id?: string
|
||||||
|
version_id?: string
|
||||||
|
name?: string
|
||||||
|
pretty_name?: string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetcher = async (url: string) => {
|
const fetcher = async (url: string) => {
|
||||||
@@ -172,27 +178,72 @@ const getModalProgressColor = (percent: number): string => {
|
|||||||
return "[&>div]:bg-blue-500"
|
return "[&>div]:bg-blue-500"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Placeholder for the undeclared getOSIcon function
|
const getOSIcon = (osInfo: VMDetails["os_info"] | undefined, vmType: string): React.ReactNode => {
|
||||||
const getOSIcon = (ostype: string | undefined, vmType: string): React.ReactNode => {
|
// Only show logo for LXCs, VMs show nothing
|
||||||
if (vmType === "lxc") {
|
if (vmType !== "lxc") {
|
||||||
return <Container className="h-16 w-16 text-cyan-500" />
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ostype) {
|
const osId = osInfo?.id?.toLowerCase()
|
||||||
|
|
||||||
|
// Try to use SVG icons for common distributions
|
||||||
|
switch (osId) {
|
||||||
case "debian":
|
case "debian":
|
||||||
return <img src="/icons/debian.svg" alt="Debian" className="h-16 w-16" />
|
return (
|
||||||
|
<img
|
||||||
|
src="/icons/debian.svg"
|
||||||
|
alt="Debian"
|
||||||
|
className="h-16 w-16"
|
||||||
|
onError={(e) => {
|
||||||
|
// Fallback to Container icon if SVG doesn't exist
|
||||||
|
e.currentTarget.style.display = "none"
|
||||||
|
e.currentTarget.parentElement!.innerHTML =
|
||||||
|
'<div class="flex items-center justify-center"><svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" class="text-cyan-500"><path d="M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z"/><path d="M10 21.9V14L2.1 9.1"/><path d="m10 14 11.9-6.9"/><path d="M14 19.8v-8.1"/><path d="M18 17.5V9.4"/></svg></div>'
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
case "ubuntu":
|
case "ubuntu":
|
||||||
return <img src="/icons/ubuntu.svg" alt="Ubuntu" className="h-16 w-16" />
|
return (
|
||||||
case "centos":
|
<img
|
||||||
return <img src="/icons/centos.svg" alt="CentOS" className="h-16 w-16" />
|
src="/icons/ubuntu.svg"
|
||||||
case "fedora":
|
alt="Ubuntu"
|
||||||
return <img src="/icons/fedora.svg" alt="Fedora" className="h-16 w-16" />
|
className="h-16 w-16"
|
||||||
case "windows":
|
onError={(e) => {
|
||||||
return <img src="/icons/windows.svg" alt="Windows" className="h-16 w-16" />
|
e.currentTarget.style.display = "none"
|
||||||
|
e.currentTarget.parentElement!.innerHTML =
|
||||||
|
'<div class="flex items-center justify-center"><svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" class="text-orange-500"><path d="M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z"/><path d="M10 21.9V14L2.1 9.1"/><path d="m10 14 11.9-6.9"/><path d="M14 19.8v-8.1"/><path d="M18 17.5V9.4"/></svg></div>'
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
case "alpine":
|
case "alpine":
|
||||||
return <img src="/icons/alpine.svg" alt="Alpine" className="h-16 w-16" />
|
return (
|
||||||
|
<img
|
||||||
|
src="/icons/alpine.svg"
|
||||||
|
alt="Alpine"
|
||||||
|
className="h-16 w-16"
|
||||||
|
onError={(e) => {
|
||||||
|
e.currentTarget.style.display = "none"
|
||||||
|
e.currentTarget.parentElement!.innerHTML =
|
||||||
|
'<div class="flex items-center justify-center"><svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" class="text-blue-400"><path d="M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z"/><path d="M10 21.9V14L2.1 9.1"/><path d="m10 14 11.9-6.9"/><path d="M14 19.8v-8.1"/><path d="M18 17.5V9.4"/></svg></div>'
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
case "arch":
|
||||||
|
return (
|
||||||
|
<img
|
||||||
|
src="/icons/arch.svg"
|
||||||
|
alt="Arch"
|
||||||
|
className="h-16 w-16"
|
||||||
|
onError={(e) => {
|
||||||
|
e.currentTarget.style.display = "none"
|
||||||
|
e.currentTarget.parentElement!.innerHTML =
|
||||||
|
'<div class="flex items-center justify-center"><svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" class="text-blue-500"><path d="M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z"/><path d="M10 21.9V14L2.1 9.1"/><path d="m10 14 11.9-6.9"/><path d="M14 19.8v-8.1"/><path d="M18 17.5V9.4"/></svg></div>'
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
default:
|
default:
|
||||||
return <Server className="h-16 w-16 text-purple-500" />
|
// Generic LXC container icon
|
||||||
|
return <Container className="h-16 w-16 text-cyan-500" />
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -887,7 +938,9 @@ export function VirtualMachines() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center justify-center">{/* Empty space - no logo */}</div>
|
<div className="flex items-center justify-center">
|
||||||
|
{getOSIcon(vmDetails?.os_info, selectedVM.type)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
Reference in New Issue
Block a user