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}
|
||||
|
||||
+1
-3
@@ -105,9 +105,7 @@ section.fleet { padding:0; overflow:hidden; }
|
||||
.fleet-table input[type=checkbox] { margin:0; }
|
||||
.host-link { padding:0; background:none; color:var(--accent); text-align:left; font-weight:680; margin:0; overflow-wrap:anywhere; }
|
||||
.fleet-table .capacity-cell { font-variant-numeric:tabular-nums; }
|
||||
.capacity-track { display:block; width:min(90px,100%); border-radius:2px; background:#e1ebe6; height:4px; margin-top:6px; overflow:hidden; }
|
||||
.capacity-track i { display:block; height:100%; background:#659d84; }
|
||||
.capacity-breakdown { display:flex; height:6px; }
|
||||
.capacity-track { display:flex; width:min(90px,100%); border-radius:2px; background:#e1ebe6; height:6px; margin-top:6px; overflow:hidden; }
|
||||
.capacity-free { flex:none; background:#2e7657; }
|
||||
.capacity-used { flex:1; background:#b5c2be; }
|
||||
.capacity-caption { display:block; color:var(--subtle); }
|
||||
|
||||
Reference in New Issue
Block a user