2024-04-30 08:04:16 +02:00
{{ define "page" }}
2024-05-02 08:59:55 +02:00
{{ $version := .VERSION }}
2024-06-25 09:04:56 +02:00
{{ $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-06-30 11:27:49 +02:00
<script type="text/javascript" defer>
function filterDatapoints(inputFilter) {
const filter = inputFilter.value.toLowerCase()
const datapoints = document.querySelectorAll('#datapoints .name')
var datapointID
// Shortcut to show everything if a filter is not given.
if (filter == '') {
document.querySelectorAll(`[x-datapoint-id]`).forEach(matchedDP=>
matchedDP.classList.remove('hidden')
)
return
}
datapoints.forEach(dp=> {
const dpName = dp.getAttribute('x-datapoint-name')
if (dpName.toLowerCase().includes(filter)) {
datapointID = dp.getAttribute('x-datapoint-id')
document.querySelectorAll(`[x-datapoint-id="$ { datapointID}"]`).forEach(matchedDP=>
matchedDP.classList.remove('hidden')
)
} else {
datapointID = dp.getAttribute('x-datapoint-id')
document.querySelectorAll(`[x-datapoint-id="$ { datapointID}"]`).forEach(matchedDP=>
matchedDP.classList.add('hidden')
)
}
})
}
function keyhandler(evt) {
if (evt.altKey && evt.shiftKey && evt.key == 'F') {
document.getElementById('datapoints-filter').focus()
evt.preventDefault()
evt.stopPropagation()
}
}
// Add the keymap for the keybindings
document.addEventListener('keydown', keyhandler)
</script>
2024-04-30 08:04:16 +02:00
{{ block "page_label" . }} {{ end }}
<a href="/datapoint/edit/0">Create</a>
2024-06-30 11:27:49 +02:00
<div style="margin-top: 16px">
<input id="datapoints-filter" type="text" placeholder="Filter" style="width: 320px;" oninput="filterDatapoints(this)">
</div>
2024-04-30 08:04:16 +02:00
<div id="datapoints">
2024-06-25 10:50:31 +02:00
{{ $prevGroup := "15ecfcc0-b1aa-45cd-af9c-74146a7e7f56-not-very-likely" }}
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>
2024-05-30 13:01:17 +02:00
<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-06-30 11:27:49 +02:00
<div x-datapoint-id=" {{ .ID }} " class="line"></div>
2024-05-20 19:40:19 +02:00
{{ end }}
2024-06-30 11:27:49 +02:00
<div x-datapoint-id=" {{ .ID }} " x-datapoint-name=" {{ .Name }} " class="name"><a href="/datapoint/edit/ {{ .ID }} "> {{ .Name }} </a></div>
<div x-datapoint-id=" {{ .ID }} " class="datatype"> {{ .Datatype }} </div>
<div x-datapoint-id=" {{ .ID }} " class="datatype"> {{ .NodataProblemSeconds }} </div>
<div x-datapoint-id=" {{ .ID }} " class="last-value"> {{ format_time .LastValue }} </div>
2024-04-30 08:04:16 +02:00
{{ if eq .Datatype "DATETIME" }}
2024-06-30 11:27:49 +02:00
<div x-datapoint-id=" {{ .ID }} " class="value"> {{ if .LastDatapointValue .ValueDateTime .Valid }} {{ format_time .LastDatapointValue .Value }} {{ end }} </div>
2024-04-30 08:04:16 +02:00
{{ else }}
2024-06-30 11:27:49 +02:00
<div x-datapoint-id=" {{ .ID }} " class="value"> {{ .LastDatapointValue .Value }} </div>
2024-05-02 08:59:55 +02:00
{{ end }}
2024-06-30 11:27:49 +02:00
<div x-datapoint-id=" {{ .ID }} " class="icons">
2024-06-24 11:18:51 +02:00
{{ if eq .Comment "" }}
2024-06-25 09:04:56 +02:00
<div class="values"><img class="info" src="/images/ {{ $version }} / {{ $theme }} /info-outline.svg"></div>
2024-06-24 11:18:51 +02:00
{{ else }}
2024-06-25 09:04:56 +02:00
<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 }}
2024-06-25 09:04:56 +02:00
<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 }}