moved web resources to resource folder
This commit is contained in:
parent
bf799fa74d
commit
3904ef857d
50 changed files with 13 additions and 14 deletions
|
|
@ -1,339 +0,0 @@
|
|||
<h1 class="page-header">Sensor Configuration</h1>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default drop-shadow">
|
||||
<div class="panel-heading">Local Sensors</div>
|
||||
<div class="panel-body">
|
||||
<p>This is a local list of sensors connected to this node.</p>
|
||||
|
||||
<table class="table table-hover table-condensed">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Public</th>
|
||||
<th>Configuration</th>
|
||||
<th>
|
||||
<button class="btn btn-default btn-xs pull-right" data-toggle="modal"
|
||||
data-target="#sensorModal">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</button>
|
||||
</th>
|
||||
</thead>
|
||||
{{#localSensors}}
|
||||
<tr>
|
||||
<td>{{.getName()}}</td>
|
||||
<td>{{.getType()}}</td>
|
||||
<td>{{.isSynced()}}</td>
|
||||
<td>{{.getDeviceData()}}</td>
|
||||
<td>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="action" value="remove_local_sensor">
|
||||
<input type="hidden" name="id" value="{{.getId()}}">
|
||||
|
||||
<div class="btn-toolbar pull-right">
|
||||
<button type="button" class="btn btn-default btn-xs" data-toggle="modal"
|
||||
data-target="#sensorModal"
|
||||
data-id="{{.getId()}}"
|
||||
data-name="{{.getName()}}"
|
||||
data-type="{{.getType()}}"
|
||||
data-sync="{{.isSynced()}}"
|
||||
{{#.getDeviceConfig().getConfiguration()}}
|
||||
data-{{.getName()}}="{{.getString()}}"
|
||||
{{/.getDeviceConfig().getConfiguration()}}
|
||||
>
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
</button>
|
||||
|
||||
<button type="submit" class="btn btn-danger btn-xs">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{/localSensors}}
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<p>Sensors that has been automatically detected.</p>
|
||||
<table class="table table-hover table-condensed">
|
||||
<thead>
|
||||
<th>Type</th>
|
||||
<th>Date</th>
|
||||
<th>Configuration</th>
|
||||
</thead>
|
||||
{{#detectedSensors}}
|
||||
<tr>
|
||||
<td>{{.getType()}}</td>
|
||||
<td><span class="timestamp">{{.getDeviceData().getTimestamp()}}</span></td>
|
||||
<td>{{.getDeviceData()}}</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="{{.getType()}}"
|
||||
{{#.getDeviceConfig().getConfiguration()}}
|
||||
data-{{.getName()}}="{{.getString()}}"
|
||||
{{/.getDeviceConfig().getConfiguration()}}
|
||||
>
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{/detectedSensors}}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default drop-shadow">
|
||||
<div class="panel-heading">Power;Challenge External Users</div>
|
||||
<div class="panel-body">
|
||||
<p>Add or remove users that you want to synchronized data with.</p>
|
||||
|
||||
<table class="table table-hover table-condensed">
|
||||
<thead>
|
||||
<th>Username</th>
|
||||
<th>Address</th>
|
||||
<th>Hostname</th>
|
||||
<th>Port</th>
|
||||
<th>
|
||||
<button class="btn btn-default btn-xs pull-right" data-toggle="modal"
|
||||
data-target="#userModal">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</button>
|
||||
</th>
|
||||
</thead>
|
||||
{{#extUsers}}
|
||||
<tr>
|
||||
<td>{{.getUsername()}}</td>
|
||||
<td>{{.getAddress()}}</td>
|
||||
<td>{{.getHostname()}}</td>
|
||||
<td>{{.getPort()}}</td>
|
||||
<td>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="action" value="remove_external_user">
|
||||
<input type="hidden" name="id" value="{{.getId()}}">
|
||||
|
||||
<div class="btn-toolbar pull-right">
|
||||
<button type="button" class="btn btn-default btn-xs" data-toggle="modal"
|
||||
data-target="#userModal"
|
||||
data-id="{{.getId()}}"
|
||||
data-hostname="{{.getHostname()}}"
|
||||
data-port="{{.getPort()}}">
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
</button>
|
||||
|
||||
<button type="submit" class="btn btn-danger btn-xs">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{/extUsers}}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default drop-shadow">
|
||||
<div class="panel-heading">Power;Challenge External Sensors</div>
|
||||
<div class="panel-body">
|
||||
<p>This is a read only list of synchronized sensors from external users.</p>
|
||||
|
||||
<table class="table table-hover table-condensed">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Configuration</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
{{#extSensor}}
|
||||
<tr>
|
||||
<td>{{.getName()}}</td>
|
||||
<td>{{.getType()}}</td>
|
||||
<td>{{.getDeviceData()}}</td>
|
||||
<td>
|
||||
<form method="POST">
|
||||
<div class="btn-toolbar pull-right">
|
||||
<input type="hidden" name="action" value="modify_external_sensor">
|
||||
<input type="hidden" name="id" value="{{.getId()}}">
|
||||
{{^.isSynced()}}
|
||||
<input type="hidden" name="sync" value="true">
|
||||
<button type="submit" class="btn btn-default btn-xs" title="Start Syncing">
|
||||
<span class="glyphicon glyphicon-save"></span>
|
||||
</button>
|
||||
{{/.isSynced()}}
|
||||
{{#.isSynced()}}
|
||||
<input type="hidden" name="sync" value="false">
|
||||
<button type="submit" class="btn btn-danger btn-xs" title="Stop Syncing and Clear Data">
|
||||
<span class="glyphicon glyphicon-remove"></span>
|
||||
</button>
|
||||
{{/.isSynced()}}
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{/extSensor}}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!------------- MODALS --------------->
|
||||
<script>
|
||||
var sensorDataConf = {};
|
||||
|
||||
$(function(){
|
||||
// initialize sensor modal things
|
||||
$("#sensor-data-conf-template div").each(function(){
|
||||
sensorDataConf[$(this).attr("id")] = $(this).html();
|
||||
});
|
||||
$("#sensorModal select[name=type]").change(function(){
|
||||
// Update dynamic inputs
|
||||
$("#sensorModal #sensor-data-conf").html(sensorDataConf[$(this).val()]);
|
||||
});
|
||||
// click event
|
||||
$("#sensorModal").on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget);
|
||||
var modal = $(this);
|
||||
modal.find("input[type=text]").val(""); // Reset all inputs
|
||||
if(button.data("id") >= 0){ // edit
|
||||
modal.find("input[name=action]").val("modify_local_sensor");
|
||||
modal.find("input[name=sync]").prop("checked", button.data("sync"));
|
||||
}
|
||||
else{ // create
|
||||
modal.find("input[name=action]").val("create_local_sensor");
|
||||
modal.find("input[name=id]").val(-1);
|
||||
modal.find("input[name=sync]").prop("checked", "false");
|
||||
}
|
||||
// set dynamic form data
|
||||
modal.find("select[name=type]").val(button.data("type"));
|
||||
modal.find("select[name=type]").change(); // Update dynamic inputs
|
||||
$.each(button.attr(), function(name, value) {
|
||||
if(name.startsWith("data-")) {
|
||||
name = name.substring(5);
|
||||
console.log(name, value);
|
||||
modal.find("input[name="+name+"]").val(value);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("#userModal").on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget);
|
||||
var modal = $(this);
|
||||
modal.find("input[type=text]").val(""); // Reset all inputs
|
||||
if(button.data("id") >= 0){ // edit
|
||||
modal.find("input[name=action]").val("modify_external_user");
|
||||
modal.find("input[name=id]").val(button.data("id"));
|
||||
modal.find("input[name=hostname]").val(button.data("hostname"));
|
||||
modal.find("input[name=port]").val(button.data("port"));
|
||||
}
|
||||
else{ // create
|
||||
modal.find("input[name=action]").val("create_external_user");
|
||||
modal.find("input[name=id]").val(-1);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<div class="modal fade" id="sensorModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="exampleModalLabel">Sensor</h4>
|
||||
</div>
|
||||
<form method="POST">
|
||||
<div class="modal-body">
|
||||
<input type="hidden" id="action" name="action" value="">
|
||||
<input type="hidden" id="id" name="id">
|
||||
<div class="form-group">
|
||||
<label class="control-label">Name:</label>
|
||||
<input type="text" class="form-control" name="name">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">Type:</label>
|
||||
<select class="form-control" name="type">
|
||||
{{#availableSensors}}
|
||||
<option>{{.getName()}}</option>
|
||||
{{/availableSensors}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="sync" value="true">
|
||||
Public
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
<hr>
|
||||
<div id="sensor-data-conf">
|
||||
<!-- Dynamic form -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="reset" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="sensor-data-conf-template" class="hidden">
|
||||
{{#localSensorConf}}
|
||||
<div id="{{.clazz.getName()}}">
|
||||
{{#.params}}
|
||||
<div class="form-group">
|
||||
<label class="control-label">{{.getNiceName()}}:</label>
|
||||
<input type="text" class="form-control" name="{{.getName()}}">
|
||||
</div>
|
||||
{{/.params}}
|
||||
</div>
|
||||
{{/localSensorConf}}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="userModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title">External User</h4>
|
||||
</div>
|
||||
<form method="POST">
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="action" value="">
|
||||
<input type="hidden" name="id">
|
||||
<div class="form-group">
|
||||
<label class="control-label">Hostname/IP:</label>
|
||||
<input type="text" class="form-control" name="hostname">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">Port:</label>
|
||||
<input type="number" class="form-control" name="port" min="1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="reset" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue