|
|
@ -1,12 +1,5 @@
|
|
|
|
type = ['','info','success','warning','danger'];
|
|
|
|
type = ['','info','success','warning','danger'];
|
|
|
|
|
|
|
|
|
|
|
|
function getNode(name){
|
|
|
|
|
|
|
|
var nodeName = {}
|
|
|
|
|
|
|
|
nodeName.name = name
|
|
|
|
|
|
|
|
console.log('nodename...', nodeName.name)
|
|
|
|
|
|
|
|
dashboard.initChartist(nodeName)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dashboard = {
|
|
|
|
dashboard = {
|
|
|
|
initPickColor: function(){
|
|
|
|
initPickColor: function(){
|
|
|
|
$('.pick-class-label').click(function(){
|
|
|
|
$('.pick-class-label').click(function(){
|
|
|
@ -22,33 +15,16 @@ dashboard = {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
initChartist: function(nodeName){
|
|
|
|
initChartist: function(){
|
|
|
|
var getData = $.get('/1/app/usage/trend');
|
|
|
|
var getData = $.get('/1/app/usage/trend');
|
|
|
|
getData.done(function(results) {
|
|
|
|
getData.done(function(results) {
|
|
|
|
var data = JSON.parse(results)
|
|
|
|
var data = JSON.parse(results)
|
|
|
|
if (typeof nodeName === 'undefined'){
|
|
|
|
|
|
|
|
var node = data['apps@michaels-MBP'];
|
|
|
|
|
|
|
|
console.log("undefined nodename.........")
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
console.log('this is nodeName...', nodeName)
|
|
|
|
|
|
|
|
console.log('this is nodeName.name...', nodeName.name)
|
|
|
|
|
|
|
|
var node = data[nodeName.name]
|
|
|
|
|
|
|
|
console.log('data.name..', data[name])
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var app = node['chrome'];
|
|
|
|
|
|
|
|
var cpu = app['cpu'];
|
|
|
|
|
|
|
|
var memory_used = app['memory_used'];
|
|
|
|
|
|
|
|
console.log('data...',data)
|
|
|
|
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
|
|
|
|
// monitoring apps chart
|
|
|
|
var dataChart = {
|
|
|
|
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' ],
|
|
|
|
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, [0,0.1,0.3,0.2,0.4,0.6,0.2], ] // TODO: Check the order, the graph is by index not name.
|
|
|
|
series: [[1,2,3], [4,5,6], [1,2,3,5], ] // TODO: Check the order, the graph is by index not name.
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
dataChartArray = dataChart.series
|
|
|
|
dataChartArray = dataChart.series
|
|
|
@ -86,7 +62,7 @@ dashboard = {
|
|
|
|
// cpu and memory --------------------------
|
|
|
|
// cpu and memory --------------------------
|
|
|
|
var data = {
|
|
|
|
var data = {
|
|
|
|
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
|
|
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
|
|
series: [cpu, memory_used]
|
|
|
|
series: [[1,2,3,4], [5,6,7]]
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -111,18 +87,18 @@ dashboard = {
|
|
|
|
|
|
|
|
|
|
|
|
Chartist.Line('#chartActivity', data, options, responsiveOptions);
|
|
|
|
Chartist.Line('#chartActivity', data, options, responsiveOptions);
|
|
|
|
|
|
|
|
|
|
|
|
var getStatus = $.get('1/get/summary/app_status');
|
|
|
|
// var getStatus = $.get('1/get/summary/app_status');
|
|
|
|
getStatus.done(function(results) {
|
|
|
|
// getStatus.done(function(results) {
|
|
|
|
var data = JSON.parse(results)
|
|
|
|
// var data = JSON.parse(results)
|
|
|
|
let getStatusList = []
|
|
|
|
// let getStatusList = []
|
|
|
|
getStatusList.push(data.idle)
|
|
|
|
// getStatusList.push(data.idle)
|
|
|
|
getStatusList.push(data.crash)
|
|
|
|
// getStatusList.push(data.crash)
|
|
|
|
getStatusList.push(data.running)
|
|
|
|
// getStatusList.push(data.running)
|
|
|
|
Chartist.Pie('#chartPreferences', {
|
|
|
|
// Chartist.Pie('#chartPreferences', {
|
|
|
|
labels: getStatusList,
|
|
|
|
// labels: getStatusList,
|
|
|
|
series: getStatusList
|
|
|
|
// series: getStatusList
|
|
|
|
},{donut:true});
|
|
|
|
// },{donut:true});
|
|
|
|
}) /// end getStatus
|
|
|
|
// }) /// end getStatus
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// End chartist function
|
|
|
|
// End chartist function
|
|
|
|