Compare commits
2 Commits
7e45798527
...
51f96cddb1
Author | SHA1 | Date | |
---|---|---|---|
|
51f96cddb1 | ||
|
df8e3fba23 |
2
main.go
2
main.go
@ -29,7 +29,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "v26"
|
const VERSION = "v27"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
|
@ -24,6 +24,9 @@
|
|||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
color: #7bb8eb;
|
color: #7bb8eb;
|
||||||
}
|
}
|
||||||
|
#datapoints .hidden {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
#datapoints div {
|
#datapoints div {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
@ -24,6 +24,9 @@
|
|||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
color: #777;
|
color: #777;
|
||||||
}
|
}
|
||||||
|
#datapoints .hidden {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
#datapoints div {
|
#datapoints div {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
@ -30,6 +30,10 @@
|
|||||||
color: @text3;
|
color: @text3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
@ -2,11 +2,56 @@
|
|||||||
{{ $version := .VERSION }}
|
{{ $version := .VERSION }}
|
||||||
{{ $theme := .CONFIG.THEME }}
|
{{ $theme := .CONFIG.THEME }}
|
||||||
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/{{ .CONFIG.THEME }}/datapoints.css">
|
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/{{ .CONFIG.THEME }}/datapoints.css">
|
||||||
|
<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>
|
||||||
|
|
||||||
{{ block "page_label" . }}{{end}}
|
{{ block "page_label" . }}{{end}}
|
||||||
|
|
||||||
<a href="/datapoint/edit/0">Create</a>
|
<a href="/datapoint/edit/0">Create</a>
|
||||||
|
|
||||||
|
<div style="margin-top: 16px">
|
||||||
|
<input id="datapoints-filter" type="text" placeholder="Filter" style="width: 320px;" oninput="filterDatapoints(this)">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="datapoints">
|
<div id="datapoints">
|
||||||
{{ $prevGroup := "15ecfcc0-b1aa-45cd-af9c-74146a7e7f56-not-very-likely" }}
|
{{ $prevGroup := "15ecfcc0-b1aa-45cd-af9c-74146a7e7f56-not-very-likely" }}
|
||||||
{{ range .Data.Datapoints }}
|
{{ range .Data.Datapoints }}
|
||||||
@ -20,18 +65,18 @@
|
|||||||
<div class="header"></div>
|
<div class="header"></div>
|
||||||
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<div class="line"></div>
|
<div x-datapoint-id="{{ .ID }}" class="line"></div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div class="name"><a href="/datapoint/edit/{{ .ID }}">{{ .Name }}</a></div>
|
<div x-datapoint-id="{{ .ID }}" x-datapoint-name="{{ .Name }}" class="name"><a href="/datapoint/edit/{{ .ID }}">{{ .Name }}</a></div>
|
||||||
<div class="datatype">{{ .Datatype }}</div>
|
<div x-datapoint-id="{{ .ID }}" class="datatype">{{ .Datatype }}</div>
|
||||||
<div class="datatype">{{ .NodataProblemSeconds }}</div>
|
<div x-datapoint-id="{{ .ID }}" class="datatype">{{ .NodataProblemSeconds }}</div>
|
||||||
<div class="last-value">{{ format_time .LastValue }}</div>
|
<div x-datapoint-id="{{ .ID }}" class="last-value">{{ format_time .LastValue }}</div>
|
||||||
{{ if eq .Datatype "DATETIME" }}
|
{{ if eq .Datatype "DATETIME" }}
|
||||||
<div class="value">{{ if .LastDatapointValue.ValueDateTime.Valid }}{{ format_time .LastDatapointValue.Value }}{{ end }}</div>
|
<div x-datapoint-id="{{ .ID }}" class="value">{{ if .LastDatapointValue.ValueDateTime.Valid }}{{ format_time .LastDatapointValue.Value }}{{ end }}</div>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<div class="value">{{ .LastDatapointValue.Value }}</div>
|
<div x-datapoint-id="{{ .ID }}" class="value">{{ .LastDatapointValue.Value }}</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div class="icons">
|
<div x-datapoint-id="{{ .ID }}" class="icons">
|
||||||
{{ if eq .Comment "" }}
|
{{ if eq .Comment "" }}
|
||||||
<div class="values"><img class="info" src="/images/{{ $version }}/{{ $theme }}/info-outline.svg"></div>
|
<div class="values"><img class="info" src="/images/{{ $version }}/{{ $theme }}/info-outline.svg"></div>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
Loading…
Reference in New Issue
Block a user