/
index.html
79 lines (78 loc) · 2.06 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<html>
<head>
<title>App</title>
<link rel="stylesheet" href="/static/style.css?v={{.Seed}}" />
</head>
<body>
<script
type="text/javascript"
src="/static/form.js?v={{.Seed}}">
</script>
<header>
<h1>App</h1>
<hr/>
</header>
<div id="messages"></div>
<div id="content">
<h2>Devices</h2>
<table class="devices">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Definition</th>
<th>Enabled</th>
</tr>
</thead>
<tbody>
{{range $ent := .Devices.Devices }}
<tr>
<td>{{ $ent.Name }}</td>
<td>{{ $ent.Type }}</td>
<td>{{ $ent.Def }}</td>
<td>
<input class="enableDisable"
type="checkbox"
x-device="{{$ent.Name}}"
{{ if $ent.Enabled }}checked{{end}} />
</td>
</tr>
{{end}}
</tbody>
</table>
<h2>Create</h2>
<form>
<label for="name">Name: </label>
<input type="text" value="udin_device" />
<label for="open">Open: </label>
<select id="open" name="open">
{{ range $relay := .Devices.Relays }}
<option value="{{$relay}}">{{$relay}}</option>
{{ end }}
</select>
<label for="close">Close: </label>
<select id="close" name="close">
{{ range $relay := .Devices.Relays }}
<option value="{{$relay}}">{{$relay}}</option>
{{ end }}
</select>
<br/>
<label for="type">Type: </label>
<select id="type" name="type">
{{ range $i, $type := .Devices.Types }}
<option value="{{$i}}">{{$type}}</option>
{{ end }}
</select>
<br/>
<input type="button" class="createRelay" value="Create" />
</form>
</div>
<footer>
<hr/>
<div>App v{{ .Version }}</div>
</footer>
<script type="text/javascript">
load();
</script>
</body>
</html>