Add/edit notifications
This commit is contained in:
parent
1ede36b8aa
commit
c7ad2aa1b6
19 changed files with 531 additions and 11 deletions
|
|
@ -62,6 +62,12 @@
|
|||
return
|
||||
location.href = `/section/delete/${id}`
|
||||
}
|
||||
|
||||
function newNotification() {
|
||||
const select = document.getElementById('notification-create-type')
|
||||
const nType = select.value
|
||||
location.href = `/configuration/notification?type=${nType}`
|
||||
}
|
||||
</script>
|
||||
|
||||
{{ block "page_label" . }}{{end}}
|
||||
|
|
@ -108,4 +114,24 @@
|
|||
<button style="margin-left: 8px;">Update</button>
|
||||
</form>
|
||||
|
||||
<h1>Notifications</h1>
|
||||
<select id="notification-create-type">
|
||||
{{ range .Data.AvailableServices }}
|
||||
<option>{{ .GetType }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
<button onclick="newNotification()">Create</button>
|
||||
|
||||
<div id="services">
|
||||
<div class="header">Prio</div>
|
||||
<div class="header">Type</div>
|
||||
<div class="header">Target</div>
|
||||
<div class="line"></div>
|
||||
{{ range .Data.NotificationServices }}
|
||||
<div><a href="/configuration/notification?prio={{ .GetPrio }}">{{ .GetPrio }}</a></div>
|
||||
<div><a href="/configuration/notification?prio={{ .GetPrio }}">{{ .GetType }}</a></div>
|
||||
<div><a href="/configuration/notification?prio={{ .GetPrio }}">{{ .String }}</a></div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{ end }}
|
||||
|
|
|
|||
34
views/pages/notification/ntfy.gotmpl
Normal file
34
views/pages/notification/ntfy.gotmpl
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{{ define "page" }}
|
||||
<h1>NTFY</h1>
|
||||
<style>
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: min-content 1fr;
|
||||
grid-gap: 8px 16px;
|
||||
align-items: center;
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
input[type=number] {
|
||||
width: 64px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
button {
|
||||
margin-top: 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<form action="/configuration/notification/update/{{ if .Data.Service.Exists }}{{ .Data.Service.GetPrio }}{{ else }}-1{{ end }}" method="post">
|
||||
<input type="hidden" name="type" value="NTFY">
|
||||
<div class="grid">
|
||||
<div>Prio:</div>
|
||||
<input type="number" min=0 name="prio" value="{{ .Data.Service.GetPrio }}">
|
||||
|
||||
<div>URL:</div>
|
||||
<input type="text" name="url" value="{{ .Data.Service.URL }}" style="width: 100%">
|
||||
|
||||
<button style="grid-column: 1 / -1; width: min-content;">OK</button>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
34
views/pages/notification/script.gotmpl
Normal file
34
views/pages/notification/script.gotmpl
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{{ define "page" }}
|
||||
<h1>Script</h1>
|
||||
<style>
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: min-content 1fr;
|
||||
grid-gap: 8px 16px;
|
||||
align-items: center;
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
input[type=number] {
|
||||
width: 64px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
button {
|
||||
margin-top: 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<form action="/configuration/notification/update/{{ .Data.Service.GetPrio }}" method="post">
|
||||
<input type="hidden" name="type" value="Script">
|
||||
<div class="grid">
|
||||
<div>Prio:</div>
|
||||
<input type="number" min=0 name="prio" value="{{ .Data.Service.GetPrio }}">
|
||||
|
||||
<div>Filename:</div>
|
||||
<input type="text" name="filename" value="{{ .Data.Service.Filename }}" style="width: 100%">
|
||||
|
||||
<button style="grid-column: 1 / -1; width: min-content;">OK</button>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue