Files
bvandeusenandClaude Opus 5.5 5ec930bf76
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 53s
CI / unit (push) Successful in 1m14s
CI / publish (push) Successful in 1m10s
feat(ui): Disk, Traefik, UniFi and Settings say things plainly (#5212)
#5212 "Plain labels: no raw ids, scopes, metric keys or unexplained jargon",
batch 3:

- Disk page: each tile says what it holds. "Writable layers" becomes
  "Container files" and Build cache says it is safe to clear. Shared is
  "Shared with other images" with a tooltip, and "dangling" is gone.
  Untagged images show by id instead of "<none>", a capped list says
  "The 50 largest of N images", and each host shows "as of" its report.
- Traefik: an expired certificate reads "expired 12 days ago", not "-12
  days" (cert_left). The Traffic empty state knows whether the access log
  is on: off points to Settings → Plugins → Traefik; on says to check the
  mounted log path.
- Moments use |ago with an exact UTC tooltip: UniFi last seen, alarms,
  events, speed test and DPI; AI token last used.
- Settings: the Auth tab is "Authentication" like its breadcrumb, plugin
  fields read "Metrics URL" not metrics_url (field_label), a source's pull
  interval is "every 1h", and the last report time drops the ISO "T".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 00:29:30 -04:00

125 lines
5.1 KiB
HTML

{% extends "base.html" %}
{% block title %}AI access — Steward{% endblock %}
{% block head %}
<style>
.ai-access-grid { display:grid; grid-template-columns:minmax(0,1fr) 320px; gap:1.5rem; align-items:start; }
.ai-access-grid .card-flush { overflow-x:auto; }
@media (max-width: 900px) { .ai-access-grid { grid-template-columns:minmax(0,1fr); } }
</style>
{% endblock %}
{% block content %}
{% set role_help = {
"viewer": "Reads everything you can see. Changes nothing.",
"operator": "Also runs playbooks and changes monitors and alerts.",
"admin": "Full access, the same as an admin in the UI.",
} %}
<h1 class="page-title">AI access</h1>
<p style="color:var(--text-muted);font-size:0.9rem;max-width:720px;margin:-0.5rem 0 1.5rem;line-height:1.55;">
A token lets an AI client such as Claude Code connect to Steward over MCP and act as
<strong style="color:var(--text);">you</strong>, limited to the role you give the token.
Everything a token changes is written to the audit log under your name.
</p>
<div class="ai-access-grid">
<div>
<div class="section-title" style="margin-bottom:0.75rem;">Your tokens</div>
{% if rows %}
<div class="card-flush">
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Role</th>
<th>Created</th>
<th>Last used</th>
<th>Expires</th>
<th></th>
</tr>
</thead>
<tbody>
{% for row in rows %}
{% set t = row.token %}
<tr {% if row.state != 'active' %}style="opacity:0.55;"{% endif %}>
<td>
<div style="font-weight:500;">{{ t.name }}</div>
<div style="font-family:ui-monospace,monospace;font-size:0.75rem;color:var(--text-muted);">{{ t.prefix }}…</div>
</td>
<td><span class="badge badge-dim">{{ t.role.value }}</span></td>
<td style="white-space:nowrap;">{{ t.created_at.strftime("%Y-%m-%d") }}</td>
<td style="white-space:nowrap;">
{% if t.last_used_at %}{{ t.last_used_at|ago }}{% else %}<span style="color:var(--text-muted);">Never</span>{% endif %}
</td>
<td style="white-space:nowrap;">
{% if row.state == 'revoked' %}<span class="badge badge-red">Revoked</span>
{% elif row.state == 'expired' %}<span class="badge badge-red">Expired</span>
{% elif t.expires_at %}{{ t.expires_at.strftime("%Y-%m-%d") }}
{% else %}<span style="color:var(--text-muted);">Never</span>{% endif %}
</td>
<td class="td-actions">
{% if row.state == 'active' %}
<form method="post" action="/ai-access/tokens/{{ t.id }}/revoke" style="margin:0;"
data-confirm="Revoke “{{ t.name }}”? Any client using it stops working immediately.">{{ csrf_field() }}
<button type="submit" class="btn btn-danger btn-sm">Revoke</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="card empty">
You have no tokens yet. Create one on the right, then paste it into your AI client.
</div>
{% endif %}
</div>
<div>
<div class="section-title" style="margin-bottom:0.75rem;">Create a token</div>
<div class="card" style="margin-bottom:0;">
<form method="post" action="/ai-access/tokens">{{ csrf_field() }}
<div class="form-group">
<label for="tok-name">Name</label>
<input type="text" id="tok-name" name="name" required maxlength="128"
placeholder="e.g. Claude Code on my laptop">
</div>
<div class="form-group">
<label for="tok-role">Role</label>
<select id="tok-role" name="role">
{% for r in grantable %}
<option value="{{ r.value }}" {% if loop.first %}selected{% endif %}>{{ r.value|capitalize }}</option>
{% endfor %}
</select>
<div style="font-size:0.78rem;color:var(--text-muted);margin-top:0.4rem;line-height:1.5;">
{% for r in grantable %}
<div><strong style="color:var(--text);">{{ r.value|capitalize }}:</strong> {{ role_help[r.value] }}</div>
{% endfor %}
</div>
</div>
<div class="form-group">
<label for="tok-exp">Expires after</label>
<select id="tok-exp" name="expires_in_days">
{% for value, label in expiry_choices %}
<option value="{{ value }}">{{ label }}</option>
{% endfor %}
</select>
</div>
<button type="submit" class="btn">Create token</button>
</form>
</div>
<div style="font-size:0.78rem;color:var(--text-muted);margin-top:0.75rem;line-height:1.5;">
The token is shown <strong>once</strong>. A token never acts above your own role
({{ user_role.value }}), even if your role is lowered later.
</div>
</div>
</div>
<div style="max-width:720px;margin-top:1.5rem;">
{% set token = none %}
{% include "ai_access/_connect.html" %}
</div>
{% endblock %}