safesight-control/internal/web/ui/templates/config_ui.html

59 lines
2.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{define "config_ui"}}
<div class="card">
<h2>通道配置instances</h2>
<div class="muted small">设备:<a class="mono" href="/ui/devices/{{.Device.DeviceID}}">{{.Device.DeviceID}}</a>{{.Device.DeviceName}}</div>
</div>
<div class="card">
<h2>Schema / Current State</h2>
<div class="muted small">来自 agent<code class="mono">GET /v1/config/ui/schema</code><code class="mono">GET /v1/config/ui/state</code></div>
<div class="row" style="margin-top:10px; gap:16px">
<div style="flex:1">
<div class="muted small">schema</div>
<pre>{{.SchemaJSON}}</pre>
</div>
<div style="flex:1">
<div class="muted small">state</div>
<pre>{{.StateJSON}}</pre>
</div>
</div>
</div>
<div class="card">
<h2>编辑 desired state</h2>
<div class="muted small">提交到 agent<code class="mono">POST /v1/config/ui/plan</code><code class="mono">POST /v1/config/ui/apply</code></div>
<form method="post" action="/ui/devices/{{.Device.DeviceID}}/config-ui/plan">
<textarea name="json" spellcheck="false">{{if .RawJSON}}{{.RawJSON}}{{else}}{"instances":[]}{{end}}</textarea>
<div class="actions" style="margin-top:10px">
<button type="submit">Plandry-run</button>
<button type="submit" formaction="/ui/devices/{{.Device.DeviceID}}/config-ui/apply">Apply写盘+reload</button>
</div>
</form>
</div>
<div class="card">
<h2>人脸库face_gallery.db</h2>
<div class="muted small">上传:<code class="mono">PUT /v1/face-gallery</code>;热加载:<code class="mono">POST /v1/face-gallery/reload</code></div>
<pre>{{.FaceGalleryJSON}}</pre>
<div class="row" style="margin-top:10px; gap:16px">
<form method="post" action="/ui/devices/{{.Device.DeviceID}}/face-gallery/upload" enctype="multipart/form-data" class="row">
<div>
<div class="muted small">file</div>
<input type="file" name="file" />
</div>
<div style="align-self:end"><button type="submit">上传 db</button></div>
</form>
<form method="post" action="/ui/devices/{{.Device.DeviceID}}/face-gallery/reload" style="align-self:end">
<button type="submit">热加载</button>
</form>
</div>
</div>
{{if .RawText}}
<div class="card">
<h2>最近响应</h2>
<pre>{{.RawText}}</pre>
</div>
{{end}}
{{end}}