(label, value, pct, kind)
| 281 | </div>`; |
| 282 | } |
| 283 | function resourceMeter(label, value, pct, kind){ |
| 284 | const safePct = clamp(num(pct), 0, 100); |
| 285 | const thresholds = { |
| 286 | cpu: { warn: 75, bad: 90 }, |
| 287 | mem: { warn: 80, bad: 90 }, |
| 288 | swap: { warn: 80, bad: 90 }, |
| 289 | hdd: { warn: 85, bad: 90 } |
| 290 | }[kind] || { warn: 75, bad: 90 }; |
| 291 | const level = safePct >= thresholds.bad ? 'bad' : (safePct >= thresholds.warn ? 'warn' : 'ok'); |
| 292 | return `<div class="resource-meter" data-kind="${esc(kind)}" data-level="${level}" style="--p:${safePct.toFixed(1)}%"> |
| 293 | <div class="resource-meter-head"><span>${esc(label)}</span><strong>${esc(value)}</strong></div> |
| 294 | <div class="resource-track"><i></i></div> |
| 295 | </div>`; |
| 296 | } |
| 297 | function detailResourceHTML(s, m){ |
| 298 | const swapPct = s.swap_total ? num(s.swap_used) / num(s.swap_total) * 100 : 0; |
| 299 | return ` |
no test coverage detected