smon/views/pages/problems.gotmpl

164 lines
7.1 KiB
Go Template
Raw Permalink Normal View History

2024-04-29 08:36:13 +02:00
{{ define "page" }}
2024-05-01 20:01:43 +02:00
{{ $version := .VERSION }}
2024-06-25 10:50:31 +02:00
{{ $theme := .CONFIG.THEME }}
2024-05-01 20:01:43 +02:00
<script type="module" defer>
import {UI} from "/js/{{ .VERSION }}/problems.mjs"
window._ui = new UI()
</script>
2024-06-25 08:59:07 +02:00
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/{{ .CONFIG.THEME }}/problems.css">
2024-05-01 20:01:43 +02:00
2024-07-04 13:37:06 +02:00
{{ block "page_label" . }}{{ end }}
2024-04-29 08:36:13 +02:00
2024-07-05 12:04:56 +02:00
<div style="margin-bottom: 16px; display: grid; grid-template-columns: min-content min-content; grid-gap: 32px;">
<div style="white-space: nowrap">
<b>Problem selection</b><br>
<input {{ if eq .Data.Selection "CURRENT" }}checked{{ end }} type="radio" name="selection" id="selection-current" onclick="_ui.selectCurrent()"> <label for="selection-current">Current</label>
<br>
<input {{ if eq .Data.Selection "ALL" }}checked{{ end }} type="radio" name="selection" id="selection-all" onclick="_ui.selectAll()"> <label for="selection-all">All</label>
</div>
<div style="white-space: nowrap">
<b>Show</b><br>
<input type="radio" name="display" id="display-table" onclick="_ui.displayAreas()"> <label for="display-table">Areas</label>
<br>
<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>
2024-05-28 12:56:35 +02:00
</div>
2024-07-04 13:37:06 +02:00
{{ block "timefilter" . }}{{ end }}
2024-05-28 12:56:35 +02:00
<div class="display-list hidden">
<div id="problems-list" class="table">
<div class="row"><h2>Unacknowledged</h2></div>
2024-05-28 12:56:35 +02:00
<div class="header">OK</div>
2024-05-28 12:56:35 +02:00
<div class="header">Trigger</div>
<div class="header">Area</div>
<div class="header">Section</div>
<div class="header">Since</div>
<div class="header">Until</div>
<div class="header"></div>
2024-05-28 12:56:35 +02:00
{{ range .Data.Problems }}
{{ if .Acknowledged }}
{{ continue }}
{{ end }}
<div class="line"></div>
{{/* NODATA datapoints */}}
2024-05-28 12:56:35 +02:00
{{ if eq .TriggerID -1 }}
<div class="{{ if .Acknowledged }}acked hidden{{ end }}">{{ if .IsArchived }}<img src="/images/{{ $version }}/{{ $theme }}/ok.svg">{{ else }}<img src="/images/{{ $version }}/{{ $theme }}/warning.svg">{{ end }}</div>
2024-05-28 12:56:35 +02:00
<div class="trigger">{{ .TriggerName }}</div>
<div class="area">{{ .AreaName }}</div>
<div class="section">{{ .SectionName }}</div>
<div class="start">{{ format_time .Start }}</div>
<div class="end"></div>
<div class="icons">
2024-07-04 08:54:03 +02:00
<img class="info" src="/images/{{ $version }}/{{ $theme }}/info-outline.svg">
<img class="acknowledge" src="/images/{{ $version }}/{{ $theme }}/acknowledge.svg">
2024-07-04 08:54:03 +02:00
</div>
2024-05-28 12:56:35 +02:00
{{ else }}
<div class="{{ if .Acknowledged }}acked hidden{{ end }}">{{ if .IsArchived }}<img src="/images/{{ $version }}/{{ $theme }}/ok.svg">{{ else }}<img src="/images/{{ $version }}/{{ $theme }}/warning.svg">{{ end }}</div>
2024-05-28 12:56:35 +02:00
<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="end">{{ if not .End.IsZero }}{{ format_time .End }}{{ else }}-{{ end }}</div>
<div class="icons">
2024-07-04 08:54:03 +02:00
{{ if .FormattedValues }}
<img class="info" src="/images/{{ $version }}/{{ $theme }}/info-filled.svg" title="{{ .FormattedValues }}">
{{ else }}
<img class="info" src="/images/{{ $version }}/{{ $theme }}/info-outline.svg">
{{ end }}
<img class="acknowledge" onclick="location.href = '/problem/acknowledge/{{ .ID }}'" src="/images/{{ $version }}/{{ $theme }}/acknowledge-filled.svg">
2024-07-04 08:54:03 +02:00
</div>
2024-05-28 12:56:35 +02:00
{{ end }}
2024-05-28 07:23:27 +02:00
{{ end }}
2024-05-28 12:56:35 +02:00
</div>
2024-05-28 07:23:27 +02:00
<div id="acknowledged-list" class="table hidden">
<div class="row"><h2>Acknowledged</h2></div>
<div class="header">OK</div>
2024-05-28 12:56:35 +02:00
<div class="header">Trigger</div>
<div class="header">Area</div>
<div class="header">Section</div>
<div class="header">Since</div>
<div class="header">Until</div>
<div class="header"></div>
2024-05-28 12:56:35 +02:00
{{ range .Data.Problems }}
{{ if not .Acknowledged }}
{{ continue }}
{{ end }}
<div class="line"></div>
<div class="{{ if .Acknowledged }}acked hidden{{ end }}">{{ if .IsArchived }}<img src="/images/{{ $version }}/{{ $theme }}/ok.svg">{{ else }}<img src="/images/{{ $version }}/{{ $theme }}/warning.svg">{{ end }}</div>
2024-05-28 07:23:27 +02:00
<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="end">{{ if not .End.IsZero }}{{ format_time .End }}{{ else }}-{{ end }}</div>
<div class="icons">
2024-07-04 15:14:24 +02:00
{{ if .FormattedValues }}
<img class="info" src="/images/{{ $version }}/{{ $theme }}/info-filled.svg" title="{{ .FormattedValues }}">
{{ else }}
<img class="info" src="/images/{{ $version }}/{{ $theme }}/info-outline.svg">
{{ end }}
<img class="acknowledge" onclick="location.href = '/problem/unacknowledge/{{ .ID }}'" src="/images/{{ $version }}/{{ $theme }}/acknowledge-outline.svg">
2024-07-04 08:54:03 +02:00
</div>
2024-05-28 07:23:27 +02:00
{{ end }}
2024-05-28 12:56:35 +02:00
</div>
2024-05-01 20:01:43 +02:00
</div>
2024-06-25 11:00:39 +02:00
<div class="display-areas hidden">
<div id="area-grouped">
2024-05-28 12:56:35 +02:00
{{ range $areaName, $sections := .Data.ProblemsGrouped }}
<div class="area table">
<div class="row"><h2>{{ $areaName }}</h2></div>
2024-05-28 12:56:35 +02:00
{{ range $sectionName, $problems := $sections }}
<div class="section row" style="margin-top: 16px; font-weight: bold;">{{ $sectionName }}</div>
<div class="header">OK</div>
<div class="header">Trigger</div>
<div class="header">Since</div>
<div class="header">Until</div>
<div class="header"></div>
<div class="line"></div>
2024-05-28 12:56:35 +02:00
{{ range $problems }}
<div class="{{ if .Acknowledged }}acked hidden{{ end }}">{{ if .IsArchived }}<img src="/images/{{ $version }}/{{ $theme }}/ok.svg">{{ else }}<img src="/images/{{ $version }}/{{ $theme }}/warning.svg">{{ end }}</div>
2024-07-04 08:54:03 +02:00
<div class="{{ if .Acknowledged }}acked hidden{{ end }} trigger">{{ .TriggerName }}</div>
2024-05-01 20:01:43 +02:00
<div class="{{ if .Acknowledged }}acked hidden{{ end }} since">{{ if not .Start.IsZero }}{{ format_time .Start }}{{ else }}-{{ end }}</div>
<div class="{{ if .Acknowledged }}acked hidden{{ end }} until">{{ if not .End.IsZero }}{{ format_time .End }}{{ else }}-{{ end }}</div>
2024-07-04 08:54:03 +02:00
{{ if .FormattedValues }}
<div class="{{ if .Acknowledged }}acked hidden{{ end }}"><img src="/images/{{ $version }}/{{ $theme }}/info-filled.svg" title="{{ .FormattedValues }}"></div>
{{ else }}
<div class="{{ if .Acknowledged }}acked hidden{{ end }}"><img src="/images/{{ $version }}/{{ $theme }}/info-outline.svg"></div>
{{ end }}
2024-07-04 08:54:03 +02:00
2024-05-28 12:56:35 +02:00
{{ end }}
{{ end }}
2024-04-29 08:36:13 +02:00
</div>
{{ end }}
</div>
</div>
2024-07-04 15:14:24 +02:00
<script type="text/javascript">
const form = document.getElementById('form-time-selector')
const inputSelection = document.createElement('input')
inputSelection.type = 'hidden'
inputSelection.name = 'selection'
inputSelection.value = '{{ if eq .Data.Selection "ALL" }}all{{ else }}current{{ end }}'
form.append(inputSelection)
</script>
2024-04-29 08:36:13 +02:00
{{ end }}