Added Sensor overview page. issue 7

Former-commit-id: 60dec1d1a95f568404371ecd3c2cc38bc8a4a355
This commit is contained in:
Ziver Koc 2016-01-22 17:32:26 +01:00
parent e269faec13
commit 113bbdbfb8
7 changed files with 181 additions and 30 deletions

View file

@ -15,6 +15,10 @@
<th class="text-right">Type:</th>
<td>{{event.getDeviceData().getClass().getSimpleName()}}</td>
</tr>
<tr>
<th class="text-right">Owner:</th>
<td>{{event.getUser().getUsername()}}</td>
</tr>
</table>
</div>
</div>

50
web-resource/sensor_detail.tmpl Executable file
View file

@ -0,0 +1,50 @@
<h1 class="page-header">Details for <a href="#">{{sensor.getName()}}</a></h1>
<div class="col-md-5">
<div class="panel panel-default drop-shadow">
<div class="panel-heading">Configuration</div>
<div class="panel-body">
<table class="table table-hover table-condensed">
<thead>
<tr>
<th class="text-right">Name:</th>
<td>{{sensor.getName()}}</td>
</tr>
</thead>
<tr>
<th class="text-right">Type:</th>
<td>{{sensor.getDeviceData().getClass().getSimpleName()}}</td>
</tr>
<tr>
<th class="text-right">Public:</th>
<td>{{sensor.isSynced()}}</td>
</tr>
<tr>
<th class="text-right">Owner:</th>
<td>{{sensor.getUser().getUsername()}}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-md-7">
<div class="panel panel-default drop-shadow">
<div class="panel-heading">History data</div>
<div class="panel-body">
<table class="table table-hover table-condensed">
<thead>
<th class="col-md-6">Timestamp</th>
<th class="col-md-2">Data</th>
</thead>
{{#history}}
<tr>
<td>{{.timestamp}}</a></td>
<td>{{.data}}</td>
</tr>
{{/history}}
</table>
</div>
</div>
</div>

View file

@ -0,0 +1,34 @@
<h1 class="page-header">Sensor Overview</h1>
<div class="col-md-12">
<div class="panel panel-default drop-shadow">
<div class="panel-heading">Local Sensors</div>
<div class="panel-body">
<table class="table table-hover table-condensed">
<thead>
<th class="col-md-4">Name</th>
<th class="col-md-3">Type</th>
<th class="col-md-2">Data</th>
<th class="col-md-2">Last Update</th>
</thead>
{{#sensors}}
<tr>
<td><a href="?id={{.getId()}}">{{.getName()}}</a></td>
<td>{{.getDeviceData().getClass().getSimpleName()}}</td>
<td>{{.getDeviceData().getData()}}</td>
<td>1 min ago</td>
</tr>
{{/sensors}}
</table>
</div>
</div>
</div>
<script>
$(function (){
$(".toggle-switch").on("switchChange.bootstrapSwitch", function (event, state) {
$(this).closest('form').submit();
});
});
</script>