diff options
author | Ebus-at-dockstar <ebus@dockstar> | 2013-03-08 18:51:40 +0100 |
---|---|---|
committer | Ebus-at-dockstar <ebus@dockstar> | 2013-03-08 18:51:40 +0100 |
commit | 0a334345e9530dd217cf74a414afe43322181fe0 (patch) | |
tree | 1244615c403f8eecbf30432c8407911a136c7693 | |
parent | c3d899867b26192562d9e4797e09f73842df241d (diff) | |
download | ebus-alt-0a334345e9530dd217cf74a414afe43322181fe0.tar.gz ebus-alt-0a334345e9530dd217cf74a414afe43322181fe0.zip |
ui: root/diskfree sensors.
-rw-r--r-- | ebus/webhdf/static/css/stylesheet.css | 4 | ||||
-rw-r--r-- | ebus/webhdf/static/src/ebus.js | 59 |
2 files changed, 50 insertions, 13 deletions
diff --git a/ebus/webhdf/static/css/stylesheet.css b/ebus/webhdf/static/css/stylesheet.css index cfaa2fe..a3b876c 100644 --- a/ebus/webhdf/static/css/stylesheet.css +++ b/ebus/webhdf/static/css/stylesheet.css @@ -6,13 +6,13 @@ body { } #ebusgraph { - margin: auto; + margin: 5px auto; width: 90%; height: 70%; } #overview { - margin: 2% auto 0% auto; + margin: 1% auto 0% auto; width: 90%; height: 100px; } diff --git a/ebus/webhdf/static/src/ebus.js b/ebus/webhdf/static/src/ebus.js index 5c4fa16..5256288 100644 --- a/ebus/webhdf/static/src/ebus.js +++ b/ebus/webhdf/static/src/ebus.js @@ -19,15 +19,44 @@ $(document).ready(function(){ var plotOverview = null; var plotDetail = null; var indexFound = null; - var sensorConfigList = [{"sensorname":"heizkreisregler9.solarDaten.tempKollektor","show":true, "color":"#f30000"}, - {"sensorname":"heizkreisregler10.betriebsdatenRegler1.kesselTemperatur","show":true, "color":"#283074"}, - {"sensorname":"heizkreisregler9.solarDaten.tempWarmwasserSolar","show":false, "color":"#f0ff4c"}, - {"sensorname":"feuerungsautomat1.betriebsdatenRegler1.aussenTemperatur","show":false, "color":"#84b500"}, - // {"sensorname":"de.wettermichel.temperature","show":true, "color":"#24f590"}, - {"sensorname":"heizkreisregler10.betriebsdatenRegler1.boilerTemperatur","show":true, "color":"#48b4ff"}]; + var sensorConfigList = [ + {"sensorname":"heizkreisregler9.solarDaten.tempKollektor", + "description":"Kollektortemperatur", + "show":true, + "color":"#f30000"}, + {"sensorname":"heizkreisregler10.betriebsdatenRegler1.kesselTemperatur", + "description":"Kessel Temperatur", + "show":true, + "color":"#283074"}, + {"sensorname":"heizkreisregler9.solarDaten.tempWarmwasserSolar", + "description":"Warmwasser Solar", + "show":false, + "color":"#f0ff4c"}, + {"sensorname":"feuerungsautomat1.betriebsdatenRegler1.aussenTemperatur", + "description":"Aussentemperatur", + "show":false, + "color":"#84b500"}, + {"sensorname":"dockstar.load5", + "description":"System Load (5m, *10)", + "show":false, + "color":"blue", + "mapFunc":function(d){return [d[0],d[1]*10]}}, + {"sensorname":"dockstar.diskfree.rootfs", + "description":"Rootfs free percent", + "show":false, + "color":"red"}, + {"sensorname":"heizkreisregler10.betriebsdatenRegler1.boilerTemperatur", + "description":"Boilertemperatur", + "show":true, + "color":"#48b4ff"}, + {"sensorname":"feuerungsautomat1.betriebsdatenRegler1.kesselTemperatur", + "description":"Kesseltemperatur", + "show":false, + "color":"blue"} + ]; var pickSensorConfig = function(sensorname) { - var SensorConfigFound; + var sensorConfigFound; $.each(sensorConfigList, function(i,sensorConfig) { if (sensorConfig.sensorname == sensorname) { sensorConfigFound = sensorConfig; @@ -83,8 +112,12 @@ $(document).ready(function(){ response.data = response.data.map(function(d) { return [ tzFix(d[0]*1000), d[1] ]; }); + if (sensorConfig.mapFunc) { + response.data = response.data.map( sensorConfig.mapFunc ) + } datasetDetail.push({'data':response['data'], - 'label':sensorConfig.sensorname, + 'userData':sensorConfig.sensorname, + 'label':sensorConfig.description, 'color':sensorConfig.color}); replot(); } else { @@ -95,7 +128,7 @@ $(document).ready(function(){ var unplotSensorDetail = function(sensorname) { $.each(datasetDetail, function(i, sensor) { - if (sensor.label == sensorname) { + if (sensor.userData == sensorname) { datasetDetail.splice(i,1); replot(); return false; @@ -110,6 +143,9 @@ $(document).ready(function(){ response.data = response.data.map(function(d) { return [ tzFix(d[0]*1000), d[1] ]; }); + if (sensorConfig.mapFunc) { + response.data = response.data.map( sensorConfig.mapFunc) + } datasetOverview.push({'data':response['data'], 'label':sensorConfig.sensorname, 'color':sensorConfig.color}); @@ -144,7 +180,7 @@ $(document).ready(function(){ } sensors = []; for (elem in datasetOverview) { - sensor = datasetDetail[elem]["label"]; + sensor = datasetDetail[elem]["userData"]; sensors.push(sensor); } datasetDetail =[]; @@ -160,7 +196,7 @@ $(document).ready(function(){ var pickerCheckbox = $("<input>").attr("type","checkbox") .appendTo(pickerDiv); - $(pickerDiv).append(sensorConfig.sensorname); + pickerDiv.append($("<span>").text( sensorConfig.description + " (" + sensorConfig.sensorname + ")") ); if (sensorConfig.show) { //Plot plotSensor(sensorConfig); @@ -173,6 +209,7 @@ $(document).ready(function(){ $('.picker input').click( function() { var sensorname = $(this).parent().attr("id").replace("pick_","").replace(/_/g,"."); if ($(this).is(":checked")) { + console.log(sensorname); plotSensor(pickSensorConfig(sensorname)); } else { unplotSensor(sensorname); |