Added nodata_problem_seconds to datapoint view

This commit is contained in:
Magnus Åhall 2024-05-30 13:01:17 +02:00
parent aa9376ac13
commit a94559ab6c
4 changed files with 12 additions and 7 deletions

View File

@ -161,6 +161,7 @@ func DatapointsRetrieve() (dps []Datapoint, err error) { // {{{
dp.datatype, dp.datatype,
dp.last_value, dp.last_value,
dp.group, dp.group,
dp.nodata_problem_seconds,
dpv.id AS v_id, dpv.id AS v_id,
dpv.ts, dpv.ts,
@ -190,6 +191,7 @@ func DatapointsRetrieve() (dps []Datapoint, err error) { // {{{
Name string Name string
Datatype DatapointType Datatype DatapointType
LastValue time.Time `db:"last_value"` LastValue time.Time `db:"last_value"`
NodataProblemSeconds int `db:"nodata_problem_seconds"`
VID sql.NullInt64 `db:"v_id"` VID sql.NullInt64 `db:"v_id"`
Ts sql.NullTime Ts sql.NullTime
@ -214,6 +216,7 @@ func DatapointsRetrieve() (dps []Datapoint, err error) { // {{{
dp.Datatype = res.Datatype dp.Datatype = res.Datatype
dp.LastValue = res.LastValue dp.LastValue = res.LastValue
dp.Found = true dp.Found = true
dp.NodataProblemSeconds = res.NodataProblemSeconds
if res.VID.Valid { if res.VID.Valid {
dpv.ID = int(res.VID.Int64) dpv.ID = int(res.VID.Int64)

View File

@ -104,7 +104,7 @@ label {
} }
#datapoints { #datapoints {
display: grid; display: grid;
grid-template-columns: repeat(5, min-content); grid-template-columns: repeat(6, min-content);
grid-gap: 8px 16px; grid-gap: 8px 16px;
margin-top: 16px; margin-top: 16px;
} }

View File

@ -2,7 +2,7 @@
#datapoints { #datapoints {
display: grid; display: grid;
grid-template-columns: repeat(5, min-content); grid-template-columns: repeat(6, min-content);
grid-gap: 8px 16px; grid-gap: 8px 16px;
margin-top: 16px; margin-top: 16px;

View File

@ -13,6 +13,7 @@
<h2 class="line">{{ .Group }}</h2> <h2 class="line">{{ .Group }}</h2>
<div class="header">Name</div> <div class="header">Name</div>
<div class="header">Datatype</div> <div class="header">Datatype</div>
<div class="header">No data</div>
<div class="header">Last value</div> <div class="header">Last value</div>
<div class="header">Value</div> <div class="header">Value</div>
<div class="header"></div> <div class="header"></div>
@ -22,6 +23,7 @@
{{ end }} {{ end }}
<div class="name"><a href="/datapoint/edit/{{ .ID }}">{{ .Name }}</a></div> <div class="name"><a href="/datapoint/edit/{{ .ID }}">{{ .Name }}</a></div>
<div class="datatype">{{ .Datatype }}</div> <div class="datatype">{{ .Datatype }}</div>
<div class="datatype">{{ .NodataProblemSeconds }}</div>
<div class="last-value">{{ format_time .LastValue }}</div> <div 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 class="value">{{ if .LastDatapointValue.ValueDateTime.Valid }}{{ format_time .LastDatapointValue.Value }}{{ end }}</div>