Compare commits

...

3 Commits

Author SHA1 Message Date
Magnus Åhall
3227c22de1 Bumped to v30 2024-07-04 16:30:14 +02:00
Magnus Åhall
1bef8719c0 UI adjustments for problems view 2024-07-04 16:29:53 +02:00
Magnus Åhall
b53b507355 Added SQL for problem 2024-07-04 16:06:11 +02:00
7 changed files with 37 additions and 18 deletions

View File

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

1
sql/00024.sql Normal file
View File

@ -0,0 +1 @@
ALTER TABLE public.problem ADD COLUMN trigger_name VARCHAR NOT NULL DEFAULT '[Unknown]';

View File

@ -237,6 +237,9 @@ label {
grid-template-columns: min-content min-content;
grid-gap: 6px 16px;
width: min-content;
background-color: #fff;
border: 1px solid #2979b8;
padding: 16px;
border-radius: 6px;
}
#time-selector.hidden {

View File

@ -237,6 +237,9 @@ label {
grid-template-columns: min-content min-content;
grid-gap: 6px 16px;
width: min-content;
background-color: #282828;
border: 1px solid #333;
padding: 16px;
border-radius: 6px;
}
#time-selector.hidden {

View File

@ -6,6 +6,7 @@ export class UI {
const list = document.getElementById('acknowledged-list')
list.classList.remove('hidden')
}
this.acknowledgeDisplay(showAcked == 'true')
const display = localStorage.getItem('problems_display')
if (display === null)
@ -23,13 +24,20 @@ export class UI {
}
toggleAcknowledged(evt) {
const list = document.getElementById('acknowledged-list')
this.acknowledgeDisplay(evt.target.checked)
}
if (evt.target.checked) {
acknowledgeDisplay(show) {
const list = document.getElementById('acknowledged-list')
const areaItems = document.querySelectorAll('.acked')
if (show) {
list.classList.remove('hidden')
areaItems.forEach(item=>item.classList.remove('hidden'))
localStorage.setItem('show_acknowledged', true)
} else {
list.classList.add('hidden')
areaItems.forEach(item=>item.classList.add('hidden'))
localStorage.setItem('show_acknowledged', false)
}
}

View File

@ -295,6 +295,9 @@ label {
grid-gap: 6px 16px;
width: min-content;
background-color: @bg1;
border: 1px solid @bg3;
padding: 16px;
border-radius: 6px;
&.hidden {

View File

@ -15,13 +15,16 @@
<input {{ if eq .Data.Selection "ALL" }}checked{{ end }} type="radio" name="selection" id="selection-all" onclick="_ui.selectAll()"> <label for="selection-all">Time-filtered problems</label>
</div>
<hr>
<hr style="margin-bottom: 16px">
{{ block "timefilter" . }}{{ end }}
<div style="margin-top: 16px">
<input type="radio" name="display" id="display-table" onclick="_ui.displayAreas()"> <label for="display-table">Areas</label>
<input type="radio" name="display" id="display-list" onclick="_ui.displayList()"> <label for="display-list">List</label>
<div style="margin-top: 8px">
<input type="checkbox" id="show-acked" onclick="_ui.toggleAcknowledged(event)"> <label for="show-acked">Show acknowledged</label>
</div>
</div>
<div class="display-list hidden">
@ -67,8 +70,6 @@
{{ end }}
</div>
<input type="checkbox" id="show-acked" onclick="_ui.toggleAcknowledged(event)"> <label for="show-acked">Show acknowledged</label>
<div id="acknowledged-list" class="hidden">
<div style="grid-column: 1/-1;"><h2>Acknowledged</h2></div>
<div class="header">Trigger</div>
@ -108,20 +109,20 @@
<div class="name">{{ $sectionName }}</div>
{{ range $problems }}
<div>{{ if .IsArchived }}<span class="ok">Archived</span>{{ else }}<span class="error">Current</span>{{ end }}</div>
<div class="{{ if .Acknowledged }}acked hidden{{ end }}">{{ if .IsArchived }}<span class="ok">Archived</span>{{ else }}<span class="error">Current</span>{{ end }}</div>
<div class="trigger">{{ .TriggerName }}</div>
<div class="{{ if .Acknowledged }}acked hidden{{ end }} trigger">{{ .TriggerName }}</div>
{{ if eq (.Start | html) "0001-01-01 00:00:00 +0000 UTC" }}
<div class="since"></div>
<div class="{{ if .Acknowledged }}acked hidden{{ end }} since"></div>
{{ else }}
<div class="since">{{ format_time .Start }}</div>
<div class="{{ if .Acknowledged }}acked hidden{{ end }} since">{{ format_time .Start }}</div>
{{ end }}
{{ if .FormattedValues }}
<div><img src="/images/{{ $version }}/{{ $theme }}/info-filled.svg" title="{{ .FormattedValues }}"></div>
<div class="{{ if .Acknowledged }}acked hidden{{ end }}"><img src="/images/{{ $version }}/{{ $theme }}/info-filled.svg" title="{{ .FormattedValues }}"></div>
{{ else }}
<div><img src="/images/{{ $version }}/{{ $theme }}/info-outline.svg"></div>
<div class="{{ if .Acknowledged }}acked hidden{{ end }}"><img src="/images/{{ $version }}/{{ $theme }}/info-outline.svg"></div>
{{ end }}
{{ end }}