@@ -11483,12 +11483,12 @@ if (!m.pod) return null;
11483
11483
var b = m . options . selectedContainer ;
11484
11484
switch ( a ) {
11485
11485
case "memory/usage" :
11486
- var c = D ( b ) ;
11486
+ var c = E ( b ) ;
11487
11487
if ( c ) return h . bytesToMiB ( l ( c ) ) ;
11488
11488
break ;
11489
11489
11490
11490
case "cpu/usage_rate" :
11491
- var d = E ( b ) ;
11491
+ var d = F ( b ) ;
11492
11492
if ( d ) return l ( d ) ;
11493
11493
}
11494
11494
return null ;
@@ -11504,8 +11504,8 @@ Used:b.available > 0 ? "#0088ce" :"#ec7a08",
11504
11504
Available :"#d1d1d1"
11505
11505
}
11506
11506
} ;
11507
- B [ b . id ] ? B [ b . id ] . load ( e ) :( c = I ( a ) , c . data = e , d ( function ( ) {
11508
- G || ( B [ b . id ] = c3 . generate ( c ) ) ;
11507
+ C [ b . id ] ? C [ b . id ] . load ( e ) :( c = J ( a ) , c . data = e , d ( function ( ) {
11508
+ H || ( C [ b . id ] = c3 . generate ( c ) ) ;
11509
11509
} ) ) ;
11510
11510
}
11511
11511
}
@@ -11519,10 +11519,10 @@ _.each(a.datasets, function(a) {
11519
11519
c [ a . id ] = a . data ;
11520
11520
} ) ;
11521
11521
var e , f = i . getSparklineData ( c ) , g = a . chartPrefix + "sparkline" ;
11522
- C [ g ] ? C [ g ] . load ( f ) :( e = J ( a ) , e . data = f , a . chartDataColors && ( e . color = {
11522
+ D [ g ] ? D [ g ] . load ( f ) :( e = K ( a ) , e . data = f , a . chartDataColors && ( e . color = {
11523
11523
pattern :a . chartDataColors
11524
11524
} ) , d ( function ( ) {
11525
- G || ( C [ g ] = c3 . generate ( e ) ) ;
11525
+ H || ( D [ g ] = c3 . generate ( e ) ) ;
11526
11526
} ) ) ;
11527
11527
}
11528
11528
}
@@ -11533,7 +11533,7 @@ function r() {
11533
11533
return 60 * m . options . timeRange . value * 1e3 ;
11534
11534
}
11535
11535
function s ( ) {
11536
- return Math . floor ( r ( ) / F ) + "ms" ;
11536
+ return Math . floor ( r ( ) / G ) + "ms" ;
11537
11537
}
11538
11538
function t ( a , b , c ) {
11539
11539
var d , e = {
@@ -11548,17 +11548,17 @@ containerName:a.containerMetric ? m.options.selectedContainer.name :"pod"
11548
11548
} ) :null ;
11549
11549
}
11550
11550
function u ( ) {
11551
- K = 0 , _ . each ( m . metrics , function ( a ) {
11551
+ L = 0 , _ . each ( m . metrics , function ( a ) {
11552
11552
p ( a ) , o ( a ) ;
11553
11553
} ) ;
11554
11554
}
11555
11555
function v ( a ) {
11556
- if ( ! G ) {
11557
- if ( K ++ , m . noData ) return void ( m . metricsError = {
11556
+ if ( ! H ) {
11557
+ if ( L ++ , m . noData ) return void ( m . metricsError = {
11558
11558
status :_ . get ( a , "status" , 0 ) ,
11559
11559
details :_ . get ( a , "data.errorMsg" ) || _ . get ( a , "statusText" ) || "Status code " + _ . get ( a , "status" , 0 )
11560
11560
} ) ;
11561
- if ( ! ( K < 2 ) ) {
11561
+ if ( ! ( L < 2 ) ) {
11562
11562
var b = "metrics-failed-" + m . uniqueID ;
11563
11563
m . alerts [ b ] = {
11564
11564
type :"error" ,
@@ -11567,28 +11567,47 @@ links:[ {
11567
11567
href :"" ,
11568
11568
label :"Retry" ,
11569
11569
onClick :function ( ) {
11570
- delete m . alerts [ b ] , K = 1 , z ( ) ;
11570
+ delete m . alerts [ b ] , L = 1 , A ( ) ;
11571
11571
}
11572
11572
} ]
11573
11573
} ;
11574
11574
}
11575
11575
}
11576
11576
}
11577
11577
function w ( ) {
11578
- return ! ( m . metricsError || K > 1 ) && ( m . pod && _ . get ( m , "options.selectedContainer" ) ) ;
11578
+ return window . OPENSHIFT_CONSTANTS . DISABLE_CUSTOM_METRICS ? e . when ( { } ) :j . getCustomMetrics ( m . pod ) . then ( function ( a ) {
11579
+ angular . forEach ( a , function ( a ) {
11580
+ var b = a . description || a . name , c = a . unit || "" ;
11581
+ m . metrics . push ( {
11582
+ label :b ,
11583
+ units :c ,
11584
+ chartPrefix :"custom-" + _ . uniqueId ( "custom-metric-" ) ,
11585
+ chartType :"spline" ,
11586
+ datasets :[ {
11587
+ id :"custom/" + a . name ,
11588
+ label :b ,
11589
+ type :a . type ,
11590
+ data :[ ]
11591
+ } ]
11592
+ } ) ;
11593
+ } ) ;
11594
+ } ) ;
11595
+ }
11596
+ function x ( ) {
11597
+ return ! ( m . metricsError || L > 1 ) && ( m . pod && _ . get ( m , "options.selectedContainer" ) ) ;
11579
11598
}
11580
- function x ( a , b , c ) {
11599
+ function y ( a , b , c ) {
11581
11600
b . total = n ( b . id ) , b . total && ( m . hasLimits = ! 0 ) ;
11582
11601
var d = _ . get ( c , "usage.value" ) ;
11583
11602
isNaN ( d ) && ( d = 0 ) , a . convert && ( d = a . convert ( d ) ) , b . used = d3 . round ( d , a . usagePrecision ) , b . total && ( b . available = d3 . round ( b . total - d , a . usagePrecision ) ) , a . totalUsed += b . used ;
11584
11603
}
11585
- function y ( a , b ) {
11604
+ function z ( a , b ) {
11586
11605
m . noData = ! 1 ;
11587
11606
var c = _ . initial ( b . data ) ;
11588
- return a . data ? void ( a . data = _ . chain ( a . data ) . takeRight ( F ) . concat ( c ) . value ( ) ) :void ( a . data = c ) ;
11607
+ return a . data ? void ( a . data = _ . chain ( a . data ) . takeRight ( G ) . concat ( c ) . value ( ) ) :void ( a . data = c ) ;
11589
11608
}
11590
- function z ( ) {
11591
- if ( w ( ) ) {
11609
+ function A ( ) {
11610
+ if ( x ( ) ) {
11592
11611
var a = q ( ) , b = [ ] ;
11593
11612
angular . forEach ( m . metrics , function ( c ) {
11594
11613
var d = [ ] ;
@@ -11599,16 +11618,16 @@ var g = j.get(f);
11599
11618
d . push ( g ) ;
11600
11619
var h = n ( e . id ) ;
11601
11620
h && b . push ( j . getCurrentUsage ( f ) . then ( function ( a ) {
11602
- x ( c , e , a ) ;
11621
+ y ( c , e , a ) ;
11603
11622
} ) ) ;
11604
11623
}
11605
11624
} ) , b = b . concat ( d ) , e . all ( d ) . then ( function ( a ) {
11606
- G || angular . forEach ( a , function ( a ) {
11625
+ H || angular . forEach ( a , function ( a ) {
11607
11626
if ( a ) {
11608
11627
var b = _ . find ( c . datasets , {
11609
11628
id :a . metricID
11610
11629
} ) ;
11611
- y ( b , a ) ;
11630
+ z ( b , a ) ;
11612
11631
}
11613
11632
} ) ;
11614
11633
} ) ;
@@ -11618,7 +11637,7 @@ m.loaded = !0;
11618
11637
}
11619
11638
}
11620
11639
m . includedMetrics = m . includedMetrics || [ "cpu" , "memory" , "network" ] ;
11621
- var A , B = { } , C = { } , D = c ( "resources.limits.memory" ) , E = c ( "resources.limits.cpu" ) , F = 30 , G = ! 1 ;
11640
+ var B , C = { } , D = { } , E = c ( "resources.limits.memory" ) , F = c ( "resources.limits.cpu" ) , G = 30 , H = ! 1 ;
11622
11641
m . uniqueID = i . uniqueID ( ) , m . metrics = [ ] , _ . includes ( m . includedMetrics , "memory" ) && m . metrics . push ( {
11623
11642
label :"Memory" ,
11624
11643
units :"MiB" ,
@@ -11657,35 +11676,19 @@ id:"network/rx_rate",
11657
11676
label :"Received" ,
11658
11677
data :[ ]
11659
11678
} ]
11660
- } ) , window . OPENSHIFT_CONSTANTS . DISABLE_CUSTOM_METRICS || j . getCustomMetrics ( m . pod ) . then ( function ( a ) {
11661
- angular . forEach ( a , function ( a ) {
11662
- var b = a . description || a . name , c = a . unit || "" ;
11663
- m . metrics . push ( {
11664
- label :b ,
11665
- units :c ,
11666
- chartPrefix :"custom-" + _ . uniqueId ( "custom-metric-" ) ,
11667
- chartType :"spline" ,
11668
- datasets :[ {
11669
- id :"custom/" + a . name ,
11670
- label :b ,
11671
- type :a . type ,
11672
- data :[ ]
11673
- } ]
11674
- } ) ;
11675
- } ) , z ( ) ;
11676
11679
} ) , m . loaded = ! 1 , m . noData = ! 0 , m . showComputeUnitsHelp = function ( ) {
11677
11680
k . showComputeUnitsHelp ( ) ;
11678
11681
} , j . getMetricsURL ( ) . then ( function ( a ) {
11679
11682
m . metricsURL = a ;
11680
11683
} ) , m . options = {
11681
11684
rangeOptions :i . getTimeRangeOptions ( )
11682
11685
} , m . options . timeRange = _ . head ( m . options . rangeOptions ) ;
11683
- var H = a ( "upperFirst" ) , I = function ( a ) {
11686
+ var I = a ( "upperFirst" ) , J = function ( a ) {
11684
11687
var b = "#" + a . chartPrefix + m . uniqueID + "-donut" ;
11685
11688
return {
11686
11689
bindto :b ,
11687
11690
onrendered :function ( ) {
11688
- g . updateDonutCenterText ( b , a . datasets [ 0 ] . used , H ( a . units ) + " Used" ) ;
11691
+ g . updateDonutCenterText ( b , a . datasets [ 0 ] . used , I ( a . units ) + " Used" ) ;
11689
11692
} ,
11690
11693
donut :{
11691
11694
label :{
@@ -11701,24 +11704,26 @@ height:175,
11701
11704
widht :175
11702
11705
}
11703
11706
} ;
11704
- } , J = function ( a ) {
11707
+ } , K = function ( a ) {
11705
11708
var b = a . chartPrefix + m . uniqueID + "-sparkline" , c = i . getDefaultSparklineConfig ( b , a . units ) ;
11706
11709
return 1 === a . datasets . length && _ . set ( c , "legend.show" , ! 1 ) , c ;
11707
- } , K = 0 ;
11710
+ } , L = 0 ;
11711
+ w ( ) [ "finally" ] ( function ( ) {
11708
11712
m . $watch ( "options" , function ( ) {
11709
11713
_ . each ( m . metrics , function ( a ) {
11710
11714
_ . each ( a . datasets , function ( a ) {
11711
11715
delete a . data ;
11712
11716
} ) ;
11713
- } ) , delete m . metricsError , z ( ) ;
11714
- } , ! 0 ) , A = b ( z , i . getDefaultUpdateInterval ( ) , ! 1 ) , f . $on ( "metrics.charts.resize" , function ( ) {
11715
- i . redraw ( B ) , i . redraw ( C ) ;
11717
+ } ) , delete m . metricsError , A ( ) ;
11718
+ } , ! 0 ) , B = b ( A , i . getDefaultUpdateInterval ( ) , ! 1 ) ;
11719
+ } ) , f . $on ( "metrics.charts.resize" , function ( ) {
11720
+ i . redraw ( C ) , i . redraw ( D ) ;
11716
11721
} ) , m . $on ( "$destroy" , function ( ) {
11717
- A && ( b . cancel ( A ) , A = null ) , angular . forEach ( B , function ( a ) {
11722
+ B && ( b . cancel ( B ) , B = null ) , angular . forEach ( C , function ( a ) {
11718
11723
a . destroy ( ) ;
11719
- } ) , B = null , angular . forEach ( C , function ( a ) {
11724
+ } ) , C = null , angular . forEach ( D , function ( a ) {
11720
11725
a . destroy ( ) ;
11721
- } ) , C = null , G = ! 0 ;
11726
+ } ) , D = null , H = ! 0 ;
11722
11727
} ) ;
11723
11728
}
11724
11729
} ;
0 commit comments