From 591dd5f48ffd23740fb6b85b62d65d241a83e988 Mon Sep 17 00:00:00 2001 From: michael mead Date: Mon, 7 Aug 2017 13:58:27 -0500 Subject: [PATCH 1/3] get graphs back up --- src/api/static/js/dashboard.js | 18 +++++++++++++----- src/api/templates/dashboard.html | 6 +++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/api/static/js/dashboard.js b/src/api/static/js/dashboard.js index b6b6fd5..d23c91c 100755 --- a/src/api/static/js/dashboard.js +++ b/src/api/static/js/dashboard.js @@ -20,19 +20,27 @@ dashboard = { getData.done(function(results) { var data = JSON.parse(results) - var app = data['Chrome']; + var node = data['apps@michaels-MBP']; + var app = node['chrome']; + var cpu = app['cpu']; + var memory_used = app['memory_used']; console.log('data...',data) + console.log('node...',node) + console.log('app...',app) + console.log('cpu...',cpu) + console.log('memory_used...', memory_used) + // monitoring apps chart var dataChart = { - labels: ['9:00AM', '12:00AM', '3:00PM', '6:00PM', '9:00PM', '12:00PM', '3:00AM', '6:00AM'], - series: [app.memory_used, app.cpu, ] // TODO: Check the order, the graph is by index not name. + labels: ['24','23','22','21','20','19','18','17','16','15','14','13','12','11','10','9','8','7','6','5','4','3','2','1' ], + series: [cpu, memory_used, [1,2,3,50], ] // TODO: Check the order, the graph is by index not name. }; var optionsChart = { lineSmooth: false, low: 0, - high: 100, + high: 10, showArea: true, height: "245px", axisX: { @@ -60,7 +68,7 @@ dashboard = { // cpu and memory -------------------------- var data = { labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - series: [app.cpu, app.memory_used] + series: [cpu, memory_used] }; diff --git a/src/api/templates/dashboard.html b/src/api/templates/dashboard.html index a24d6c3..904e291 100644 --- a/src/api/templates/dashboard.html +++ b/src/api/templates/dashboard.html @@ -79,7 +79,7 @@ ] jx.utils.patterns.observer(lobservers,"init") - //dashboard.initChartist(); + dashboard.initChartist(); }); @@ -303,8 +303,8 @@
cpu usage - memory usage - memory available + memory used + available line

From 5b0274c9a20598bb4ec9c7476fb49cd659e4c208 Mon Sep 17 00:00:00 2001 From: michael mead Date: Mon, 7 Aug 2017 14:35:19 -0500 Subject: [PATCH 2/3] make monitoring apps graph height responsive to highest percentage of array --- src/api/static/js/dashboard.js | 8 ++++++-- src/api/templates/dashboard.html | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/api/static/js/dashboard.js b/src/api/static/js/dashboard.js index d23c91c..a3338d1 100755 --- a/src/api/static/js/dashboard.js +++ b/src/api/static/js/dashboard.js @@ -34,13 +34,17 @@ dashboard = { // monitoring apps chart var dataChart = { labels: ['24','23','22','21','20','19','18','17','16','15','14','13','12','11','10','9','8','7','6','5','4','3','2','1' ], - series: [cpu, memory_used, [1,2,3,50], ] // TODO: Check the order, the graph is by index not name. + series: [cpu, memory_used, [1,2,3,5], ] // TODO: Check the order, the graph is by index not name. }; + dataChartArray = dataChart.series + var maxlist = dataChartArray.map(dataChartArray => Math.max.apply(null, dataChartArray)); + maxNum = Math.max.apply(null, maxlist) + var optionsChart = { lineSmooth: false, low: 0, - high: 10, + high: maxNum + 1, showArea: true, height: "245px", axisX: { diff --git a/src/api/templates/dashboard.html b/src/api/templates/dashboard.html index 904e291..02edef5 100644 --- a/src/api/templates/dashboard.html +++ b/src/api/templates/dashboard.html @@ -301,7 +301,6 @@