target-revenue/src/target_revenue/service/control_plane_templates/base.html
tegwick 856dc354d8 Fix Control Plane login under /ui; store founding token in OpenBao
Rewrite templates that lost href/action during root_path rewrite; use
native form controls for reliable login. Deploy image 0.1.2. Founding
admin token canonical location: platform/operators/founding-admin/revenue.
2026-08-06 21:41:59 +02:00

99 lines
4 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{% block title %}Target Revenue Control Plane{% endblock %}</title>
<link rel="stylesheet" href="{{ root_path }}/static/whynot-design/styles/colors_and_type.css">
<link rel="stylesheet" href="{{ root_path }}/static/whynot-design/styles/components.css">
<script type="importmap">
{
"imports": {
"lit": "https://esm.sh/lit@3.3.3"
}
}
</script>
<script type="module" src="{{ root_path }}/static/whynot-design/index.js"></script>
<style>
body { max-width: 960px; margin: 0 auto; padding: 1.5rem; font-family: system-ui, sans-serif; }
form.wn-form { display: flex; flex-direction: column; gap: 0.75rem; max-width: 480px; }
form.wn-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; }
form.wn-form input, form.wn-form select, form.wn-form textarea {
padding: 0.5rem 0.6rem; font-size: 1rem; border: 1px solid #ccc; border-radius: 4px;
}
form.wn-form button[type=submit] {
padding: 0.55rem 1rem; font-size: 1rem; cursor: pointer;
background: #1a1a1a; color: #fff; border: none; border-radius: 4px; width: fit-content;
}
form.wn-form button[type=submit].secondary { background: #555; }
.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="{{ root_path }}/">Dashboard</a>
&middot; <a href="{{ root_path }}/extensions">Extensions</a>
{% if session_rights in ("operator", "admin") %}&middot; <a href="{{ root_path }}/proposals">Proposals</a>{% endif %}
{% if session_rights == "admin" %}&middot; <a href="{{ root_path }}/admin/credentials">Credentials</a>{% endif %}
&middot; <a href="{{ root_path }}/audit">Audit log</a>
&middot; <form method="post" action="{{ root_path }}/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;">
Pilot Control Plane (alpha/beta). First declared Phase:
<code>trsl:phase:info-tech-canon-service-surface</code>
(WP-0008-T05, 2026-08-05). Live at
<a href="https://revenue.coulomb.social/ui/">revenue.coulomb.social/ui/</a>.
</p>
<script>
// Mirror wn-* named fields into real form fields when Lit components are present.
// Native <input>/<button> work without this; this keeps dual support.
(function () {
function readValue(el) {
var native = el.shadowRoot && el.shadowRoot.querySelector("input, select, textarea");
return native ? native.value : (el.value != null ? el.value : "");
}
document.querySelectorAll("form").forEach(function (form) {
form.addEventListener("submit", function () {
form.querySelectorAll("[name]").forEach(function (el) {
if (!el.tagName || el.tagName.indexOf("WN-") !== 0) return;
var name = el.getAttribute("name");
if (!name) return;
var hidden = form.querySelector('input[type="hidden"][data-wn-mirror-for="' + name + '"]');
if (!hidden) {
hidden = document.createElement("input");
hidden.type = "hidden";
hidden.name = name;
hidden.dataset.wnMirrorFor = name;
form.appendChild(hidden);
}
hidden.value = readValue(el);
});
});
form.querySelectorAll("wn-button[type=submit]").forEach(function (btn) {
btn.addEventListener("click", function () {
if (typeof form.requestSubmit === "function") form.requestSubmit();
else form.submit();
});
});
});
})();
</script>
</body>
</html>