summaryrefslogtreecommitdiff
path: root/src/viz/index.js
diff options
context:
space:
mode:
authorBernhard Tittelbach <bernhard@tittelbach.org>2014-10-23 06:12:58 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-10-23 11:56:53 +0200
commit66e8752b890076a6d95fa40f0de677cf685f48e3 (patch)
tree6c968fc0c53ca486da0f7cd31c26825760f439b4 /src/viz/index.js
parentvisualisation 1 (diff)
value del button
Diffstat (limited to 'src/viz/index.js')
-rw-r--r--src/viz/index.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/viz/index.js b/src/viz/index.js
index e282026..2485912 100644
--- a/src/viz/index.js
+++ b/src/viz/index.js
@@ -2,6 +2,7 @@ var qintv_ms = 5000;
var uripart = "/updates?";
var lastfrom = "";
var stuff_to_display = {"clients":"none","*":showvalue,"client-count":showvalue, "bytes-sent":showgauge, "fuckups-per-second":showasgraph};
+var sidseen = [];
$(document).ready(function()
@@ -20,11 +21,16 @@ function getstreamdiv(sid) {
return elem;
}
+function killvalue(name) {
+ stuff_to_display[name]="none";
+ $.each(sidseen,function(index,sid){ $("#li-"+sid+"_"+name).remove() });
+}
+
function showvalue(sid, name, value, jsdate) {
var divid = sid+"_"+name;
var elem = $("#"+divid);
if (elem.length<1) {
- getstreamdiv(sid).append('<li class="dispvalue size1"><div class="dispvalueheader">'+ name +'</div><div class="dispvaluevalue" id='+divid+'></div></li>');
+ getstreamdiv(sid).append('<li class="dispvalue size1" id="li-'+divid+'""><div class="dispvalueheader">'+ name +'</div><input type="button" class="dispvalueheaderafter" value="X" onClick="killvalue(\''+name+'\');"></input><div class="dispvaluevalue" id='+divid+'></div></li>');
elem = $("#"+divid);
}
elem.html("<strong>"+value+"</strong><br/><span style='font-size:smaller;'>@"+jsdate.toLocaleDateString()+" "+jsdate.toLocaleTimeString()+"</span>");
@@ -35,7 +41,7 @@ function showgauge(sid, name, value) {
var divid = sid+"_"+name;
var elem = document.getElementById(divid);
if (!elem) {
- getstreamdiv(sid).append('<li class="dispvalue quadsize"><div class="dispvalueheader">'+ name +'</div><div class="dispvaluevalue" id='+divid+'></div></li>');
+ getstreamdiv(sid).append('<li class="dispvalue quadsize" id="li-'+divid+'""><div class="dispvalueheader">'+ name +'</div><input type="button" class="dispvalueheaderafter" value="X" onClick="killvalue(\''+name+'\');"></input><div class="dispvaluevalue" id='+divid+'></div></li>');
elem = document.getElementById(divid);
gauges[divid] = new google.visualization.Gauge(elem);
}
@@ -49,7 +55,7 @@ function showasgraph(sid, name, value, jsdate) {
var divid = sid+"_"+name;
var elem = document.getElementById(divid);
if (!elem) {
- getstreamdiv(sid).append('<li class="dispvalue graphsize"><div class="dispvalueheader">'+ name +'</div><div class="dispvaluevalue" id='+divid+'></div></li>');
+ getstreamdiv(sid).append('<li class="dispvalue graphsize" id="li-'+divid+'""><div class="dispvalueheader">'+ name +'</div><input type="button" class="dispvalueheaderafter" value="X" onClick="killvalue(\''+name+'\');"></input><div class="dispvaluevalue" id='+divid+'></div></li>');
elem = document.getElementById(divid);
graphdata[divid]=[];
graphs[divid] = new Dygraph(elem,graphdata[divid],{legend:'none',title:sid+"-"+name,labels:["Date/Time",name]});
@@ -59,8 +65,10 @@ function showasgraph(sid, name, value, jsdate) {
}
function graphS5Status(data) {
+ sidseen=[];
$.each(data, function(index, stream) {
var sid = stream["streamer-id"].format + '-' + stream["streamer-id"].quality;
+ sidseen.push(sid);
lastfrom = "from="+stream["start-time"];
var jsdate = new Date(stream["start-time"]);
qintv_ms = stream["duration-ms"]; //doesnt really change anything yet