yeah done
This commit is contained in:
parent
b6c6b5ce0f
commit
77858bc9ad
4
app.js
4
app.js
|
@ -10,10 +10,10 @@ var cosmStreams = [53146, 34606, 43573];
|
|||
|
||||
var cosmFeeds = {53146 : ["GearboxRPM", "Windspeed", "Pitch"],
|
||||
34606 : ["CCChannel1,Import1", "CCSensor1,Servers2", "CCSensor2,Office3"],
|
||||
43573 : ["Humidity0", "Air pressure2", "Thermo3"]};
|
||||
43573 : ["Humidity1", "Air pressure2", "Thermo3"]};
|
||||
|
||||
var cosmClient = new cosm(cosmStreams, 'orKBBdLAKuKJU-RxqmZpZB6q0baSAKxBTVhKdjhUNkdyVT0g');
|
||||
var oscClient = new osc('chaosc', 7110);
|
||||
var oscClient = new osc('localhost', 7110);
|
||||
|
||||
function logErrors(err, req, res, next) {
|
||||
console.error(err.stack);
|
||||
|
|
|
@ -9,7 +9,7 @@ block content
|
|||
div.row
|
||||
for nr in streams
|
||||
div.cell
|
||||
div(id=nr, class="kasten")
|
||||
div(id="stream-#{nr}", class="kasten")
|
||||
h3 --
|
||||
table
|
||||
tr
|
||||
|
@ -31,7 +31,7 @@ block content
|
|||
td(class="break")
|
||||
td(class="break")
|
||||
|
||||
div.mapbox(id="map#{nr}") --
|
||||
div.mapbox(id="map-#{nr}") --
|
||||
|
||||
script(type="text/javascript")
|
||||
//var streams;
|
||||
|
@ -68,48 +68,47 @@ block content
|
|||
|
||||
socket.on('gotstream', function(data) {
|
||||
console.log("gotstream " + data.id);
|
||||
$("div#" + data.id + " h3").text(data.title);
|
||||
$("div#" + data.id + " td.location").text(data.location);
|
||||
$("div#" + data.id + " td.latitude").text(data.lat);
|
||||
$("div#" + data.id + " td.longitude").text(data.lon);
|
||||
$("div#stream-" + data.id + " h3").text(data.title);
|
||||
$("div#stream-" + data.id + " td.location").text(data.location);
|
||||
$("div#stream-" + data.id + " td.latitude").text(data.lat);
|
||||
$("div#stream-" + data.id + " td.longitude").text(data.lon);
|
||||
var now = new Date();
|
||||
$("div#" + data.id + " td.update").text(now);
|
||||
loadMap($('div#map' + data.id)[0], data.lat, data.lon);
|
||||
$("div#stream-" + data.id + " td.update").text(now);
|
||||
loadMap($('div#map-' + data.id)[0], data.lat, data.lon);
|
||||
});
|
||||
|
||||
function add_data(data) {
|
||||
console.log("add_data");
|
||||
console.log("update_data");
|
||||
console.dir(data);
|
||||
var row = $('tr#' + data.feed).html();
|
||||
console.log('searching for "#feed-' + data.feed + '"')
|
||||
var row = $('#stream-' + data.stream + '-feed-' + data.feed).html();
|
||||
if (row === undefined) {
|
||||
var tmp = '<tr id="' + data.feed + '"class="value"><td>' + data.displayname + '</td><td class="value">' + data.value + "</td></tr>";
|
||||
var tmp = '<tr id="stream-' + data.stream + '-feed-' + data.feed + '" class="value"><td>' + data.displayname + '</td><td class="value">' + data.value + "</td></tr>";
|
||||
console.log("new tmp: " + tmp);
|
||||
$("div#" + data.stream + " table > tbody").append(tmp);
|
||||
$("#stream-" + data.stream + " table > tbody").append(tmp);
|
||||
}
|
||||
};
|
||||
|
||||
function update_data(data) {
|
||||
console.log("update_data");
|
||||
console.dir(data);
|
||||
var row = $('tr#' + data.feed).html();
|
||||
console.log('searching for "#feed-' + data.feed + '"')
|
||||
var row = $('#stream-' + data.stream + '-feed-' + data.feed).html();
|
||||
if (row === undefined) {
|
||||
var tmp = '<tr id="' + data.feed + '" class="value"><td>' + data.displayname + '</td><td class="value">' + data.value + "</td></tr>";
|
||||
var tmp = '<tr id="stream-' + data.stream + '-feed-' + data.feed + '" class="value"><td>' + data.displayname + '</td><td class="value">' + data.value + "</td></tr>";
|
||||
console.log("new tmp: " + tmp);
|
||||
$("div#" + data.stream + " table > tbody").append(tmp);
|
||||
$("#stream-" + data.stream + " table > tbody").append(tmp);
|
||||
}
|
||||
else {
|
||||
$("body").effect("highlight", {times:2}, 2000);
|
||||
var t = 'div#' + data.stream + ' table > tbody tr#' + data.feed;
|
||||
var t = '#stream-' + data.stream + '-feed-' + data.feed;
|
||||
var tmp = "<td>" + data.displayname + '</td><td class="value">' + data.value + "</td>";
|
||||
console.log("existing tmp: " + tmp);
|
||||
console.log("update: " + tmp);
|
||||
$(t).html(tmp);
|
||||
var f = $("tr#" + data.feed + " .value");
|
||||
console.dir(f);
|
||||
var f = $('#stream-' + data.stream + '-feed-' + data.feed + ' .value');
|
||||
f.effect("pulsate", { times:3 }, 2000);
|
||||
}
|
||||
};
|
||||
|
||||
socket.on('changedvalue', update_data);
|
||||
|
||||
socket.on('updatevalue', add_data);
|
||||
|
||||
|
|
Loading…
Reference in New Issue