@ -4,7 +4,7 @@ function getNode(name){
var nodeName = { }
var nodeName = { }
nodeName . name = name
nodeName . name = name
console . log ( 'nodename...' , nodeName . name )
console . log ( 'nodename...' , nodeName . name )
// dashboard.initChartist(nodeName)
dashboard . initChartist ( nodeName )
}
}
dashboard = {
dashboard = {
@ -22,17 +22,19 @@ dashboard = {
} ) ;
} ) ;
} ,
} ,
initChartist : function ( ) {
initChartist : function ( nodeName ) {
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'){
if ( typeof nodeName === 'undefined' ) {
// console.log("undefined nodename.........")
var node = data [ 'apps@michaels-MBP' ] ;
// } else {
console . log ( "undefined nodename........." )
// var node = data[nodeName.name]
} else {
// console.log('data.name..', data[name])
console . log ( 'this is nodeName...' , nodeName )
// }
console . log ( 'this is nodeName.name...' , nodeName . name )
var node = data [ 'apps@michaels-MBP' ] ;
var node = data [ nodeName . name ]
console . log ( 'data.name..' , data [ name ] )
}
var app = node [ 'chrome' ] ;
var app = node [ 'chrome' ] ;
var cpu = app [ 'cpu' ] ;
var cpu = app [ 'cpu' ] ;
var memory _used = app [ 'memory_used' ] ;
var memory _used = app [ 'memory_used' ] ;
@ -46,7 +48,7 @@ dashboard = {
// 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 , [ 1, 2 , 3 , 5 ] , ] // TODO: Check the order, the graph is by index not name.
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.
} ;
} ;
dataChartArray = dataChart . series
dataChartArray = dataChart . series