{# Service health & lifecycle page (`/settings/service`). Top: status panel with the live pill + key facts and per-job timestamps. Middle: lifecycle controls (install / start / stop / restart / pause / uninstall), gated by the current service state. Bottom: schedule reference + recent runs table. All control actions POST to `/settings/service/control` with a hidden `action` field, then 303 back to this page so the browser shows the updated state. Errors flow back as `?err=...` for inline display. #} {% extends "base.html" %} {% block title %}Service · net-alpha{% endblock %} {% block content %} {% set installed = status.installed %} {% set running = status.running and not status.disabled %} {% set paused = state.paused if state is not none else False %} {% set last_price = state.last_run("price_refresh") if state is not none else None %} {% set last_watch = state.last_run("washsale_watch") if state is not none else None %} {% if not installed %} {% set state_label = "Not installed" %} {% set state_color = "var(--color-label-2)" %} {% set state_tint = "var(--color-hairline)" %} {% elif status.disabled %} {% set state_label = "Stopped" %} {% set state_color = "var(--color-neg)" %} {% set state_tint = "var(--color-neg-tint)" %} {% elif paused %} {% set state_label = "Paused" %} {% set state_color = "var(--color-warn)" %} {% set state_tint = "var(--color-warn-tint)" %} {% elif running %} {% set state_label = "Running" %} {% set state_color = "var(--color-pos)" %} {% set state_tint = "var(--color-pos-tint)" %} {% else %} {% set state_label = "Idle" %} {% set state_color = "var(--color-label-2)" %} {% set state_tint = "var(--color-hairline)" %} {% endif %}

Service status

Optional always-on background process for price + wash-sale refreshes.

{% if err %}
Action failed: {{ err }}
{% endif %} {# ── Status ──────────────────────────────────────────────────────────────── #}

Status

refreshes every 30s
{{ state_label }} {% if installed and status.pid %} PID {{ status.pid }} {% endif %} 127.0.0.1:8765
Last price refresh
{% if last_price %} {{ last_price.started_at.strftime("%Y-%m-%d %H:%M") }} · {{ last_price.status }} {% else %} never {% endif %}
Last wash-sale watch
{% if last_watch %} {{ last_watch.started_at.strftime("%Y-%m-%d %H:%M") }} · {{ last_watch.status }} {% else %} never {% endif %}
{# ── Lifecycle controls ─────────────────────────────────────────────────── #}

Controls

{% if not installed %}

The service is not installed. Installing creates a launchd agent under ~/.net_alpha/ and provisions a runtime venv. Requires uv on PATH.

{% else %}
{% if status.disabled %}
{% else %}
{% if paused %}
{% else %}
{% endif %} {% endif %}

Stop survives reboots via a disabled-flag latch. Pause freezes background jobs but keeps the dashboard up.

{% endif %}
{# ── Schedules ───────────────────────────────────────────────────────────── #}

Schedules

{# ── Recent runs ─────────────────────────────────────────────────────────── #}

Recent runs

auto-refreshes
{% endblock %}