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>
32 lines
1.5 KiB
HTML
32 lines
1.5 KiB
HTML
{# Shared template macros. Import with: {% from "_macros.html" import crumbs %} #}
|
||
|
||
{# Breadcrumb trail. `items` is a list of (label, href) pairs, ordered root→current.
|
||
Intermediate items with a truthy href render as links; the last item (or any
|
||
item with an empty href) renders as plain current text. #}
|
||
{% macro crumbs(items) -%}
|
||
<nav class="breadcrumb" aria-label="Breadcrumb">
|
||
{%- for label, href in items -%}
|
||
{%- if loop.last -%}
|
||
<span class="breadcrumb-cur" aria-current="page">{{ label }}</span>
|
||
{%- elif href -%}
|
||
<a href="{{ href }}">{{ label }}</a><span class="breadcrumb-sep">›</span>
|
||
{%- else -%}
|
||
<span>{{ label }}</span><span class="breadcrumb-sep">›</span>
|
||
{%- endif -%}
|
||
{%- endfor -%}
|
||
</nav>
|
||
{%- endmacro %}
|
||
|
||
{# Threshold emphasis for a numeric metric (CPU/mem/disk %, etc).
|
||
Returns an inline-style fragment to drop into a span's style="": amber +
|
||
semibold at >= warn, red + bold at >= crit, empty (inherit) when the value
|
||
is normal or None. This makes the FAILING METRIC ITSELF stand out — not just
|
||
the status dot. Defaults suit percentage gauges (warn 80 / crit 90); pass
|
||
explicit warn/crit for other scales. Keep thresholds here so they live in one
|
||
place rather than hardcoded per template. #}
|
||
{% macro metric_style(value, warn=80, crit=90) -%}
|
||
{%- if value is not none and value >= crit -%}color:var(--red);font-weight:700;
|
||
{%- elif value is not none and value >= warn -%}color:var(--yellow);font-weight:600;
|
||
{%- endif -%}
|
||
{%- endmacro %}
|