Show NODATA problems in UI

This commit is contained in:
Magnus Åhall 2024-05-28 07:23:27 +02:00
parent 2f95c732b6
commit 67319defac
5 changed files with 120 additions and 23 deletions

View File

@ -25,9 +25,9 @@ func ProblemsRetrieve() (problems []Problem, err error) {
problems = []Problem{} problems = []Problem{}
row := service.Db.Conn.QueryRow(` row := service.Db.Conn.QueryRow(`
SELECT SELECT
jsonb_agg(p.*) jsonb_agg(problems.*)
FROM ( FROM (
SELECT (SELECT
p.id, p.id,
p.start, p.start,
p.end, p.end,
@ -40,12 +40,31 @@ func ProblemsRetrieve() (problems []Problem, err error) {
INNER JOIN "trigger" t ON p.trigger_id = t.id INNER JOIN "trigger" t ON p.trigger_id = t.id
INNER JOIN section s ON t.section_id = s.id INNER JOIN section s ON t.section_id = s.id
INNER JOIN area a ON s.area_id = a.id INNER JOIN area a ON s.area_id = a.id
WHERE WHERE
p.end IS NULL p.end IS NULL
ORDER BY
p.start DESC)
UNION ALL
ORDER BY p.start DESC (SELECT
) p -1 AS id,
null,
null,
false,
-1 AS trigger_id,
CONCAT(
'NODATA: ',
dp.name
) AS trigger_name,
'[NODATA]' AS area_name,
'[NODATA]' AS section_name
FROM datapoint dp
WHERE
dp.nodata_is_problem
ORDER BY
dp.name ASC)
) AS problems
`) `)
var jsonBody []byte var jsonBody []byte

View File

@ -108,6 +108,7 @@ label {
#problems-list div, #problems-list div,
#acknowledged-list div { #acknowledged-list div {
white-space: nowrap; white-space: nowrap;
line-height: 24px;
} }
#problems-list .header, #problems-list .header,
#acknowledged-list .header { #acknowledged-list .header {

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="31.999987"
height="29.090721"
viewBox="0 0 8.4666629 7.6969202"
version="1.1"
id="svg8"
inkscape:version="1.3.2 (091e20e, 2023-11-25)"
sodipodi:docname="acknowledge.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.313708"
inkscape:cx="28.019106"
inkscape:cy="19.489631"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1916"
inkscape:window-height="1041"
inkscape:window-x="1920"
inkscape:window-y="1098"
inkscape:window-maximized="1"
inkscape:showpageshadow="true"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d6d6d6"
showborder="true" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-89.958296,-148.43122)">
<title
id="title1">thumb-up</title>
<path
d="m 91.497681,151.50999 v 4.61815 h -1.539385 v -4.61815 h 1.539385 m 1.539383,4.61815 a 0.76969186,0.76969186 0 0 1 -0.769692,-0.76969 v -3.84846 c 0,-0.21166 0.08467,-0.40408 0.22706,-0.54263 l 2.532286,-2.53614 0.407936,0.40794 c 0.103912,0.10385 0.169333,0.24631 0.169333,0.40408 l -0.01149,0.1232 -0.365604,1.75875 h 2.428378 c 0.42718,0 0.769693,0.34636 0.769693,0.76969 v 0.76969 c 0,0.10008 -0.01924,0.19242 -0.05388,0.28095 l -1.162236,2.71316 c -0.115446,0.27709 -0.388694,0.46951 -0.708116,0.46951 h -3.463613 m 0,-0.7697 h 3.47516 l 1.142991,-2.69392 v -0.76969 h -3.382795 l 0.434876,-2.04738 -1.670232,1.67408 z"
id="path1"
style="fill:#666666;fill-opacity:1;stroke-width:0.384845" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -8,6 +8,7 @@
div { div {
white-space: nowrap; white-space: nowrap;
line-height: 24px;
} }
.header { .header {

View File

@ -19,15 +19,24 @@
<div class="header">Section</div> <div class="header">Section</div>
<div class="header">Since</div> <div class="header">Since</div>
{{ range .Data.Problems }} {{ range .Data.Problems }}
{{ if .Acknowledged }} {{ if .Acknowledged }}
{{ continue }} {{ continue }}
{{ end }} {{ end }}
<div class="line"></div> <div class="line"></div>
<div class="trigger"><a href="/trigger/edit/{{ .TriggerID }}">{{ .TriggerName }}</a></div>
<div class="area">{{ .AreaName }}</div> {{ if eq .TriggerID -1 }}
<div class="section">{{ .SectionName }}</div> <div class="trigger">{{ .TriggerName }}</div>
<div class="start">{{ format_time .Start }}</div> <div class="area">{{ .AreaName }}</div>
<div class="acknowledge"><a href="/problem/acknowledge/{{ .ID }}"><img src="/images/{{ $version }}/acknowledge-filled.svg"></a></div> <div class="section">{{ .SectionName }}</div>
<div class="start"></div>
<div class="acknowledge"><img src="/images/{{ $version }}/acknowledge.svg"></div>
{{ else }}
<div class="trigger"><a href="/trigger/edit/{{ .TriggerID }}">{{ .TriggerName }}</a></div>
<div class="area">{{ .AreaName }}</div>
<div class="section">{{ .SectionName }}</div>
<div class="start">{{ format_time .Start }}</div>
<div class="acknowledge"><a href="/problem/acknowledge/{{ .ID }}"><img src="/images/{{ $version }}/acknowledge-filled.svg"></a></div>
{{ end }}
{{ end }} {{ end }}
</div> </div>
@ -39,15 +48,15 @@
<div class="header">Since</div> <div class="header">Since</div>
{{ range .Data.Problems }} {{ range .Data.Problems }}
{{ if not .Acknowledged }} {{ if not .Acknowledged }}
{{ continue }} {{ continue }}
{{ end }} {{ end }}
<div class="line"></div> <div class="line"></div>
<div class="trigger"><a href="/trigger/edit/{{ .TriggerID }}">{{ .TriggerName }}</a></div> <div class="trigger"><a href="/trigger/edit/{{ .TriggerID }}">{{ .TriggerName }}</a></div>
<div class="area">{{ .AreaName }}</div> <div class="area">{{ .AreaName }}</div>
<div class="section">{{ .SectionName }}</div> <div class="section">{{ .SectionName }}</div>
<div class="start">{{ format_time .Start }}</div> <div class="start">{{ format_time .Start }}</div>
<div class="acknowledge"><a href="/problem/unacknowledge/{{ .ID }}"><img src="/images/{{ $version }}/acknowledge-outline.svg"></a></div> <div class="acknowledge"><a href="/problem/unacknowledge/{{ .ID }}"><img src="/images/{{ $version }}/acknowledge-outline.svg"></a></div>
{{ end }} {{ end }}
</div> </div>