@ -109,14 +109,14 @@ monitor.processes.trend.init = function (label,app) {
} )
} )
}
}
monitor . processes . trend . render = function ( logs , key , label ) {
monitor . processes . trend . render = function ( logs , key , label ) {
if ( key == null ) {
// if (key == null) {
key = 'memory_usage'
// key = 'memory_usage'
}
// }
if ( logs == null || label == null ) {
// if (logs == null || label == null){
logs = jx . dom . get . instance ( 'trend_info' ) . logs
// logs = jx.dom.get.instance('trend_info').logs
label = jx . dom . get . value ( 'trend_info' ) ;
// label= jx.dom.get.value('trend_info') ;
}
// }
var frame = $ ( '#trends_chart' )
var frame = $ ( '#trends_chart' )
jx . dom . set . value ( 'trends_chart' , '' )
jx . dom . set . value ( 'trends_chart' , '' )
var context = jx . dom . get . instance ( 'CANVAS' )
var context = jx . dom . get . instance ( 'CANVAS' )
@ -127,7 +127,7 @@ monitor.processes.trend.render = function (logs, key,label) {
conf . data = { }
conf . data = { }
conf . options = { legend : { position : 'bottom' } }
conf . options = { legend : { position : 'bottom' } }
conf . options . scales = { }
conf . options . scales = { }
conf . options . scales . yAxes = [ { scaleLabel : { display : true , labelString : key . replace ( /_/ , ' ' ) . toUpperCase ( ) } , ticks : { min : 0 , beginAtZero : true } , gridLines : { display : false } } ]
conf . options . scales . yAxes = [ { scaleLabel : { display : true , labelString : 'CPU & MEMORY USAGE' } , ticks : { min : 0 , beginAtZero : true } , gridLines : { display : false } } ]
conf . options . scales . xAxes = [
conf . options . scales . xAxes = [
{
{
@ -144,33 +144,28 @@ monitor.processes.trend.render = function (logs, key,label) {
conf . data . datasets = [ ]
conf . data . datasets = [ ]
var x _axis = [ ]
var x _axis = [ ]
var _x = { }
var _x = { }
var _y = { }
// var _y = {}
var values = jx . utils . patterns . visitor ( logs , function ( item ) {
var cpu = { label : 'CPU Usage (%)' , data : [ ] , backgroundColor : 'transparent' , borderColor : COLORS [ 187 ] , fill : false , borderWidth : 1 }
var mem = { label : 'Memory Usage(%)' , data : [ ] , backgroundColor : 'transparent' , borderColor : COLORS [ 32 ] , fill : false , borderWidth : 1 }
jx . utils . patterns . visitor ( logs , function ( item ) {
x = new Date ( item . year , item . month - 1 , item . day , item . hour , item . minute )
x = new Date ( item . year , item . month - 1 , item . day , item . hour , item . minute )
y = item [ key ]
y = item [ key ]
if ( _x [ x ] == null || ( _x [ x ] == null && _y [ y ] == null ) ) {
if ( _x [ x ] == null ) { //||(_x[x] == null && _y[y] == null)) {
_x [ x ] = 1
_x [ x ] = 1
_y [ y ] = 1
// _y[y] = 1
x _axis . push ( x )
x _axis . push ( x )
cpu . data . push ( { x : x , y : item . cpu _usage } )
mem . data . push ( { x : x , y : item . memory _usage } )
// return {x:x,y:y}
return { x : x , y : y }
} else {
return null
}
}
} )
} )
var serie = { label : label , data : values }
i = parseInt ( Math . random ( ) * ( COLORS . length - 1 ) )
serie . backgroundColor = 'transparent'
serie . borderColor = COLORS [ 2 ]
serie . borderWidth = 1
serie . type = 'line'
conf . data . datasets . push ( serie )
x _axis = jx . utils . unique ( x _axis )
conf . data . datasets = [ cpu , mem ]
x _axis = jx . utils . unique ( x _axis )
conf . data . labels = x _axis
conf . data . labels = x _axis
// console.log(conf)
// console.log(conf)
jx . dom . append ( 'trends_chart' , context )
jx . dom . append ( 'trends_chart' , context )
@ -282,19 +277,19 @@ monitor.sandbox.init = function () {
} )
} )
}
}
monitor . sandbox . render = function ( logs ) {
monitor . sandbox . render = function ( logs ) {
months = { 1 : 'Jan' , 2 : 'Feb' , 3 : 'Mar' , 4 : 'Apr' , 5 : 'May' , 6 : 'Jun' , 7 : 'Jul' , 8 : 'Aug' , 9 : 'Sep' , 10 : 'Oct' , 11 : 'Nov' , 12 : 'Dec' }
months = { 1 : 'Jan' , 2 : 'Feb' , 3 : 'Mar' , 4 : 'Apr' , 5 : 'May' , 6 : 'Jun' , 7 : 'Jul' , 8 : 'Aug' , 9 : 'Sep' , 10 : 'Oct' , 11 : 'Nov' , 12 : 'Dec' }
var d = ( [ logs [ 0 ] . day , '-' , months [ logs [ 0 ] . month ] , '-' , logs [ 0 ] . year , ' ' , logs [ 0 ] . hour , ':' , logs [ 0 ] . minute ] ) . join ( '' )
var d = ( [ logs [ 0 ] . day , '-' , months [ logs [ 0 ] . month ] , '-' , logs [ 0 ] . year , ' ' , logs [ 0 ] . hour , ':' , logs [ 0 ] . minute ] ) . join ( '' )
jx . dom . set . value ( 'sandbox_date' , d )
jx . dom . set . value ( 'sandbox_date' , d )
var options = { width : $ ( '#sandbox_status' ) . width ( ) , height : 'auto' }
var options = { width : $ ( '#sandbox_status' ) . width ( ) , height : 'auto' }
options . data = logs
options . data = logs
options . paging = true
options . paging = true
options . pageSize = 4
options . pageSize = 4
options . pageIndex = 1
options . pageIndex = 1
options . pageButtonCount = 4
options . pageButtonCount = 4
options . pagerContainer = '# latest_process _pager'
options . pagerContainer = '# sandbox _pager'
options . pagerFormat = "{prev} Page {pageIndex} of {pageCount} {next}"
options . pagerFormat = "{prev} Page {pageIndex} of {pageCount} {next}"
options . pagePrevText = '<i class="fa fa-chevron-left"></i>'
options . pagePrevText = '<i class="fa fa-chevron-left"></i>'
options . pageNextText = "<i class='fa fa-chevron-right small' title='Next'> </i>" ;
options . pageNextText = "<i class='fa fa-chevron-right small' title='Next'> </i>" ;
options . rowClass = function ( item ) {
options . rowClass = function ( item ) {
@ -306,7 +301,22 @@ monitor.sandbox.render = function (logs) {
return 'good'
return 'good'
}
}
}
}
options . rowClick = function ( args ) {
var item = args . item ;
if ( item . missing . length > 0 ) {
var form = jx . dom . get . instance ( 'FORM' )
var dom = jx . dom . get . instance ( 'INPUT' )
dom . type = 'hidden'
dom . name = 'missing'
dom . value = JSON . stringify ( item . missing )
form . action = '/download'
form . method = 'POST'
form . appendChild ( dom )
form . submit ( )
}
}
options . fields = [
options . fields = [
{ name : 'label' , title : 'Virtual Environment Label' , type : 'text' , css : 'small' , headercss : 'small bold' } ,
{ name : 'label' , title : 'Virtual Environment Label' , type : 'text' , css : 'small' , headercss : 'small bold' } ,
{ name : 'value' , title : 'Completeness %' , type : 'number' , css : 'small' , headercss : 'small bold' }
{ name : 'value' , title : 'Completeness %' , type : 'number' , css : 'small' , headercss : 'small bold' }