3588AdminBackend/internal/web/ui/templates/asset_profile.html

100 lines
5.2 KiB
HTML

{{define "asset_profile"}}
{{template "asset_tabs" .}}
{{if .AssetProfileEditor}}
<form method="post" action="/ui/assets/profiles/{{.AssetProfileEditor.Name}}">
<div class="card">
<div class="section-title">
<div>
<h2 class="title-with-icon">{{icon "profile"}}<span>业务配置</span></h2>
</div>
<a class="btn secondary" href="/ui/assets/profiles">返回业务配置列表</a>
</div>
<div class="field-grid">
<label><span>业务配置名称</span><input name="profile_name" value="{{.AssetProfileEditor.Name}}" /></label>
<label><span>业务名称</span><input name="business_name" value="{{.AssetProfileEditor.BusinessName}}" /></label>
<label><span>站点名</span><input name="site_name" value="{{.AssetProfileEditor.SiteName}}" /></label>
<label><span>描述</span><input name="description" value="{{.AssetProfileEditor.Description}}" /></label>
<label><span>队列大小</span><input class="mono" name="queue_size" value="{{.AssetProfileEditor.Queue.Size}}" /></label>
<label><span>队列策略</span><input name="queue_strategy" value="{{.AssetProfileEditor.Queue.Strategy}}" /></label>
</div>
</div>
<div class="card">
<div class="section-title">
<div>
<h2 class="title-with-icon">{{icon "device"}}<span>视频通道</span></h2>
</div>
<div class="actions compact">
<span class="pill">{{len .AssetProfileEditor.Instances}} 路</span>
<button class="btn secondary" type="submit" name="add_instance" value="1">{{icon "apply"}}<span>新增通道</span></button>
</div>
</div>
<table>
<thead>
<tr>
<th>通道</th>
<th>通道显示名</th>
<th>RTSP 输入</th>
<th>HLS 输出</th>
<th>RTSP 输出</th>
<th></th>
</tr>
</thead>
<tbody>
{{range $i, $inst := .AssetProfileEditor.Instances}}
<tr {{if $inst.Delete}}class="muted-row"{{end}}>
<td class="mono">{{$inst.Name}}</td>
<td>{{if $inst.Delete}}<span class="pill warn">待删除</span>{{else}}{{if $inst.DisplayName}}{{$inst.DisplayName}}{{else}}-{{end}}{{end}}</td>
<td class="mono truncate-cell">{{if $inst.Delete}}-{{else}}{{$inst.RTSPURL}}{{end}}</td>
<td class="mono truncate-cell">{{if $inst.Delete}}-{{else}}{{$inst.PublishHLSPath}}{{end}}</td>
<td class="mono truncate-cell">{{if $inst.Delete}}-{{else}}{{if $inst.PublishRTSPPort}}{{$inst.PublishRTSPPort}}{{end}}{{if $inst.PublishRTSPPath}} {{$inst.PublishRTSPPath}}{{end}}{{end}}</td>
<td>
<div class="actions compact">
<a class="btn ghost" href="#profile-instance-{{$i}}">编辑</a>
{{if $inst.Delete}}
<button class="btn secondary" type="submit" name="instances[{{$i}}].delete" value="0">撤销删除</button>
{{else}}
<button class="btn secondary" type="submit" name="instances[{{$i}}].delete" value="1">删除</button>
{{end}}
</div>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{range $i, $inst := .AssetProfileEditor.Instances}}
<details id="profile-instance-{{$i}}" class="card collapsible profile-instance-editor" {{if or $inst.Delete (not $inst.Name)}}open{{end}}>
<summary class="title-with-icon">{{icon "device"}}<span>{{$inst.Name}}</span></summary>
<div class="field-grid profile-instance-grid">
<input type="hidden" name="instances[{{$i}}].delete" value="{{if $inst.Delete}}1{{else}}0{{end}}" />
<input type="hidden" name="instances[{{$i}}].template" value="{{$inst.Template}}" />
<label><span>通道名</span><input name="instances[{{$i}}].name" value="{{$inst.Name}}" /></label>
<label><span>通道显示名</span><input name="instances[{{$i}}].display_name" value="{{$inst.DisplayName}}" /></label>
<label><span>通道号</span><input name="instances[{{$i}}].channel_no" value="{{$inst.ChannelNo}}" /></label>
<label class="full"><span>RTSP 输入</span><input class="mono" name="instances[{{$i}}].rtsp_url" value="{{$inst.RTSPURL}}" /></label>
<label class="full"><span>HLS 输出</span><input class="mono" name="instances[{{$i}}].publish_hls_path" value="{{$inst.PublishHLSPath}}" /></label>
<label><span>RTSP 输出端口</span><input class="mono" name="instances[{{$i}}].publish_rtsp_port" value="{{$inst.PublishRTSPPort}}" /></label>
<label><span>RTSP 输出路径</span><input class="mono" name="instances[{{$i}}].publish_rtsp_path" value="{{$inst.PublishRTSPPath}}" /></label>
<label class="full"><span>高级设置 JSON</span><textarea name="instances[{{$i}}].advanced_params" rows="5" class="code-input">{{if $inst.AdvancedParams}}{{json $inst.AdvancedParams}}{{end}}</textarea></label>
</div>
</details>
{{end}}
<div class="card">
<div class="actions">
<button type="submit">{{icon "apply"}}<span>保存</span></button>
</div>
</div>
</form>
<details class="card collapsible">
<summary class="title-with-icon">{{icon "tech"}}<span>原始 JSON</span></summary>
<pre>{{json .AssetProfileEditor.Raw}}</pre>
</details>
{{end}}
{{if .Error}}<div class="error">{{.Error}}</div>{{end}}
{{template "asset_tabs_end" .}}
{{end}}