@@ -12,7 +12,7 @@ import cola from 'cytoscape-cola';
1212import cyCanvas from 'cytoscape-canvas' ;
1313
1414import layoutOptions from './layout_options' ;
15- import { DataMapping , IGraph , IGraphNode , IGraphEdge , CyData , PanelSettings , CurrentData , QueryResponse , TableContent , IGraphMetrics } from './types' ;
15+ import { DataMapping , IGraph , IGraphNode , IGraphEdge , CyData , PanelSettings , CurrentData , QueryResponse , TableContent , IGraphMetrics , ISelectionStatistics } from './types' ;
1616
1717import dummyGraph from './dummy_graph' ;
1818
@@ -101,6 +101,8 @@ export class ServiceDependencyGraphCtrl extends MetricsPanelCtrl {
101101
102102 currentType : string ;
103103
104+ selectionStatistics : ISelectionStatistics ;
105+
104106 /** @ngInject */
105107 constructor ( $scope , $injector ) {
106108 super ( $scope , $injector ) ;
@@ -312,12 +314,24 @@ export class ServiceDependencyGraphCtrl extends MetricsPanelCtrl {
312314 const currentNode : NodeSingular = selection [ 0 ] ;
313315 this . selectionId = currentNode . id ( ) ;
314316 this . currentType = currentNode . data ( 'type' ) ;
315- console . log ( this . currentType ) ;
316- console . log ( currentNode . data ( 'type' ) ) ;
317317 const receiving : TableContent [ ] = [ ] ;
318318 const sending : TableContent [ ] = [ ] ;
319319 const edges : EdgeCollection = selection . connectedEdges ( ) ;
320320
321+ const metrics = selection . nodes ( ) [ 0 ] . data ( 'metrics' ) ;
322+
323+ this . selectionStatistics = { } ;
324+
325+ if ( metrics . rate != undefined ) {
326+ this . selectionStatistics . requests = Math . floor ( metrics . rate ) ;
327+ }
328+ if ( metrics . error_rate != undefined ) {
329+ this . selectionStatistics . errors = Math . floor ( metrics . error_rate ) ;
330+ }
331+ if ( metrics . response_time != undefined ) {
332+ this . selectionStatistics . responseTime = Math . floor ( metrics . response_time ) ;
333+ }
334+
321335 for ( let i = 0 ; i < edges . length ; i ++ ) {
322336
323337 const actualEdge : EdgeSingular = edges [ i ] ;
@@ -362,17 +376,15 @@ export class ServiceDependencyGraphCtrl extends MetricsPanelCtrl {
362376
363377 this . generateDrillDownLink ( ) ;
364378 }
365-
366379 }
367380
368381 onMount ( ) {
369- console . log ( "mount" ) ;
382+ // console.log("mount");
370383 this . render ( ) ;
371384 }
372385
373386 onRender ( payload ) {
374- console . log ( "render" ) ;
375-
387+ // console.log("render");
376388
377389 if ( ! this . cy ) {
378390 this . _initCytoscape ( ) ;
0 commit comments