Compare commits

..

No commits in common. "51f96cddb139da4bafa6ceeb697e985faac31f13" and "7e45798527f4e59333a904e71209eb6a607acec9" have entirely different histories.

5 changed files with 9 additions and 64 deletions

View File

@ -29,7 +29,7 @@ import (
"time" "time"
) )
const VERSION = "v27" const VERSION = "v26"
var ( var (
logger *slog.Logger logger *slog.Logger

View File

@ -24,9 +24,6 @@
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;

View File

@ -24,9 +24,6 @@
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;

View File

@ -30,10 +30,6 @@
color: @text3; color: @text3;
} }
.hidden {
display: none !important;
}
div { div {
white-space: nowrap; white-space: nowrap;
align-self: center; align-self: center;

View File

@ -2,56 +2,11 @@
{{ $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 }}
@ -65,18 +20,18 @@
<div class="header"></div> <div class="header"></div>
{{ else }} {{ else }}
<div x-datapoint-id="{{ .ID }}" class="line"></div> <div class="line"></div>
{{ end }} {{ end }}
<div x-datapoint-id="{{ .ID }}" x-datapoint-name="{{ .Name }}" class="name"><a href="/datapoint/edit/{{ .ID }}">{{ .Name }}</a></div> <div class="name"><a href="/datapoint/edit/{{ .ID }}">{{ .Name }}</a></div>
<div x-datapoint-id="{{ .ID }}" class="datatype">{{ .Datatype }}</div> <div class="datatype">{{ .Datatype }}</div>
<div x-datapoint-id="{{ .ID }}" class="datatype">{{ .NodataProblemSeconds }}</div> <div class="datatype">{{ .NodataProblemSeconds }}</div>
<div x-datapoint-id="{{ .ID }}" class="last-value">{{ format_time .LastValue }}</div> <div class="last-value">{{ format_time .LastValue }}</div>
{{ if eq .Datatype "DATETIME" }} {{ if eq .Datatype "DATETIME" }}
<div x-datapoint-id="{{ .ID }}" class="value">{{ if .LastDatapointValue.ValueDateTime.Valid }}{{ format_time .LastDatapointValue.Value }}{{ end }}</div> <div class="value">{{ if .LastDatapointValue.ValueDateTime.Valid }}{{ format_time .LastDatapointValue.Value }}{{ end }}</div>
{{ else }} {{ else }}
<div x-datapoint-id="{{ .ID }}" class="value">{{ .LastDatapointValue.Value }}</div> <div class="value">{{ .LastDatapointValue.Value }}</div>
{{ end }} {{ end }}
<div x-datapoint-id="{{ .ID }}" class="icons"> <div 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 }}