Implemented basic functions
This commit is contained in:
parent
89f483171a
commit
965e2daeb3
22 changed files with 711 additions and 58 deletions
|
|
@ -2,6 +2,7 @@
|
|||
<div id="menu">
|
||||
<a href="/"><img src="/images/{{ .VERSION }}/logo{{ if eq .MENU "index" }}_selected{{ end }}.svg"></a>
|
||||
<a href="/problems"><img src="/images/{{ .VERSION }}/problems{{ if eq .MENU "problems" }}_selected{{ end }}.svg"></a>
|
||||
<a href="/datapoints"><img src="/images/{{ .VERSION }}/datapoints{{ if eq .MENU "datapoints" }}_selected{{ end }}.svg"></a>
|
||||
<a href="/triggers"><img src="/images/{{ .VERSION }}/triggers{{ if eq .MENU "triggers" }}_selected{{ end }}.svg"></a>
|
||||
<a href="/configuration"><img src="/images/{{ .VERSION }}/configuration{{ if eq .MENU "configuration" }}_selected{{ end }}.svg"></a>
|
||||
</div>
|
||||
|
|
|
|||
35
views/pages/datapoint_edit.gotmpl
Normal file
35
views/pages/datapoint_edit.gotmpl
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{{ define "page" }}
|
||||
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/datapoints.css">
|
||||
|
||||
<script type="module" defer>
|
||||
import {UI} from "/js/{{ .VERSION }}/datapoint_edit.mjs"
|
||||
window._ui = new UI()
|
||||
</script>
|
||||
|
||||
{{ block "page_label" . }}{{end}}
|
||||
|
||||
<form id="form-trigger" action="/datapoint/update/{{ .Data.Datapoint.ID }}" method="post">
|
||||
<div id="widgets" class="widgets">
|
||||
<div class="label">Name</div>
|
||||
<div><input type="text" name="name" value="{{ .Data.Datapoint.Name }}"></div>
|
||||
|
||||
<div class="label">Datatype</div>
|
||||
<div>
|
||||
<select name="datatype">
|
||||
<option {{ if eq .Data.Datapoint.Datatype "INT" }}selected{{end}}>INT</option>
|
||||
<option {{ if eq .Data.Datapoint.Datatype "STRING" }}selected{{end}}>STRING</option>
|
||||
<option {{ if eq .Data.Datapoint.Datatype "DATETIME" }}selected{{end}}>DATETIME</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div></div>
|
||||
<div class="action">
|
||||
{{ if eq .Data.Datapoint.ID 0 }}
|
||||
<button id="button-update">Create</button>
|
||||
{{ else }}
|
||||
<button id="button-update">Update</button>
|
||||
{{ end }}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{{ end }}
|
||||
26
views/pages/datapoints.gotmpl
Normal file
26
views/pages/datapoints.gotmpl
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{{ define "page" }}
|
||||
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/datapoints.css">
|
||||
|
||||
{{ block "page_label" . }}{{end}}
|
||||
|
||||
<a href="/datapoint/edit/0">Create</a>
|
||||
|
||||
<div id="datapoints">
|
||||
<div class="header">Name</div>
|
||||
<div class="header">Datatype</div>
|
||||
<div class="header">Last value</div>
|
||||
<div class="header">Value</div>
|
||||
|
||||
{{ range .Data.Datapoints }}
|
||||
<div class="name"><a href="/datapoint/edit/{{ .ID }}">{{ .Name }}</a></div>
|
||||
<div class="datatype">{{ .Datatype }}</div>
|
||||
<div class="last-value">{{ format_time .LastValue }}</div>
|
||||
{{ if eq .Datatype "DATETIME" }}
|
||||
<div class="value">{{ if .LastDatapointValue.ValueDateTime.Valid }}{{ format_time .LastDatapointValue.Value }}{{ end }}</div>
|
||||
{{ else }}
|
||||
<div class="value">{{ .LastDatapointValue.Value }}</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{ end }}
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
{{ block "page_label" . }}{{end}}
|
||||
|
||||
<form action="/trigger/update/{{ .Data.Trigger.ID }}" method="post">
|
||||
<form id="form-trigger" action="/trigger/update/{{ .Data.Trigger.ID }}" method="post">
|
||||
<div id="widgets" class="widgets">
|
||||
<div class="label">Name</div>
|
||||
<div><input type="text" name="name" value="{{ .Data.Trigger.Name }}"></div>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<div class="label">Datapoints</div>
|
||||
<div class="datapoints" style="margin-top: 4px">
|
||||
{{ range .Data.Datapoints }}
|
||||
<div class="datapoint name">{{ .Name }}</div>
|
||||
<div class="datapoint name"><b>{{ .Name }}</b></div>
|
||||
<div class="datapoint value">{{ .LastDatapointValue.Value }}</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
<div></div>
|
||||
<div class="action">
|
||||
<button>Update</button>
|
||||
<button id="button-update">Update</button>
|
||||
<button id="button-run" onclick="window._ui.run(); return false">Test</button>
|
||||
<div id="run-result"></div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue