Every template and handler message in internal/web goes through a JSON
catalogue under internal/web/locales/<code>/, with English as the fallback.
The language is the person's choice (a cookie set by /_lang/{code}), else
Accept-Language, else landing.language. Tests refuse a key some language
lacks, a translation with other arguments than English, and template text
left in English.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
48 lines
2.5 KiB
HTML
48 lines
2.5 KiB
HTML
{{define "admin_guard"}}<!doctype html>
|
|
<html lang="{{lang}}"><head>
|
|
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>{{t "guard.title"}} · llmgw</title><link rel="stylesheet" href="{{stylesheet}}">
|
|
</head><body><div class="wrap">
|
|
<header>
|
|
<h1>{{t "guard.title"}}</h1>
|
|
<p class="sub">{{t "guard.sub"}}</p>
|
|
{{template "nav" .Nav}}
|
|
</header>
|
|
{{if .Error}}<p class="error" role="alert">{{.Error}}</p>{{end}}
|
|
|
|
<h2>{{t "guard.policies"}}</h2>
|
|
{{if .Policies}}
|
|
<p>{{th "guard.defined_in"}} {{range $i, $p := .Policies}}{{if $i}}, {{end}}<code>{{$p}}</code>{{end}}.
|
|
{{t "guard.applied"}} {{if .Default}}{{range $i, $p := .Default}}{{if $i}}, {{end}}<code>{{$p}}</code>{{end}}{{else}}{{t "common.none"}}{{end}}.</p>
|
|
{{if .Attachments}}
|
|
<table class="rows">
|
|
<tr><th>{{t "guard.col.scope"}}</th><th>{{t "guard.col.who"}}</th><th>{{t "guard.col.policy"}}</th></tr>
|
|
{{range .Attachments}}<tr><td>{{.Scope}}</td><td>{{.Who}}</td><td><code>{{.Policy}}</code></td></tr>{{end}}
|
|
</table>
|
|
{{else}}<p class="sub">{{th "guard.attached_nowhere"}}</p>{{end}}
|
|
{{else}}
|
|
<p>{{th "guard.no_policies"}}</p>
|
|
{{end}}
|
|
|
|
<h2>{{t "guard.what_they_did"}}</h2>
|
|
<p class="sub">{{t "guard.over_last"}}
|
|
{{range .Windows}}{{if eq . $.Window}}<strong>{{.}}</strong>{{else}}<a href="?window={{.}}">{{.}}</a>{{end}} {{end}}</p>
|
|
{{if .Counts}}
|
|
<table class="rows">
|
|
<tr><th>{{t "guard.col.where"}}</th><th>{{t "guard.col.action"}}</th><th>{{t "guard.col.policy"}}</th><th>{{t "guard.col.category"}}</th><th class="num">{{t "guard.col.requests"}}</th></tr>
|
|
{{range .Counts}}<tr><td>{{.Where}}</td><td>{{.Action}}</td><td><code>{{.Policy}}</code></td><td>{{.Category}}</td><td class="num">{{count .Count}}</td></tr>{{end}}
|
|
</table>
|
|
{{else}}<p class="sub">{{t "guard.nothing"}}</p>{{end}}
|
|
|
|
{{if .Events}}
|
|
<h2>{{t "guard.recent"}}</h2>
|
|
<table class="rows">
|
|
<tr><th>{{t "guard.col.when"}}</th><th>{{t "guard.col.request"}}</th><th>{{t "guard.col.where"}}</th><th>{{t "guard.col.model"}}</th><th>{{t "guard.col.action"}}</th><th>{{t "guard.col.policy"}}</th><th>{{t "guard.col.category"}}</th><th class="num">{{t "guard.col.status"}}</th><th class="num">ms</th></tr>
|
|
{{range .Events}}<tr><td>{{.At}}</td><td><code>{{.RequestID}}</code></td><td>{{.Where}}</td><td>{{.Model}}</td>
|
|
<td>{{.Action}}</td><td><code>{{.Policy}}</code></td><td>{{.Category}}</td><td class="num">{{.Status}}</td><td class="num">{{count .Ms}}</td></tr>{{end}}
|
|
</table>
|
|
<p class="sub">{{th "guard.request_hint"}}</p>
|
|
{{end}}
|
|
<footer><span>llmgw {{.Version}}</span>{{template "langs"}}</footer>
|
|
</div></body></html>{{end}}
|