Deletion of notification services.

This commit is contained in:
Magnus Åhall 2024-06-28 17:18:08 +02:00
parent c7ad2aa1b6
commit a736ae60af
10 changed files with 74 additions and 9 deletions

View file

@ -68,6 +68,11 @@
const nType = select.value
location.href = `/configuration/notification?type=${nType}`
}
function deleteNotification(prio) {
if (!confirm(`Are you sure you want to delete notification with prio ${prio}?`))
return
location.href = `/configuration/notification/delete/${prio}`;
}
</script>
{{ block "page_label" . }}{{end}}
@ -126,11 +131,13 @@
<div class="header">Prio</div>
<div class="header">Type</div>
<div class="header">Target</div>
<div></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>
<div><img onclick="deleteNotification({{ .GetPrio }})" class="delete" src="/images/{{ $version }}/{{ $theme }}/delete.svg"></div>
{{ end }}
</div>

View file

@ -19,8 +19,8 @@ button {
}
</style>
<form action="/configuration/notification/update/{{ .Data.Service.GetPrio }}" method="post">
<input type="hidden" name="type" value="Script">
<form action="/configuration/notification/update/{{ if .Data.Service.Exists }}{{ .Data.Service.GetPrio }}{{ else }}-1{{ end }}" 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 }}">