@@ -5979,50 +5979,47 @@ d.unwatchAll(i);
5979
5979
} ) ;
5980
5980
} ) ) ;
5981
5981
} ] ) , angular . module ( "openshiftConsole" ) . controller ( "ServiceController" , [ "$scope" , "$routeParams" , "DataService" , "ProjectsService" , "$filter" , function ( a , b , c , d , e ) {
5982
- a . projectName = b . project , a . service = null , a . services = null , a . alerts = { } , a . renderOptions = a . renderOptions || { } , a . renderOptions . hideFilterWidget = ! 0 , a . breadcrumbs = [ {
5982
+ a . projectName = b . project , a . service = null , a . services = null , a . alerts = { } , a . pods = [ ] , a . renderOptions = a . renderOptions || { } , a . renderOptions . hideFilterWidget = ! 0 , a . breadcrumbs = [ {
5983
5983
title :"Services" ,
5984
5984
link :"project/" + b . project + "/browse/services"
5985
5985
} , {
5986
5986
title :b . service
5987
5987
} ] ;
5988
5988
var f = [ ] , g = function ( b , c ) {
5989
- a . loaded = ! 0 , a . service = b , "DELETED" === c && ( a . alerts . deleted = {
5989
+ if ( a . podsForService = { } , b && c ) {
5990
+ var d = new LabelSelector ( b . spec . selector ) ;
5991
+ a . podsForService = d . select ( c ) ;
5992
+ }
5993
+ } , h = function ( b , c ) {
5994
+ a . loaded = ! 0 , a . service = b , g ( b , a . pods ) , "DELETED" === c && ( a . alerts . deleted = {
5990
5995
type :"warning" ,
5991
5996
message :"This service has been deleted."
5992
5997
} ) ;
5993
5998
} ;
5994
- d . get ( b . project ) . then ( _ . spread ( function ( d , h ) {
5995
- function i ( b , c ) {
5996
- a . podsForService = [ ] ;
5997
- var d = new LabelSelector ( b . spec . selector ) ;
5998
- angular . forEach ( c . by ( "metadata.name" ) , function ( b ) {
5999
- d . matches ( b ) && a . podsForService . push ( b ) ;
6000
- } ) ;
6001
- }
6002
- a . project = d , a . projectContext = h , c . get ( "services" , b . service , h ) . then ( function ( a ) {
6003
- g ( a ) , f . push ( c . watchObject ( "services" , b . service , h , g ) ) ;
5999
+ d . get ( b . project ) . then ( _ . spread ( function ( d , i ) {
6000
+ a . project = d , a . projectContext = i , c . get ( "services" , b . service , i ) . then ( function ( a ) {
6001
+ h ( a ) , f . push ( c . watchObject ( "services" , b . service , i , h ) ) ;
6004
6002
} , function ( b ) {
6005
6003
a . loaded = ! 0 , a . alerts . load = {
6006
6004
type :"error" ,
6007
6005
message :"The service details could not be loaded." ,
6008
6006
details :"Reason: " + e ( "getErrorDetails" ) ( b )
6009
6007
} ;
6010
- } ) , f . push ( c . watch ( "services" , h , function ( b ) {
6008
+ } ) , f . push ( c . watch ( "services" , i , function ( b ) {
6011
6009
a . services = b . by ( "metadata.name" ) ;
6012
- } ) ) , f . push ( c . watch ( "pods" , h , function ( d ) {
6013
- var e = a . service ;
6014
- return e ? void i ( e , d ) :void c . get ( "services" , b . service , h ) . then ( function ( a ) {
6015
- i ( a , d ) ;
6016
- } ) ;
6017
- } ) ) , f . push ( c . watch ( "endpoints" , h , function ( c ) {
6018
- a . podsWithEndpoints = { } , angular . forEach ( c . by ( "metadata.name" ) , function ( c ) {
6019
- c . metadata . name === b . service && c . subsets . forEach ( function ( b ) {
6020
- b . addresses . forEach ( function ( b ) {
6021
- void 0 !== b . targetRef && "Pod" === b . targetRef . kind && ( a . podsWithEndpoints [ b . targetRef . name ] = ! 0 ) ;
6022
- } ) ;
6023
- } ) ;
6024
- } ) ;
6025
- } ) ) , f . push ( c . watch ( "routes" , h , function ( c ) {
6010
+ } ) ) , f . push ( c . watch ( "pods" , i , function ( b ) {
6011
+ a . pods = [ ] , angular . forEach ( b . by ( "metadata.name" ) , function ( b ) {
6012
+ a . pods . push ( b ) ;
6013
+ } ) , g ( a . service , a . pods ) ;
6014
+ } ) ) , f . push ( c . watch ( "endpoints" , i , function ( c ) {
6015
+ a . podsWithEndpoints = { } ;
6016
+ var d = c . by ( "metadata.name" ) ;
6017
+ d = d [ b . service ] , d && _ . each ( d . subsets , function ( b ) {
6018
+ _ . each ( b . addresses , function ( b ) {
6019
+ "Pod" === _ . get ( b , "targetRef.kind" ) && ( a . podsWithEndpoints [ b . targetRef . name ] = ! 0 ) ;
6020
+ } ) ;
6021
+ } ) ;
6022
+ } ) ) , f . push ( c . watch ( "routes" , i , function ( c ) {
6026
6023
a . routesForService = [ ] , angular . forEach ( c . by ( "metadata.name" ) , function ( c ) {
6027
6024
"Service" === c . spec . to . kind && c . spec . to . name === b . service && a . routesForService . push ( c ) ;
6028
6025
} ) , Logger . log ( "routes (subscribe)" , a . routesByService ) ;
0 commit comments