Implement WP-0009-T04: Control Plane interactive UI on whynot-design

Builds the Control Plane's browser UI (login, dashboard, Phase
registration, Development Credit entry/proposal/review, credential
admin, audit log) as a FastAPI + Jinja2 app over the already-finished
T03 backend, rather than from scratch — whynot-design's Lit web
components are vendored as static assets (source commit 4b62cffc,
v0.4.1), with lit itself resolved via an esm.sh CDN import map.

Session auth re-checks the credential token against the database on
every request rather than trusting the session cookie's cached rights,
so a mid-session revocation takes effect immediately.

9 new Docker-gated HTTP-level tests via FastAPI's TestClient (no
browser-automation tool available, so real rendering of the <wn-*>
components was never visually verified). All four WP-0009 tasks are
now done; workplan marked finished.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
tegwick 2026-07-30 15:43:16 +02:00
parent 5fbae0df02
commit c89b4aa4a5
24 changed files with 3486 additions and 3 deletions

View file

@ -0,0 +1,54 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{% block title %}Target Revenue Control Plane{% endblock %}</title>
<link rel="stylesheet" href="/static/whynot-design/styles/colors_and_type.css">
<link rel="stylesheet" href="/static/whynot-design/styles/components.css">
<script type="importmap">
{
"imports": {
"lit": "https://esm.sh/lit@3.3.3"
}
}
</script>
<script type="module" src="/static/whynot-design/index.js"></script>
<style>
body { max-width: 960px; margin: 0 auto; padding: 1.5rem; }
form.wn-form { display: flex; flex-direction: column; gap: 0.75rem; max-width: 480px; }
.wn-flash { margin: 1rem 0; }
table.wn-plain { width: 100%; border-collapse: collapse; }
table.wn-plain th, table.wn-plain td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid #ddd; }
</style>
</head>
<body>
<wn-top-nav>
<span slot="brand">Target Revenue Control Plane</span>
</wn-top-nav>
{% if session_credential_label %}
<p>
Signed in as <strong>{{ session_credential_label }}</strong>
({{ session_rights }}) for <strong>{{ session_licensor_id }}</strong>
&middot; <a href="/">Dashboard</a>
{% if session_rights in ("operator", "admin") %}&middot; <a href="/proposals">Proposals</a>{% endif %}
{% if session_rights == "admin" %}&middot; <a href="/admin/credentials">Credentials</a>{% endif %}
&middot; <a href="/audit">Audit log</a>
&middot; <form method="post" action="/logout" style="display:inline"><button type="submit">Sign out</button></form>
</p>
{% endif %}
{% if flash %}
<wn-banner class="wn-flash" variant="{{ flash_variant | default('info') }}">{{ flash }}</wn-banner>
{% endif %}
{% block content %}{% endblock %}
<p style="margin-top:3rem;color:#888;font-size:0.85rem;">
This is a dry-run/pilot tool. No real Phase is authorized to go live via
this interface — see <code>workplans/TREV-WP-0008-governance-and-pilot-rollout.md</code> T05.
Visual language vendored from <code>whynot-design</code> — see
<code>static/whynot-design/VENDORED.md</code>.
</p>
</body>
</html>