mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-10-03 16:46:18 +00:00
Update AppImage
This commit is contained in:
@@ -147,11 +147,15 @@ export function StorageOverview() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const disksWithTemp = storageData.disks.filter((disk) => disk.temperature > 0)
|
||||||
const avgTemp =
|
const avgTemp =
|
||||||
storageData.disks.length > 0
|
disksWithTemp.length > 0
|
||||||
? Math.round(storageData.disks.reduce((sum, disk) => sum + disk.temperature, 0) / storageData.disks.length)
|
? Math.round(disksWithTemp.reduce((sum, disk) => sum + disk.temperature, 0) / disksWithTemp.length)
|
||||||
: 0
|
: 0
|
||||||
|
|
||||||
|
const usagePercent =
|
||||||
|
storageData.total > 0 ? ((storageData.used / (storageData.total * 1024)) * 100).toFixed(2) : "0.00"
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
{/* Storage Summary */}
|
{/* Storage Summary */}
|
||||||
@@ -174,9 +178,7 @@ export function StorageOverview() {
|
|||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="text-2xl font-bold">{storageData.used.toFixed(1)} GB</div>
|
<div className="text-2xl font-bold">{storageData.used.toFixed(1)} GB</div>
|
||||||
<p className="text-xs text-muted-foreground mt-1">
|
<p className="text-xs text-muted-foreground mt-1">{usagePercent}% used</p>
|
||||||
{storageData.total > 0 ? ((storageData.used / (storageData.total * 1024)) * 100).toFixed(1) : 0}% used
|
|
||||||
</p>
|
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
@@ -331,13 +333,15 @@ export function StorageOverview() {
|
|||||||
<span className="text-sm font-medium">{disk.usage_percent}%</span>
|
<span className="text-sm font-medium">{disk.usage_percent}%</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{disk.usage_percent !== undefined && <Progress value={disk.usage_percent} className="h-2" />}
|
{disk.usage_percent !== undefined && (
|
||||||
{disk.total && disk.used && disk.available && (
|
<div className="space-y-1">
|
||||||
<div className="flex justify-between text-xs text-muted-foreground mt-1">
|
<Progress value={disk.usage_percent} className="h-2" />
|
||||||
<span>{disk.used} GB used</span>
|
<div className="flex justify-between text-xs text-muted-foreground">
|
||||||
<span>
|
<span className="text-blue-400">{disk.used} GB used</span>
|
||||||
{disk.available} GB free of {disk.total} GB
|
<span className="text-green-400">
|
||||||
</span>
|
{disk.available} GB free of {disk.total} GB
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -447,11 +451,11 @@ export function StorageOverview() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between text-sm">
|
<div className="flex justify-between text-sm">
|
||||||
<span className="text-muted-foreground">Used:</span>
|
<span className="text-muted-foreground">Used:</span>
|
||||||
<span className="font-medium">{selectedDisk.used} GB</span>
|
<span className="font-medium text-blue-400">{selectedDisk.used} GB</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between text-sm">
|
<div className="flex justify-between text-sm">
|
||||||
<span className="text-muted-foreground">Available:</span>
|
<span className="text-muted-foreground">Available:</span>
|
||||||
<span className="font-medium">{selectedDisk.available} GB</span>
|
<span className="font-medium text-green-400">{selectedDisk.available} GB</span>
|
||||||
</div>
|
</div>
|
||||||
{selectedDisk.usage_percent !== undefined && (
|
{selectedDisk.usage_percent !== undefined && (
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
|
@@ -363,7 +363,8 @@ def get_storage_info():
|
|||||||
if len(parts) >= 3 and parts[2] == 'disk':
|
if len(parts) >= 3 and parts[2] == 'disk':
|
||||||
disk_name = parts[0]
|
disk_name = parts[0]
|
||||||
disk_size_bytes = int(parts[1])
|
disk_size_bytes = int(parts[1])
|
||||||
disk_size_gb = round(disk_size_bytes / (1024**3), 1)
|
disk_size_gb = disk_size_bytes / (1024**3)
|
||||||
|
disk_size_tb = disk_size_bytes / (1024**4)
|
||||||
|
|
||||||
total_disk_size_bytes += disk_size_bytes
|
total_disk_size_bytes += disk_size_bytes
|
||||||
|
|
||||||
@@ -372,9 +373,14 @@ def get_storage_info():
|
|||||||
smart_data = get_smart_data(disk_name)
|
smart_data = get_smart_data(disk_name)
|
||||||
print(f"[v0] SMART data for {disk_name}: {smart_data}")
|
print(f"[v0] SMART data for {disk_name}: {smart_data}")
|
||||||
|
|
||||||
|
if disk_size_tb >= 1:
|
||||||
|
size_str = f"{disk_size_tb:.1f}T"
|
||||||
|
else:
|
||||||
|
size_str = f"{disk_size_gb:.1f}G"
|
||||||
|
|
||||||
physical_disks[disk_name] = {
|
physical_disks[disk_name] = {
|
||||||
'name': disk_name,
|
'name': disk_name,
|
||||||
'size': f"{disk_size_gb}T" if disk_size_gb >= 1000 else f"{disk_size_gb}G",
|
'size': size_str,
|
||||||
'size_bytes': disk_size_bytes,
|
'size_bytes': disk_size_bytes,
|
||||||
'temperature': smart_data.get('temperature', 0),
|
'temperature': smart_data.get('temperature', 0),
|
||||||
'health': smart_data.get('health', 'unknown'),
|
'health': smart_data.get('health', 'unknown'),
|
||||||
@@ -399,7 +405,7 @@ def get_storage_info():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error getting disk list: {e}")
|
print(f"Error getting disk list: {e}")
|
||||||
|
|
||||||
storage_data['total'] = round(total_disk_size_bytes / (1024**3), 1)
|
storage_data['total'] = round(total_disk_size_bytes / (1024**4), 1)
|
||||||
|
|
||||||
# Get disk usage for mounted partitions
|
# Get disk usage for mounted partitions
|
||||||
try:
|
try:
|
||||||
@@ -643,6 +649,23 @@ def get_smart_data(disk_name):
|
|||||||
smart_data['health'] = 'critical'
|
smart_data['health'] = 'critical'
|
||||||
elif smart_data['temperature'] >= 60:
|
elif smart_data['temperature'] >= 60:
|
||||||
smart_data['health'] = 'warning'
|
smart_data['health'] = 'warning'
|
||||||
|
else:
|
||||||
|
print(f"[v0] smartctl returned code {result.returncode} for {disk_name}")
|
||||||
|
print(f"[v0] stderr: {result.stderr}")
|
||||||
|
# Intentar obtener al menos información básica del disco
|
||||||
|
try:
|
||||||
|
result_info = subprocess.run(['smartctl', '-i', f'/dev/{disk_name}'],
|
||||||
|
capture_output=True, text=True, timeout=5)
|
||||||
|
if result_info.returncode in [0, 4]:
|
||||||
|
output = result_info.stdout
|
||||||
|
for line in output.split('\n'):
|
||||||
|
line = line.strip()
|
||||||
|
if line.startswith('Device Model:') or line.startswith('Model Number:'):
|
||||||
|
smart_data['model'] = line.split(':', 1)[1].strip()
|
||||||
|
elif line.startswith('Serial Number:'):
|
||||||
|
smart_data['serial'] = line.split(':', 1)[1].strip()
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[v0] Error getting basic info for {disk_name}: {e}")
|
||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print(f"smartctl not found - install smartmontools package")
|
print(f"smartctl not found - install smartmontools package")
|
||||||
|
Reference in New Issue
Block a user