Show free disk capacity with the same bar and caption as RAM
Rust development slice / linux (push) Failing after 10s
Rust development slice / linux (push) Failing after 10s
This commit is contained in:
+5
-10
@@ -90,10 +90,9 @@ function Presence({ d }: { d: RecordValue }) {
|
||||
</span>
|
||||
);
|
||||
}
|
||||
function Capacity({ free, total, showBreakdown = false }: {
|
||||
function Capacity({ free, total }: {
|
||||
free: unknown;
|
||||
total: unknown;
|
||||
showBreakdown?: boolean;
|
||||
}) {
|
||||
const freePercent = typeof free === 'number' && typeof total === 'number' &&
|
||||
Number.isFinite(total) && free >= 0 && free <= total && total > 0
|
||||
@@ -105,20 +104,16 @@ function Capacity({ free, total, showBreakdown = false }: {
|
||||
return (
|
||||
<>
|
||||
<span>{capacity(free, total)}</span>
|
||||
{freePercent !== null && (showBreakdown ? (
|
||||
{freePercent !== null && (
|
||||
<>
|
||||
<span className="capacity-track capacity-breakdown" role="img"
|
||||
<span className="capacity-track" role="img"
|
||||
aria-label={breakdown} title={breakdown}>
|
||||
<span className="capacity-free" style={{ width: `${freePercent}%` }} />
|
||||
<span className="capacity-used" />
|
||||
</span>
|
||||
<small className="capacity-caption" aria-hidden="true">{freeLabel}</small>
|
||||
</>
|
||||
) : (
|
||||
<span className="capacity-track" title={freeLabel} aria-hidden="true">
|
||||
<i style={{ width: `${100 - freePercent}%` }} />
|
||||
</span>
|
||||
))}
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -706,7 +701,7 @@ export function Devices({
|
||||
<Capacity free={d.disk_free_bytes} total={d.disk_total_bytes} />
|
||||
</td>
|
||||
<td data-label="RAM frei / gesamt" className="capacity-cell" title={measuredAt(d.ram_observed_at)}>
|
||||
<Capacity free={d.ram_available_bytes} total={d.ram_total_bytes} showBreakdown />
|
||||
<Capacity free={d.ram_available_bytes} total={d.ram_total_bytes} />
|
||||
</td>
|
||||
<td data-label="CPU">
|
||||
{model.primary}
|
||||
|
||||
Reference in New Issue
Block a user