Detected sensors will be shown on the web

Former-commit-id: 6c942025a7ad2c8567ae4db97194ba9fef1a6611
This commit is contained in:
Ziver Koc 2016-01-10 03:43:38 +01:00
parent 26810e9b2c
commit 1ab72ffbc3
2 changed files with 30 additions and 4 deletions

View file

@ -120,8 +120,9 @@ public class PCConfigureHttpPage extends HalHttpPage {
// Output
Templator tmpl = new Templator(FileUtil.find("web-resource/configure.tmpl"));
tmpl.set("user", localUser);
tmpl.set("localSensor", Sensor.getLocalSensors(db));
tmpl.set("localSensors", Sensor.getLocalSensors(db));
tmpl.set("localSensorConf", sensorConfigurations);
tmpl.set("detectedSensors", ControllerManager.getInstance().getDetectedSensors());
tmpl.set("extUsers", User.getExternalUsers(db));
tmpl.set("extSensor", Sensor.getExternalSensors(db));

View file

@ -47,7 +47,7 @@
</button>
</th>
</thead>
{{#localSensor}}
{{#localSensors}}
<tr>
<td>{{.name}}</td>
<td>{{.type}}</td>
@ -76,7 +76,32 @@
</form>
</td>
</tr>
{{/localSensor}}
{{/localSensors}}
</table>
<br>
<p>Sensors that has been automatically detected.</p>
<table class="table table-hover table-condensed">
<thead>
<th>Type</th>
<th>Configuration</th>
</thead>
{{#detectedSensors}}
<tr>
<td>{{.getClass().getName()}}</td>
<td>{{.}}</td>
<td>
<div class="btn-toolbar pull-right">
<button type="button" class="btn btn-default btn-xs" data-toggle="modal"
data-target="#sensorModal"
data-type="{{.type}}"
data-config="{{.config}}">
<span class="glyphicon glyphicon-plus"></span>
</button>
</div>
</td>
</tr>
{{/detectedSensors}}
</table>
</div>
</div>
@ -193,7 +218,7 @@
// Update dynamic inputs
$("#sensorModal #sensor-data-conf").html(sensorDataConf[$(this).val()]);
});
// event
// click event
$("#sensorModal").on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
var modal = $(this);