feat(dashboard): phase A widget clarity — threshold colours, host links, tooltips
Milestone 72 phase A (clarity wins, no schema change): - Add shared metric_style() macro in _macros.html: colours a numeric metric amber (>=warn) / red (>=crit) on the value ITSELF, not just the status dot. Defaults 80/90 for percentage gauges; load /core uses warn 80 / crit 100. Applied to CPU/mem/disk across host_agent panel + fleet widget + the unified hosts-overview widget. - Link every host reference to the host hub (/hosts/<id>) in ping, dns, hosts-overview, host_agent fleet, and uptime widgets; status widget entries link to their own detail_url. All guarded on session.user_id so the public share view degrades to plain text (the bare href carries no share token). - Fix truncation: title= tooltips on all names that ellipsis, plus a hover underline affordance on the now-clickable ping-name links. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
{# host_agent widget — fleet glance, flex rows (no header wrap) #}
|
||||
{% from "_macros.html" import metric_style %}
|
||||
{% if rows %}
|
||||
<div style="display:grid;gap:0.1rem;">
|
||||
{% for r in rows %}
|
||||
@@ -6,19 +7,21 @@
|
||||
<div style="display:flex;align-items:center;gap:0.6rem;font-size:0.82rem;padding:0.3rem 0;border-bottom:1px solid var(--border);">
|
||||
<span class="dot {% if stale %}dot-dim{% elif (r.cpu_pct or 0) >= 90 or (r.mem_used_pct or 0) >= 90 or (r.disk_worst or 0) >= 90 %}dot-warn{% else %}dot-up{% endif %}"
|
||||
title="{% if stale %}stale / no recent data{% else %}warns at CPU/memory ≥90% or any disk mount ≥90% (the 'disk /' figure shows root only){% endif %}"></span>
|
||||
<a href="/hosts/{{ r.host.id }}"
|
||||
style="flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500;">
|
||||
{{ r.host.name }}
|
||||
</a>
|
||||
{% set name_style = "flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500;" %}
|
||||
{% if session.user_id %}
|
||||
<a href="/hosts/{{ r.host.id }}" title="{{ r.host.name }}" style="{{ name_style }}">{{ r.host.name }}</a>
|
||||
{% else %}
|
||||
<span title="{{ r.host.name }}" style="{{ name_style }}">{{ r.host.name }}</span>
|
||||
{% endif %}
|
||||
<span style="display:flex;gap:0.75rem;font-variant-numeric:tabular-nums;color:var(--text-muted);font-size:0.75rem;flex-shrink:0;">
|
||||
{% if r.cpu_pct is not none %}
|
||||
<span title="CPU"><span style="color:var(--text-dim);">cpu</span> {{ "%.0f"|format(r.cpu_pct) }}%</span>
|
||||
<span title="CPU" style="{{ metric_style(r.cpu_pct) }}"><span style="color:var(--text-dim);">cpu</span> {{ "%.0f"|format(r.cpu_pct) }}%</span>
|
||||
{% endif %}
|
||||
{% if r.mem_used_pct is not none %}
|
||||
<span title="Memory"><span style="color:var(--text-dim);">mem</span> {{ "%.0f"|format(r.mem_used_pct) }}%</span>
|
||||
<span title="Memory" style="{{ metric_style(r.mem_used_pct) }}"><span style="color:var(--text-dim);">mem</span> {{ "%.0f"|format(r.mem_used_pct) }}%</span>
|
||||
{% endif %}
|
||||
{% if r.disk_root is not none %}
|
||||
<span title="Root filesystem (/) usage"><span style="color:var(--text-dim);">disk /</span> {{ "%.0f"|format(r.disk_root) }}%</span>
|
||||
<span title="Root filesystem (/) usage" style="{{ metric_style(r.disk_root) }}"><span style="color:var(--text-dim);">disk /</span> {{ "%.0f"|format(r.disk_root) }}%</span>
|
||||
{% endif %}
|
||||
{% if r.load_1m is not none %}
|
||||
<span title="Load average 1m"><span style="color:var(--text-dim);">load</span> {{ "%.2f"|format(r.load_1m) }}</span>
|
||||
|
||||
Reference in New Issue
Block a user