From 1315d1408abce2de7f6452463a3ab4b267cedb1e Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Sat, 25 Oct 2014 16:56:32 +0200 Subject: drop gauge, fix from time --- src/viz/index.html | 4 ---- src/viz/index.js | 26 ++++++++++++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) (limited to 'src/viz') diff --git a/src/viz/index.html b/src/viz/index.html index fd3b3db..978b8d8 100644 --- a/src/viz/index.html +++ b/src/viz/index.html @@ -4,10 +4,6 @@ Sfive Stats - - diff --git a/src/viz/index.js b/src/viz/index.js index 31b6880..3a2b136 100644 --- a/src/viz/index.js +++ b/src/viz/index.js @@ -1,11 +1,20 @@ var qintv_ms = 5000; var uripart = "/updates?"; //var lastfrom = ""; -var lastfrom = "from="+(new Date(Date.now() - 600000)).toISOString(); -var possible_display_functions = {"Off":"none", "Value":showvalue, "Gauge":showgauge, "Graph":showasgraph}; +//var lastfrom = "from="+(new Date(Date.now() - 10*60*1000)).toISOString(); +var lastfrom="from=2013-10-24T06:30:45Z&to=2013-10-24T06:32:45"; +console.log(lastfrom); +//var possible_display_functions = {"Off":"none", "Value":showvalue, "Gauge":showgauge, "Graph":showasgraph}; +var possible_display_functions = {"Off":"none", "Value":showvalue, "Graph":showasgraph}; var stuff_to_display = {"clients":"none","*":showvalue,"client-count":showasgraph, "bytes-sent":showasgraph, "fuckups-per-second":showasgraph}; var sidseen = []; +toQueryIsoData = function(dateStr) { + ts = new Date(dateStr) + ts.setTime(ts.getTime() + 1 * 1000) // add a second, lowest resolution step for s5 + return ts.toISOString(); +} + $(document).ready(function() { @@ -96,20 +105,24 @@ function changeSetting(name, selobj) { function graphS5Status(data) { sidseen=[]; - $.each(data, function(index, stream) { + $.each(data.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"]); + var jsdate1s = new Date(jsdate.getTime() + 1000); + lastfrom = "from="+jsdate1s.toISOString(); qintv_ms = stream["duration-ms"]; //doesnt really change anything yet jsdate = new Date(jsdate.getTime() + qintv_ms); var data = stream.data; + //console.log(data); + //console.log(graphdata); for (var key in data) { + if (! stuff_to_display[key]) { + stuff_to_display[key]=stuff_to_display['*']; + } showasetting(key); if (typeof(stuff_to_display[key]) == 'function') { stuff_to_display[key](sid, key, data[key], jsdate); - } else if (! stuff_to_display[key]) { - stuff_to_display['*'](sid, key, data[key], jsdate); } } }); @@ -117,6 +130,7 @@ function graphS5Status(data) { function updateS5Stats() { var uri = uripart + lastfrom; + console.log(uri); //$.getJSON(uri, "", function(data){alert(data);}); $.ajax({ dataType: "json", -- cgit v1.2.3