@@ -233,7 +233,17 @@ module openflow {
233233 options : any = {
234234 legend : { display : true }
235235 } ;
236- baseColors : string [ ] = [ '#F7464A' , '#97BBCD' , '#FDB45C' , '#46BFBD' , '#949FB1' , '#4D5360' ] ;
236+ // baseColors: string[] = ['#F7464A', '#97BBCD', '#FDB45C', '#46BFBD', '#949FB1', '#4D5360'];
237+ // baseColors: string[] = ['#803690', '#00ADF9', '#DCDCDC', '#46BFBD', '#FDB45C', '#949FB1', '#4D5360'];
238+ baseColors : [
239+ '#97BBCD' , // blue
240+ '#DCDCDC' , // light grey
241+ '#F7464A' , // red
242+ '#46BFBD' , // green
243+ '#FDB45C' , // yellow
244+ '#949FB1' , // grey
245+ '#4D5360' // dark grey
246+ ] ;
237247 colors : string [ ] = this . baseColors ;
238248 type : string = 'bar' ;
239249 heading : string = "" ;
@@ -243,7 +253,6 @@ module openflow {
243253 ids : any [ ] = [ ] ;
244254 charttype : string = "bar" ;
245255 click : any = null ;
246-
247256 }
248257 export declare function emit ( k , v ) ;
249258 export class ReportsCtrl extends entitiesCtrl < openflow . Base > {
@@ -301,6 +310,7 @@ module openflow {
301310 this . userdata . data . ReportsCtrl . run ( this . userdata . data . ReportsCtrl . points ) ;
302311 }
303312 async processData ( ) : Promise < void > {
313+ console . log ( 'processData' ) ;
304314 this . userdata . data . ReportsCtrl . run = this . processData . bind ( this ) ;
305315 this . userdata . data . ReportsCtrl . points = null ;
306316 this . loading = true ;
@@ -331,10 +341,19 @@ module openflow {
331341 if ( data . length > 0 ) onlinerobots = data [ 0 ] . _rpaheartbeat ;
332342
333343 chart = new chartset ( ) ;
334- chart . heading = "Robots seen the last " + this . timeframedesc ;
344+ chart . heading = "Online and offline robots, seen the last " + this . timeframedesc ;
335345 chart . labels = [ 'online' , 'offline' ] ;
336346 chart . data = [ onlinerobots , ( totalrobots - onlinerobots ) ] ;
337- chart . charttype = "doughnut" ;
347+ chart . charttype = "pie" ;
348+ chart . colors = [
349+ // '#98FB98', // very light green
350+ // '#F08080', // very light red
351+ // '#228B22', // green
352+ // '#B22222', // red
353+ '#006400' , // green
354+ '#8B0000' , // red
355+ ] ;
356+
338357 // chart.click = this.robotsclick.bind(this);
339358 chart . click = this . robotsclick . bind ( this ) ;
340359 this . charts . push ( chart ) ;
@@ -376,6 +395,7 @@ module openflow {
376395 if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
377396 }
378397 async robotsclick ( points , evt ) : Promise < void > {
398+ console . log ( 'robotsclick' ) ;
379399 this . userdata . data . ReportsCtrl . run = this . robotsclick . bind ( this ) ;
380400 this . userdata . data . ReportsCtrl . points = points ;
381401 if ( points . length > 0 ) {
@@ -397,9 +417,11 @@ module openflow {
397417 }
398418 this . charts = [ ] ;
399419 agg = [
400- { $match : { _type : 'user' } } ,
401- rpaheartbeat ,
402- {
420+ { $match : { _type : 'user' } }
421+ , { $sort : { "_rpaheartbeat" : - 1 } }
422+ , { "$limit" : 20 }
423+ , rpaheartbeat
424+ , {
403425 $lookup : {
404426 from : "audit" ,
405427 localField : "_id" ,
@@ -414,7 +436,9 @@ module openflow {
414436 "count" : { "$size" : "$audit" }
415437 }
416438 }
417- , { "$limit" : 20 }
439+ , { $sort : { "count" : - 1 } }
440+ // , { $sort: { "_rpaheartbeat": -1 } }
441+ // , { "$limit": 20 }
418442 ] ;
419443
420444 var data = await this . api . Aggregate ( "users" , agg ) ;
@@ -504,6 +528,7 @@ module openflow {
504528
505529 }
506530 async robotclick ( points , evt ) : Promise < void > {
531+ console . log ( 'robotclick' ) ;
507532 if ( points . length > 0 ) {
508533 } else { return ; }
509534 var userid = this . charts [ 0 ] . ids [ points [ 0 ] . _index ] ;
@@ -545,6 +570,7 @@ module openflow {
545570
546571 }
547572 async workflowclick ( points , evt ) : Promise < void > {
573+ console . log ( 'workflowclick' ) ;
548574 if ( points . length > 0 ) {
549575 } else { return ; }
550576
0 commit comments