mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-10-11 04:16:17 +00:00
Update AppImage
This commit is contained in:
@@ -170,15 +170,15 @@ export default function Hardware() {
|
|||||||
|
|
||||||
const storageSummary = hardwareData.storage_devices.reduce(
|
const storageSummary = hardwareData.storage_devices.reduce(
|
||||||
(acc, disk) => {
|
(acc, disk) => {
|
||||||
const sizeMatch = disk.size.match(/(\d+\.?\d*)\s*([KMGT]?B)/)
|
const sizeMatch = disk.size.match(/(\d+\.?\d*)\s*([KMGT]?B?)/)
|
||||||
if (sizeMatch) {
|
if (sizeMatch) {
|
||||||
let sizeInGB = Number.parseFloat(sizeMatch[1])
|
let sizeInTB = Number.parseFloat(sizeMatch[1])
|
||||||
const unit = sizeMatch[2]
|
const unit = sizeMatch[2]
|
||||||
if (unit === "TB" || unit === "T") sizeInGB *= 1024
|
if (unit === "TB" || unit === "T") sizeInTB *= 1
|
||||||
else if (unit === "GB" || unit === "G") sizeInGB *= 1
|
else if (unit === "GB" || unit === "G") sizeInTB /= 1024
|
||||||
else if (unit === "MB" || unit === "M") sizeInGB /= 1024
|
else if (unit === "MB" || unit === "M") sizeInTB /= 1024 * 1024
|
||||||
else if (unit === "KB" || unit === "K") sizeInGB /= 1024 * 1024
|
else if (unit === "KB" || unit === "K") sizeInTB /= 1024 * 1024 * 1024
|
||||||
acc.totalCapacity += sizeInGB
|
acc.totalCapacity += sizeInTB
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disk.rotation_rate === 0) acc.ssd++
|
if (disk.rotation_rate === 0) acc.ssd++
|
||||||
@@ -331,7 +331,7 @@ export default function Hardware() {
|
|||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Storage Summary - Improved */}
|
{/* Storage Summary - Fixed to show TB */}
|
||||||
{hardwareData.storage_devices.length > 0 && (
|
{hardwareData.storage_devices.length > 0 && (
|
||||||
<Card className="border-border/50 bg-card/50 p-6">
|
<Card className="border-border/50 bg-card/50 p-6">
|
||||||
<div className="mb-4 flex items-center gap-2">
|
<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="grid gap-4 md:grid-cols-3">
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<p className="text-sm text-muted-foreground">Total Capacity</p>
|
<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>
|
</div>
|
||||||
|
|
||||||
{storageSummary.ssd > 0 && (
|
{storageSummary.ssd > 0 && (
|
||||||
@@ -398,7 +402,9 @@ export default function Hardware() {
|
|||||||
{gpu.temperature && gpu.temperature > 0 && (
|
{gpu.temperature && gpu.temperature > 0 && (
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<span className="text-muted-foreground">Temperature</span>
|
<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>
|
</div>
|
||||||
)}
|
)}
|
||||||
{gpu.power_draw && (
|
{gpu.power_draw && (
|
||||||
|
@@ -45,6 +45,7 @@ export function ProxmoxDashboard() {
|
|||||||
const [isServerConnected, setIsServerConnected] = useState(true)
|
const [isServerConnected, setIsServerConnected] = useState(true)
|
||||||
const [componentKey, setComponentKey] = useState(0)
|
const [componentKey, setComponentKey] = useState(0)
|
||||||
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)
|
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)
|
||||||
|
const [activeTab, setActiveTab] = useState("overview")
|
||||||
|
|
||||||
const fetchSystemData = useCallback(async () => {
|
const fetchSystemData = useCallback(async () => {
|
||||||
console.log("[v0] Fetching system data from Flask server...")
|
console.log("[v0] Fetching system data from Flask server...")
|
||||||
@@ -259,7 +260,7 @@ export function ProxmoxDashboard() {
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div className="container mx-auto px-4 md:px-6 py-4 md:py-6">
|
<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">
|
<TabsList className="hidden md:grid w-full grid-cols-6 bg-card border border-border">
|
||||||
<TabsTrigger
|
<TabsTrigger
|
||||||
value="overview"
|
value="overview"
|
||||||
@@ -313,8 +314,7 @@ export function ProxmoxDashboard() {
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const overviewTab = document.querySelector('[value="overview"]') as HTMLButtonElement
|
setActiveTab("overview")
|
||||||
overviewTab?.click()
|
|
||||||
setMobileMenuOpen(false)
|
setMobileMenuOpen(false)
|
||||||
}}
|
}}
|
||||||
className="w-full justify-start"
|
className="w-full justify-start"
|
||||||
@@ -324,8 +324,7 @@ export function ProxmoxDashboard() {
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const storageTab = document.querySelector('[value="storage"]') as HTMLButtonElement
|
setActiveTab("storage")
|
||||||
storageTab?.click()
|
|
||||||
setMobileMenuOpen(false)
|
setMobileMenuOpen(false)
|
||||||
}}
|
}}
|
||||||
className="w-full justify-start"
|
className="w-full justify-start"
|
||||||
@@ -335,8 +334,7 @@ export function ProxmoxDashboard() {
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const networkTab = document.querySelector('[value="network"]') as HTMLButtonElement
|
setActiveTab("network")
|
||||||
networkTab?.click()
|
|
||||||
setMobileMenuOpen(false)
|
setMobileMenuOpen(false)
|
||||||
}}
|
}}
|
||||||
className="w-full justify-start"
|
className="w-full justify-start"
|
||||||
@@ -346,8 +344,7 @@ export function ProxmoxDashboard() {
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const vmsTab = document.querySelector('[value="vms"]') as HTMLButtonElement
|
setActiveTab("vms")
|
||||||
vmsTab?.click()
|
|
||||||
setMobileMenuOpen(false)
|
setMobileMenuOpen(false)
|
||||||
}}
|
}}
|
||||||
className="w-full justify-start"
|
className="w-full justify-start"
|
||||||
@@ -357,8 +354,7 @@ export function ProxmoxDashboard() {
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const hardwareTab = document.querySelector('[value="hardware"]') as HTMLButtonElement
|
setActiveTab("hardware")
|
||||||
hardwareTab?.click()
|
|
||||||
setMobileMenuOpen(false)
|
setMobileMenuOpen(false)
|
||||||
}}
|
}}
|
||||||
className="w-full justify-start"
|
className="w-full justify-start"
|
||||||
@@ -368,8 +364,7 @@ export function ProxmoxDashboard() {
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const logsTab = document.querySelector('[value="logs"]') as HTMLButtonElement
|
setActiveTab("logs")
|
||||||
logsTab?.click()
|
|
||||||
setMobileMenuOpen(false)
|
setMobileMenuOpen(false)
|
||||||
}}
|
}}
|
||||||
className="w-full justify-start"
|
className="w-full justify-start"
|
||||||
|
@@ -1430,23 +1430,6 @@ def get_hardware_info():
|
|||||||
storage_info = get_storage_info()
|
storage_info = get_storage_info()
|
||||||
hardware_data['storage_devices'] = storage_info.get('disks', [])
|
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
|
# Graphics Cards
|
||||||
try:
|
try:
|
||||||
# Try nvidia-smi first
|
# Try nvidia-smi first
|
||||||
@@ -1464,18 +1447,39 @@ def get_hardware_info():
|
|||||||
'power_draw': parts[3].strip(),
|
'power_draw': parts[3].strip(),
|
||||||
'vendor': 'NVIDIA'
|
'vendor': 'NVIDIA'
|
||||||
})
|
})
|
||||||
else:
|
|
||||||
# Fallback to lspci
|
# Always check lspci for all GPUs (integrated and discrete)
|
||||||
result = subprocess.run(['lspci'], capture_output=True, text=True, timeout=5)
|
result = subprocess.run(['lspci'], capture_output=True, text=True, timeout=5)
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
for line in result.stdout.split('\n'):
|
for line in result.stdout.split('\n'):
|
||||||
if 'VGA compatible controller' in line or '3D controller' in line:
|
# Match VGA, 3D, Display controllers, and specific GPU keywords
|
||||||
parts = line.split(':', 2)
|
if any(keyword in line for keyword in ['VGA compatible controller', '3D controller', 'Display controller', 'Graphics', 'GPU']):
|
||||||
if len(parts) >= 3:
|
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({
|
hardware_data['graphics_cards'].append({
|
||||||
'name': parts[2].strip(),
|
'name': gpu_name,
|
||||||
'vendor': 'Unknown'
|
'vendor': vendor
|
||||||
})
|
})
|
||||||
|
print(f"[v0] Found GPU: {gpu_name} ({vendor})")
|
||||||
|
|
||||||
print(f"[v0] Graphics cards: {len(hardware_data['graphics_cards'])} found")
|
print(f"[v0] Graphics cards: {len(hardware_data['graphics_cards'])} found")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Reference in New Issue
Block a user