fix: 时间格式去除T和时区,视频源回退通道名
This commit is contained in:
parent
55f235b23b
commit
64f2e88c26
@ -2768,8 +2768,11 @@ func (u *UI) apiAlarmExport(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if sourceName == "" {
|
||||
sourceName = a.Channel
|
||||
}
|
||||
fmt.Fprintf(w, "%s,%s,%s,%s,%s,%s,%s\n",
|
||||
escapeCSV(a.Timestamp), escapeCSV(devName), escapeCSV(devIP), escapeCSV(sourceName),
|
||||
escapeCSV(formatAlarmTime(a.Timestamp)), escapeCSV(devName), escapeCSV(devIP), escapeCSV(sourceName),
|
||||
escapeCSV(alarmRuleLabel(a.RuleName)), escapeCSV(a.ObjectLabel),
|
||||
escapeCSV(alarmStatusLabel(a.Status)))
|
||||
}
|
||||
@ -2814,6 +2817,16 @@ func alarmStatusLabel(v string) string {
|
||||
}
|
||||
}
|
||||
|
||||
func formatAlarmTime(t string) string {
|
||||
// 2026-07-22T13:03:20+08:00 → 2026-07-22 13:03:20
|
||||
s := strings.TrimSpace(t)
|
||||
s = strings.Replace(s, "T", " ", 1)
|
||||
if idx := strings.Index(s, "+"); idx > 0 {
|
||||
s = s[:idx]
|
||||
}
|
||||
return strings.TrimSpace(s)
|
||||
}
|
||||
|
||||
func (u *UI) pageResources(w http.ResponseWriter, r *http.Request) {
|
||||
u.ensureDevicesLoaded()
|
||||
data := PageData{Title: "资源管理", Devices: u.registry.GetDevices()}
|
||||
|
||||
@ -62,7 +62,7 @@
|
||||
<a href="/devices/{{.DeviceID}}">{{index $.AlarmDeviceNames .DeviceID}}</a>
|
||||
<div class="muted small mono">{{index $.AlarmDeviceIPs .DeviceID}}</div>
|
||||
</td>
|
||||
<td>{{index $.AlarmChannelSources .Channel}}</td>
|
||||
<td>{{if index $.AlarmChannelSources .Channel}}{{index $.AlarmChannelSources .Channel}}{{else}}{{.Channel}}{{end}}</td>
|
||||
<td>
|
||||
<span class="pill warn">{{ruleLabel .RuleName}}</span>
|
||||
</td>
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user