5f92340c0c
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>
51 lines
2.1 KiB
HTML
51 lines
2.1 KiB
HTML
{# hosts/uptime_widget.html — dashboard widget: SLA uptime summary #}
|
|
{% if not hosts %}
|
|
<div style="color:var(--text-muted);font-size:0.85rem;padding:0.5rem 0;">
|
|
No ping-enabled hosts configured.
|
|
</div>
|
|
{% else %}
|
|
|
|
<div style="display:grid;gap:2px;">
|
|
<div style="display:grid;grid-template-columns:1fr 52px 52px 52px;gap:0.35rem;font-size:0.72rem;color:var(--text-dim);padding:0 0 0.25rem;border-bottom:1px solid var(--border);">
|
|
<span>Host</span>
|
|
<span style="text-align:center;">24h</span>
|
|
<span style="text-align:center;">7d</span>
|
|
<span style="text-align:center;">30d</span>
|
|
</div>
|
|
{% for host in hosts %}
|
|
{% set ut = uptime.get(host.id, {}) %}
|
|
<div style="display:grid;grid-template-columns:1fr 52px 52px 52px;gap:0.35rem;align-items:center;padding:0.15rem 0;font-size:0.82rem;">
|
|
{% if session.user_id %}
|
|
<a href="/hosts/{{ host.id }}" title="{{ host.name }}"
|
|
style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:inherit;text-decoration:none;">{{ host.name }}</a>
|
|
{% else %}
|
|
<span style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="{{ host.name }}">{{ host.name }}</span>
|
|
{% endif %}
|
|
{% for window in ["24h", "7d", "30d"] %}
|
|
{% set pct = ut.get(window) %}
|
|
<span style="text-align:center;font-family:ui-monospace,monospace;font-size:0.78rem;">
|
|
{% if pct is none %}
|
|
<span style="color:var(--text-dim);">—</span>
|
|
{% elif pct >= 99.9 %}
|
|
<span style="color:var(--green);">{{ "%.1f"|format(pct) }}%</span>
|
|
{% elif pct >= 99 %}
|
|
<span style="color:var(--yellow);">{{ "%.1f"|format(pct) }}%</span>
|
|
{% elif pct >= 95 %}
|
|
<span style="color:var(--orange);">{{ "%.1f"|format(pct) }}%</span>
|
|
{% else %}
|
|
<span style="color:var(--red);">{{ "%.1f"|format(pct) }}%</span>
|
|
{% endif %}
|
|
</span>
|
|
{% endfor %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% if share_token %}
|
|
<div style="margin-top:0.5rem;text-align:right;">
|
|
<a href="/hosts/uptime" style="font-size:0.75rem;color:var(--text-muted);">Full SLA →</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% endif %}
|