mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-18 11:36:17 +00:00
Update storage-metrics.tsx
This commit is contained in:
@@ -136,10 +136,12 @@ export function StorageMetrics() {
|
|||||||
if (!result) {
|
if (!result) {
|
||||||
setError("Flask server not available. Please ensure the server is running.")
|
setError("Flask server not available. Please ensure the server is running.")
|
||||||
} else {
|
} else {
|
||||||
console.log("[v0] Storage data received:", result)
|
console.log("[v0] ===== STORAGE DATA RECEIVED =====")
|
||||||
|
console.log("[v0] Storage data:", result)
|
||||||
console.log("[v0] Number of disks:", result.disks?.length || 0)
|
console.log("[v0] Number of disks:", result.disks?.length || 0)
|
||||||
if (result.disks && result.disks.length > 0) {
|
if (result.disks && result.disks.length > 0) {
|
||||||
console.log("[v0] First disk sample:", result.disks[0])
|
console.log("[v0] First disk sample:", result.disks[0])
|
||||||
|
console.log("[v0] Disk types found:", result.disks.map((d) => d.disk_type).filter(Boolean))
|
||||||
}
|
}
|
||||||
setStorageData(result)
|
setStorageData(result)
|
||||||
}
|
}
|
||||||
@@ -196,7 +198,9 @@ export function StorageMetrics() {
|
|||||||
{} as Record<string, DiskInfo[]>,
|
{} as Record<string, DiskInfo[]>,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
console.log("[v0] ===== DISK GROUPING =====")
|
||||||
console.log("[v0] Disks grouped by type:", disksByType)
|
console.log("[v0] Disks grouped by type:", disksByType)
|
||||||
|
console.log("[v0] Disk types present:", Object.keys(disksByType))
|
||||||
|
|
||||||
const tempByType = Object.entries(disksByType)
|
const tempByType = Object.entries(disksByType)
|
||||||
.map(([type, disks]) => {
|
.map(([type, disks]) => {
|
||||||
@@ -206,7 +210,9 @@ export function StorageMetrics() {
|
|||||||
})
|
})
|
||||||
.filter((item) => item.type !== "Unknown")
|
.filter((item) => item.type !== "Unknown")
|
||||||
|
|
||||||
|
console.log("[v0] ===== TEMPERATURE BY TYPE =====")
|
||||||
console.log("[v0] Temperature by type:", tempByType)
|
console.log("[v0] Temperature by type:", tempByType)
|
||||||
|
console.log("[v0] Number of temperature cards to show:", tempByType.length)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
@@ -276,48 +282,57 @@ export function StorageMetrics() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Temperature cards by disk type */}
|
{/* Temperature cards by disk type */}
|
||||||
{tempByType.length > 0 && (
|
{tempByType.length > 0 ? (
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
{tempByType.map(({ type, avgTemp, status, count }) => (
|
{tempByType.map(({ type, avgTemp, status, count }) => {
|
||||||
<Card key={type} className="bg-card border-border">
|
console.log(`[v0] Rendering temp card for ${type}: ${avgTemp}°C, ${count} disks`)
|
||||||
<CardHeader>
|
return (
|
||||||
<CardTitle className="text-foreground flex items-center justify-between">
|
<Card key={type} className="bg-card border-border">
|
||||||
<div className="flex items-center">
|
<CardHeader>
|
||||||
<Thermometer className="h-5 w-5 mr-2" />
|
<CardTitle className="text-foreground flex items-center justify-between">
|
||||||
Avg Temperature
|
<div className="flex items-center">
|
||||||
</div>
|
<Thermometer className="h-5 w-5 mr-2" />
|
||||||
<div className="flex items-center gap-2">
|
Avg Temperature
|
||||||
<Badge variant="outline" className={getDiskTypeBadgeColor(type)}>
|
</div>
|
||||||
{type}
|
<div className="flex items-center gap-2">
|
||||||
|
<Badge variant="outline" className={getDiskTypeBadgeColor(type)}>
|
||||||
|
{type}
|
||||||
|
</Badge>
|
||||||
|
<Button variant="ghost" size="icon" className="h-6 w-6" onClick={() => setShowTempInfo(true)}>
|
||||||
|
<Info className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<div className={`text-3xl font-bold ${getTempColor(status)}`}>{avgTemp}°C</div>
|
||||||
|
<p className="text-xs text-muted-foreground mt-2">
|
||||||
|
{count} {type} disk{count > 1 ? "s" : ""}
|
||||||
|
</p>
|
||||||
|
<div className="mt-3">
|
||||||
|
<Badge
|
||||||
|
variant="outline"
|
||||||
|
className={
|
||||||
|
status === "safe"
|
||||||
|
? "bg-green-500/10 text-green-500 border-green-500/20"
|
||||||
|
: status === "warning"
|
||||||
|
? "bg-yellow-500/10 text-yellow-500 border-yellow-500/20"
|
||||||
|
: "bg-red-500/10 text-red-500 border-red-500/20"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{status === "safe" ? "Optimal" : status === "warning" ? "Warning" : "Critical"}
|
||||||
</Badge>
|
</Badge>
|
||||||
<Button variant="ghost" size="icon" className="h-6 w-6" onClick={() => setShowTempInfo(true)}>
|
|
||||||
<Info className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</CardTitle>
|
</CardContent>
|
||||||
</CardHeader>
|
</Card>
|
||||||
<CardContent>
|
)
|
||||||
<div className={`text-3xl font-bold ${getTempColor(status)}`}>{avgTemp}°C</div>
|
})}
|
||||||
<p className="text-xs text-muted-foreground mt-2">
|
</div>
|
||||||
{count} {type} disk{count > 1 ? "s" : ""}
|
) : (
|
||||||
</p>
|
<div>
|
||||||
<div className="mt-3">
|
{console.log("[v0] WARNING: No temperature cards to display!")}
|
||||||
<Badge
|
{console.log("[v0] disksByType:", disksByType)}
|
||||||
variant="outline"
|
{console.log("[v0] tempByType:", tempByType)}
|
||||||
className={
|
|
||||||
status === "safe"
|
|
||||||
? "bg-green-500/10 text-green-500 border-green-500/20"
|
|
||||||
: status === "warning"
|
|
||||||
? "bg-yellow-500/10 text-yellow-500 border-yellow-500/20"
|
|
||||||
: "bg-red-500/10 text-red-500 border-red-500/20"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{status === "safe" ? "Optimal" : status === "warning" ? "Warning" : "Critical"}
|
|
||||||
</Badge>
|
|
||||||
</div>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user