|
@@ -13,7 +13,8 @@
|
13
|
13
|
// Text Strings. Change these to translate.
|
14
|
14
|
textAvailableSensors = "Available Sensors";
|
15
|
15
|
textButtonNext = "Continue";
|
16
|
|
-homeTabName = "Home";
|
|
16
|
+backTabName = '<span class="glyphicon glyphicon-step-backward" aria-hidden="true"></span>';
|
|
17
|
+homeTabName = '<span class="glyphicon glyphicon-home" aria-hidden="true"></span>';
|
17
|
18
|
sensorTabName = "Sensor";
|
18
|
19
|
errorMessage = "Couldn't read sensor with IP: ";
|
19
|
20
|
errorTitle = "Error: ";
|
|
@@ -86,6 +87,8 @@ function initialView() {
|
86
|
87
|
$('#listSensorsHeading').html(textAvailableSensors + " (0/" + clients.length + ")");
|
87
|
88
|
|
88
|
89
|
// Iterate all given client IPs and get their data using Websocket
|
|
90
|
+ $('#listSensors').empty();
|
|
91
|
+ arrSensor = Array();
|
89
|
92
|
var count = [0];
|
90
|
93
|
jQuery.each(clients, function(index, client) {
|
91
|
94
|
webSocket(client, "2391", count, clients.length);
|
|
@@ -144,17 +147,26 @@ function generateView(arrSensor, animation) {
|
144
|
147
|
$('#dataDiv').show();
|
145
|
148
|
|
146
|
149
|
// Add home tab
|
147
|
|
- $('.nav-pills').empty();
|
148
|
|
- $('.nav-pills').append('<li class="active"><a id="homebut" class="navtab" data-toggle="tab" href="#home">' + homeTabName + '</a></li>');
|
149
|
|
-
|
150
|
|
- // Add tabs for all sensors
|
151
|
|
- jQuery.each(arrSensor, function(index, sensor) {
|
152
|
|
- $('.nav-pills').append('<li><a id="sensbut" class="navtab" data-toggle="tab" href="#' + sensor.id + '">' + sensorTabName + ' ' + sensor.id + '</a></li>');
|
153
|
|
- });
|
|
150
|
+ $('#navbar').empty();
|
|
151
|
+ $('#navbar').append('<li><a id="backbut" class="navtab" data-toggle="tab" href="#start" aria-label="start page">' + backTabName + '</a></li>');
|
|
152
|
+ $('#navbar').append('<li class="active"><a id="homebut" class="navtab" data-toggle="tab" href="#home">' + homeTabName + '</a></li>');
|
|
153
|
+
|
|
154
|
+ if (arrSensor.length > 1) {
|
|
155
|
+ // Add tabs for all sensors
|
|
156
|
+ jQuery.each(arrSensor, function(index, sensor) {
|
|
157
|
+ $('#navbar').append('<li><a id="sensbut" class="navtab" data-toggle="tab" href="#' + sensor.id + '">' + sensorTabName + ' ' + sensor.id + '</a></li>');
|
|
158
|
+ });
|
|
159
|
+ }
|
154
|
160
|
|
155
|
161
|
// flag for combined plot -> true
|
156
|
162
|
generateGraph(true, arrSensor, animation);
|
157
|
163
|
|
|
164
|
+ // Handler for "back" button, returning to first page
|
|
165
|
+ $("#backbut").click(function(event) {
|
|
166
|
+ currentState = "initial";
|
|
167
|
+ redraw();
|
|
168
|
+ });
|
|
169
|
+
|
158
|
170
|
// Handler for "Home" button, drawing combined graph
|
159
|
171
|
$("#homebut").click(function(event) {
|
160
|
172
|
// flag for combined plot -> true
|
|
@@ -162,11 +174,13 @@ function generateView(arrSensor, animation) {
|
162
|
174
|
currentState = "main";
|
163
|
175
|
});
|
164
|
176
|
|
165
|
|
- // Handler for single sensor buttons
|
166
|
|
- $("#sensbut").click(function(event) {
|
167
|
|
- generateGraph(false, arrSensor[(event.target.text.split(" ")[1] - 1)], true);
|
168
|
|
- currentState = event.target.text.split(" ")[1];
|
169
|
|
- });
|
|
177
|
+ if (arrSensor.length > 1) {
|
|
178
|
+ // Handler for single sensor buttons
|
|
179
|
+ $("#sensbut").click(function(event) {
|
|
180
|
+ generateGraph(false, arrSensor[(event.target.text.split(" ")[1] - 1)], true);
|
|
181
|
+ currentState = event.target.text.split(" ")[1];
|
|
182
|
+ });
|
|
183
|
+ }
|
170
|
184
|
}
|
171
|
185
|
|
172
|
186
|
function generateGraph(flag, sensor, anim) {
|