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,9 +282,11 @@ 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 }) => {
|
||||||
|
console.log(`[v0] Rendering temp card for ${type}: ${avgTemp}°C, ${count} disks`)
|
||||||
|
return (
|
||||||
<Card key={type} className="bg-card border-border">
|
<Card key={type} className="bg-card border-border">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle className="text-foreground flex items-center justify-between">
|
<CardTitle className="text-foreground flex items-center justify-between">
|
||||||
@@ -317,7 +325,14 @@ export function StorageMetrics() {
|
|||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
))}
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div>
|
||||||
|
{console.log("[v0] WARNING: No temperature cards to display!")}
|
||||||
|
{console.log("[v0] disksByType:", disksByType)}
|
||||||
|
{console.log("[v0] tempByType:", tempByType)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user