73 lines
2.3 KiB
Go Template
73 lines
2.3 KiB
Go Template
{{ define "page" }}
|
|
{{ $version := .VERSION }}
|
|
{{ $graph := and (eq .Data.Display "graph") (eq .Data.Datapoint.Datatype "INT") }}
|
|
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/{{ .CONFIG.THEME }}/datapoints.css">
|
|
<script src="/js/{{ .VERSION }}/datapoint_values.js"></script>
|
|
<script src="/js/{{ .VERSION }}/lib/plotly-2.32.0.min.js" charset="utf-8"></script>
|
|
|
|
{{ block "page_label" . }}{{end}}
|
|
|
|
<form action="/datapoint/values/{{ .Data.Datapoint.ID }}" method="get" style="margin-top: -16px">
|
|
<input type="hidden" name="offset-time" id="offset-time" value=0>
|
|
|
|
{{ if eq .Data.Datapoint.Datatype "INT" }}
|
|
<div>
|
|
<input name="display" value="graph" type="radio" id="display-graph" {{ if $graph }} checked {{ end}}> <label for="display-graph">Graph</label>
|
|
<input name="display" value="list" type="radio" id="display-list" {{ if not $graph }} checked {{ end }}> <label for="display-list">List</label>
|
|
</div>
|
|
{{ end }}
|
|
|
|
<div class="value-selector">
|
|
<div>Values from</div>
|
|
<div>Values to</div>
|
|
|
|
<input name="f" type="datetime-local" step="1" value="{{ .Data.TimeFrom }}">
|
|
<input name="t" type="datetime-local" step="1" value="{{ .Data.TimeTo }}">
|
|
|
|
<div class="time-offset">
|
|
<div><a href="#" onclick="offsetTime(-3600)">◀</a></div>
|
|
<div>Hour</div>
|
|
<div><a href="#" onclick="offsetTime(3600)">▶</a></div>
|
|
|
|
<div><a href="#" onclick="offsetTime(-86400)">◀</a></div>
|
|
<div>Day</div>
|
|
<div><a href="#" onclick="offsetTime(86400)">▶</a></div>
|
|
|
|
<div><a href="#" onclick="offsetTime(-604800)">◀</a></div>
|
|
<div>Week</div>
|
|
<div><a href="#" onclick="offsetTime(604800)">▶</a></div>
|
|
</div>
|
|
<button>OK</button>
|
|
</div>
|
|
|
|
</form>
|
|
|
|
{{ if $graph }}
|
|
<div class="graph">
|
|
<div id="graph-values"></div>
|
|
</div>
|
|
|
|
<div style="margin-top: 8px;">
|
|
<b>Number of values:</b>
|
|
<span id="num-values">{{ len .Data.Values }}</span>
|
|
</div>
|
|
<script type="text/javascript">
|
|
new Graph(
|
|
{{ .Data.Datapoint.ID }},
|
|
{{ .Data.Values }},
|
|
)
|
|
|
|
</script>
|
|
{{ else }}
|
|
<div id="values">
|
|
<div class="header">Value added</div>
|
|
<div class="header">Value</div>
|
|
<div class="line"></div>
|
|
{{ range .Data.Values }}
|
|
<div class="value">{{ format_time .Ts }}</div>
|
|
<div class="value">{{ .Value }}</div>
|
|
{{ end }}
|
|
</div>
|
|
{{ end }}
|
|
{{ end }}
|