smon/views/pages/datapoints.gotmpl

47 lines
1.9 KiB
Go Template
Raw Permalink Normal View History

2024-04-30 08:04:16 +02:00
{{ define "page" }}
2024-05-02 08:59:55 +02:00
{{ $version := .VERSION }}
{{ $theme := .CONFIG.THEME }}
2024-06-25 08:59:07 +02:00
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/{{ .CONFIG.THEME }}/datapoints.css">
2024-04-30 08:04:16 +02:00
{{ block "page_label" . }}{{end}}
<a href="/datapoint/edit/0">Create</a>
<div id="datapoints">
2024-05-20 19:40:19 +02:00
{{ $prevGroup := "kalle" }}
2024-04-30 08:04:16 +02:00
{{ range .Data.Datapoints }}
2024-05-20 19:40:19 +02:00
{{ if ne $prevGroup .Group }}
2024-05-28 07:37:22 +02:00
<h2 class="line">{{ .Group }}</h2>
2024-05-20 19:40:19 +02:00
<div class="header">Name</div>
<div class="header">Datatype</div>
<div class="header">No data</div>
2024-05-20 19:40:19 +02:00
<div class="header">Last value</div>
<div class="header">Value</div>
<div class="header"></div>
{{ else }}
2024-05-01 20:01:43 +02:00
<div class="line"></div>
2024-05-20 19:40:19 +02:00
{{ end }}
2024-04-30 08:04:16 +02:00
<div class="name"><a href="/datapoint/edit/{{ .ID }}">{{ .Name }}</a></div>
<div class="datatype">{{ .Datatype }}</div>
<div class="datatype">{{ .NodataProblemSeconds }}</div>
2024-04-30 08:04:16 +02:00
<div class="last-value">{{ format_time .LastValue }}</div>
{{ if eq .Datatype "DATETIME" }}
<div class="value">{{ if .LastDatapointValue.ValueDateTime.Valid }}{{ format_time .LastDatapointValue.Value }}{{ end }}</div>
{{ else }}
<div class="value">{{ .LastDatapointValue.Value }}</div>
2024-05-02 08:59:55 +02:00
{{ end }}
2024-05-05 20:16:28 +02:00
<div class="icons">
2024-06-24 11:18:51 +02:00
{{ if eq .Comment "" }}
<div class="values"><img class="info" src="/images/{{ $version }}/{{ $theme }}/info-outline.svg"></div>
2024-06-24 11:18:51 +02:00
{{ else }}
<div class="values"><img class="info" src="/images/{{ $version }}/{{ $theme }}/info-filled.svg" title="{{ .Comment }}"></div>
2024-06-24 11:18:51 +02:00
{{ end }}
<div class="values"><a href="/datapoint/values/{{ .ID }}"><img src="/images/{{ $version }}/{{ $theme }}/values.svg"></a></div>
2024-06-25 09:49:09 +02:00
<div class="delete"><a href="/datapoint/delete/{{ .ID }}" onclick="confirm(`Are you sure you want to delete '{{ .Name }}'?`)"><img src="/images/{{ $version }}/{{ $theme }}/delete.svg"></a></div>
2024-05-05 20:16:28 +02:00
</div>
2024-05-20 19:40:19 +02:00
{{ $prevGroup = .Group }}
2024-05-05 20:16:28 +02:00
{{ end }}
2024-04-30 08:04:16 +02:00
</div>
{{ end }}