{% from '_status.html' import status_dot, status_bar %}
{#
Landing-page body, in order: activity, backends, current runs, recent
runs. Rendered standalone by /overview/stream, so it must not depend on
anything overview.html sets up beyond the context keys.
#}
{#
Activity heatmap. Indigo rather than GitHub's green: in this app green
already means "completed", and indigo is what running work is drawn in
everywhere else — so shade reads as "how much ran", not "how much passed".
#}
{% set LEVELS = [
'bg-gray-100',
'bg-indigo-200',
'bg-indigo-400',
'bg-indigo-600',
'bg-indigo-800',
] %}
Activity · last {{ activity.window_label }}
CPU-hours per day
{% for col, label in activity.month_labels %}
{{ label }}
{% endfor %}
{% for label in ['Mon', '', 'Wed', '', 'Fri', '', ''] %}
{{ label }}
{% endfor %}
{% for week in activity.weeks %}
{% for day in week %}
{% if day %}
{% else %}
{# Before the window starts, or later this week. #}
{% endif %}
{% endfor %}
{#
Today's shape, beside the year. Stacked by source so a spike is
attributable; colours are slots 1-5 of the validated categorical palette
plus a neutral for the "Other" rollup, assigned busiest-source-first so a
source keeps its colour as the mix changes. Three of those hues sit under
3:1 on white, so the legend carries a name and a number per series —
identity is never colour alone.
#}
Last {{ hourly.window_hours }} hours
CPU-hours by source · local time
{% if hourly.is_empty %}
Nothing ran in the last {{ hourly.window_hours }} hours.
{% else %}
{# Without a scale the bars are only comparable to each other; the
peak names what full height is worth. #}
{# Clock times, not bare numbers — "16" alone reads as a count. Every
4h: 24 labels would collide, but at ~76px apart "16:00" has room.
The label overflows its one-hour column and centres on it, which
is why nothing here clips. #}
{% for source in hourly.sources %}
{{ source }}{{ '%.1f'|format(hourly.totals[source]) }}
{% endfor %}
{% endif %}
{#
One run card, shared by the "Current runs" and "Recent runs" sections
below. Finished runs render dimmed so a glance separates them from live
work without needing to read the status pill.
#}
{% macro run_card(run) %}
{% set is_active = run.status.value in ('running', 'pending') %}
{% for name, backend in backends.items() %}
{% set u = backend_usage.get(name, {}) %}
{% set q = backend.status.cluster_info.user_quota if backend.status.cluster_info else None %}
{% endif %}
{% if backend.status.disk_total_bytes and backend.status.disk_avail_bytes is not none %}
{% set disk_pct = ((backend.status.disk_total_bytes - backend.status.disk_avail_bytes) * 100 / backend.status.disk_total_bytes) | round(0, 'floor') | int %}
Disk
{{ disk_pct }}% used · {{ backend.status.disk_avail_bytes | disk_bytes }} free
{% endif %}
{% if q and (q.fair_share is not none or q.account) %}
{% if q.fair_share is not none %}
fair-share
{{ '%.2f'|format(q.fair_share) }}
{% endif %}
{% if q.account %}
account {{ q.account }}
{% endif %}
{% endif %}
{# Only rendered once there is history; on a fresh install the "Current
runs" empty state above already covers the page. #}
{% if recent_runs %}