safesight-control/internal/web/ui/templates/device_config.html
2026-04-19 10:17:48 +08:00

64 lines
3.5 KiB
HTML

{{define "device_config"}}
<div class="card">
<div class="section-title">
<div>
<h2>配置管理</h2>
<div class="muted small">面向单台设备的设备运行配置、服务状态和服务管理。</div>
</div>
<a class="btn ghost" href="/ui/devices">返回设备列表</a>
</div>
</div>
<div class="card">
<h2>设备运行配置</h2>
<div class="table-wrap" style="margin-top:10px">
<table>
<thead>
<tr><th>设备</th><th>状态</th><th>管理地址</th><th>服务状态</th><th>配置操作</th><th>服务管理</th></tr>
</thead>
<tbody>
{{range .Devices}}
<tr>
<td><a class="mono" href="/ui/devices/{{.DeviceID}}">{{if .DeviceName}}{{.DeviceName}}{{else}}{{.DeviceID}}{{end}}</a><div class="muted small mono">{{.DeviceID}}</div></td>
<td>{{if .Online}}<span class="pill ok">在线</span>{{else}}<span class="pill bad">离线</span>{{end}}</td>
<td class="mono">{{.IP}}:{{.AgentPort}}</td>
<td>
<form method="post" action="/ui/devices/{{.DeviceID}}/action">
<input type="hidden" name="action" value="media_status" />
<button type="submit" class="btn ghost">查看服务状态</button>
</form>
</td>
<td>
<div class="actions">
<a class="btn ghost" href="/ui/devices/{{.DeviceID}}/config-ui">配置查看</a>
<a class="btn ghost" href="/ui/devices/{{.DeviceID}}/config-friendly">配置修改</a>
</div>
<form method="post" action="/ui/devices/{{.DeviceID}}/media-server/configs/upload" enctype="multipart/form-data" class="row compact-form">
<input name="name" placeholder="方案名" />
<input type="file" name="file" accept="application/json,.json" />
<button type="submit" class="btn ghost">配置上传</button>
</form>
<form method="post" action="/ui/devices/{{.DeviceID}}/media-server/configs/upload-batch" enctype="multipart/form-data" class="row compact-form">
<input type="file" name="files" multiple accept="application/json,.json" />
<button type="submit" class="btn ghost">批量上传</button>
</form>
</td>
<td>
<div class="actions">
<form method="post" action="/ui/devices/{{.DeviceID}}/action"><input type="hidden" name="action" value="media_start" /><button type="submit" class="btn ghost">启动视频分析</button></form>
<form method="post" action="/ui/devices/{{.DeviceID}}/action"><input type="hidden" name="action" value="media_restart" /><button type="submit" class="btn ghost">重启视频分析</button></form>
<form method="post" action="/ui/devices/{{.DeviceID}}/action"><input type="hidden" name="action" value="media_stop" /><button type="submit" class="btn ghost">停止视频分析</button></form>
<form method="post" action="/ui/devices/{{.DeviceID}}/action"><input type="hidden" name="action" value="reload" /><button type="submit" class="btn ghost">重载识别服务</button></form>
<form method="post" action="/ui/devices/{{.DeviceID}}/action"><input type="hidden" name="action" value="rollback" /><button type="submit" class="btn ghost">回滚识别配置</button></form>
</div>
</td>
</tr>
{{else}}
<tr><td colspan="6" class="muted">暂无设备。请先在“新增设备”页扫描或手动添加。</td></tr>
{{end}}
</tbody>
</table>
</div>
</div>
{{end}}