2024-04-29 08:36:13 +02:00
|
|
|
{{ define "page" }}
|
|
|
|
<script type="module" defer>
|
|
|
|
import {UI, Trigger} from "/js/{{ .VERSION }}/trigger_edit.mjs"
|
|
|
|
|
2024-05-04 22:07:41 +02:00
|
|
|
window._ui = new UI({{ .VERSION }})
|
2024-04-29 08:36:13 +02:00
|
|
|
let trigger = new Trigger(
|
|
|
|
{{ .Data.Trigger.ID }},
|
|
|
|
'{{ .Data.Trigger.Name }}',
|
2024-05-01 10:02:33 +02:00
|
|
|
{{ .Data.Datapoints }},
|
2024-04-29 08:36:13 +02:00
|
|
|
)
|
|
|
|
_ui.setTrigger(trigger)
|
2024-05-01 10:02:33 +02:00
|
|
|
_ui.render()
|
2024-04-29 08:36:13 +02:00
|
|
|
</script>
|
2024-06-25 08:59:07 +02:00
|
|
|
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/{{ .CONFIG.THEME }}/trigger_edit.css">
|
2024-04-29 08:36:13 +02:00
|
|
|
|
|
|
|
{{ block "page_label" . }}{{end}}
|
|
|
|
|
2024-05-01 10:02:33 +02:00
|
|
|
<dialog id="dlg-datapoints">
|
|
|
|
<input list="list-datapoints" id="datapoint">
|
|
|
|
<datalist id="list-datapoints"></datalist>
|
|
|
|
<button onclick="_ui.chooseDatapoint()">OK</button>
|
|
|
|
</dialog>
|
|
|
|
|
2024-04-30 08:04:16 +02:00
|
|
|
<form id="form-trigger" action="/trigger/update/{{ .Data.Trigger.ID }}" method="post">
|
2024-05-01 10:02:33 +02:00
|
|
|
<input type="hidden" name="sectionID" value="{{ .Data.Trigger.SectionID }}">
|
|
|
|
<div id="widgets" class="widgets">
|
|
|
|
<div class="label">Name</div>
|
|
|
|
<div><input type="text" name="name" value="{{ .Data.Trigger.Name }}"></div>
|
|
|
|
|
|
|
|
<div class="label">Datapoints</div>
|
|
|
|
<div class="datapoints" style="margin-top: 4px">
|
2024-05-04 22:07:41 +02:00
|
|
|
<div style="grid-column: 1 / -1"><a onclick="_ui.addDatapoint()">Add</a></div>
|
2024-05-01 10:02:33 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="label">Expression</div>
|
|
|
|
<div><textarea id="expr" name="expression" rows=8>{{ .Data.Trigger.Expression }}</textarea></div>
|
|
|
|
|
|
|
|
<div></div>
|
|
|
|
<div class="action">
|
|
|
|
<button id="button-update" onclick="_ui.update(); return false">{{ if eq .Data.Trigger.ID 0 }}Create{{ else }}Update{{ end }}</button>
|
|
|
|
<button id="button-run" onclick="window._ui.run(); return false">Test</button>
|
|
|
|
<div id="run-result"></div>
|
|
|
|
</div>
|
2024-04-29 08:36:13 +02:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
{{ end }}
|