@@ -8009,9 +8009,9 @@ k.toErrorPage("Could not load " + m(d.kind) + " '" + d.name + "'. " + b("getErro
8009
8009
j . unwatchAll ( p ) ;
8010
8010
} ) ) :void k . toErrorPage ( "You do not have authority to update " + m ( d . kind ) + " " + d . name + "." , "access_denied" ) ;
8011
8011
} ) ) ;
8012
- } ] ) , angular . module ( "openshiftConsole" ) . controller ( "BrowseCategoryController" , [ "$scope" , "$filter" , "$location" , "$q" , "$routeParams" , "$uibModal" , "AlertMessageService" , "CatalogService" , " Constants", "DataService" , "LabelFilter" , "Navigate" , "ProjectsService" , function ( a , b , c , d , e , f , g , h , i , j , k , l , m ) {
8012
+ } ] ) , angular . module ( "openshiftConsole" ) . controller ( "BrowseCategoryController" , [ "$scope" , "$filter" , "$location" , "$q" , "$routeParams" , "$uibModal" , "AlertMessageService" , "Constants" , "DataService" , "LabelFilter" , "Navigate" , "ProjectsService" , function ( a , b , c , d , e , f , g , h , i , j , k , l ) {
8013
8013
a . projectName = e . project ;
8014
- var n = function ( b , c ) {
8014
+ var m = function ( b , c ) {
8015
8015
var d ;
8016
8016
return _ . some ( b , function ( b ) {
8017
8017
if ( d = _ . find ( b . items , {
@@ -8026,10 +8026,10 @@ label:""
8026
8026
}
8027
8027
return ! 1 ;
8028
8028
} ) , d ;
8029
- } , o = i . CATALOG_CATEGORIES , p = "none" === e . category ? "" :e . category ;
8030
- if ( a . category = n ( o , p ) , ! a . category ) return void l . toErrorPage ( "Catalog category " + e . category + " not found." ) ;
8031
- var q , r ;
8032
- return e . subcategory && ( q = a . category , p = "none" === e . subcategory ? "" :e . subcategory , r = _ . get ( a . category , "subcategories" , [ ] ) , a . category = n ( r , p ) , ! a . category ) ? void l . toErrorPage ( "Catalog category " + e . category + "/" + e . subcategory + " not found." ) :( a . alerts = a . alerts || { } , g . getAlerts ( ) . forEach ( function ( b ) {
8029
+ } , n = h . CATALOG_CATEGORIES , o = "none" === e . category ? "" :e . category ;
8030
+ if ( a . category = m ( n , o ) , ! a . category ) return void k . toErrorPage ( "Catalog category " + e . category + " not found." ) ;
8031
+ var p , q ;
8032
+ return e . subcategory && ( p = a . category , o = "none" === e . subcategory ? "" :e . subcategory , q = _ . get ( a . category , "subcategories" , [ ] ) , a . category = m ( q , o ) , ! a . category ) ? void k . toErrorPage ( "Catalog category " + e . category + "/" + e . subcategory + " not found." ) :( a . alerts = a . alerts || { } , g . getAlerts ( ) . forEach ( function ( b ) {
8033
8033
a . alerts [ b . name ] = b . data ;
8034
8034
} ) , g . clearAlerts ( ) , a . breadcrumbs = [ {
8035
8035
title :a . projectName ,
@@ -8040,23 +8040,23 @@ link:"project/" + a.projectName + "/create"
8040
8040
} , {
8041
8041
title :"Catalog" ,
8042
8042
link :"project/" + a . projectName + "/create?tab=fromCatalog"
8043
- } ] , q && a . breadcrumbs . push ( {
8044
- title :q . label ,
8045
- link :"project/" + a . projectName + "/create/category/" + q . id
8043
+ } ] , p && a . breadcrumbs . push ( {
8044
+ title :p . label ,
8045
+ link :"project/" + a . projectName + "/create/category/" + p . id
8046
8046
} ) , a . breadcrumbs . push ( {
8047
8047
title :a . category . label
8048
- } ) , void m . get ( e . project ) . then ( _ . spread ( function ( c , d ) {
8049
- a . project = c , a . context = d , a . breadcrumbs [ 0 ] . title = b ( "displayName" ) ( c ) , j . list ( "imagestreams" , {
8048
+ } ) , void l . get ( e . project ) . then ( _ . spread ( function ( c , d ) {
8049
+ a . project = c , a . context = d , a . breadcrumbs [ 0 ] . title = b ( "displayName" ) ( c ) , i . list ( "imagestreams" , {
8050
8050
namespace :"openshift"
8051
8051
} , function ( b ) {
8052
8052
a . openshiftImageStreams = b . by ( "metadata.name" ) ;
8053
- } ) , j . list ( "templates" , {
8053
+ } ) , i . list ( "templates" , {
8054
8054
namespace :"openshift"
8055
8055
} , function ( b ) {
8056
8056
a . openshiftTemplates = b . by ( "metadata.name" ) ;
8057
- } ) , "openshift" === e . project ? ( a . projectImageStreams = [ ] , a . projectTemplates = [ ] ) :( j . list ( "imagestreams" , d , function ( b ) {
8057
+ } ) , "openshift" === e . project ? ( a . projectImageStreams = [ ] , a . projectTemplates = [ ] ) :( i . list ( "imagestreams" , d , function ( b ) {
8058
8058
a . projectImageStreams = b . by ( "metadata.name" ) ;
8059
- } ) , j . list ( "templates" , d , function ( b ) {
8059
+ } ) , i . list ( "templates" , d , function ( b ) {
8060
8060
a . projectTemplates = b . by ( "metadata.name" ) ;
8061
8061
} ) ) ;
8062
8062
} ) ) ) ;
@@ -11358,27 +11358,45 @@ var f = a.getCategoryItem(d), g = function(a) {
11358
11358
return a . test ( f . label ) ;
11359
11359
} , h = _ . reject ( b , g ) ;
11360
11360
e . filteredBuildersByCategory [ d ] = a . filterImageStreams ( c , h ) ;
11361
- } ) , e . filteredTemplatesByCategory = { } , void _ . each ( e . templatesByCategory , function ( c , d ) {
11361
+ } ) , e . filteredBuildersNoSubcategory = a . filterImageStreams ( e . buildersNoSubcategory , b ) , e . filteredTemplatesByCategory = { } , _ . each ( e . templatesByCategory , function ( c , d ) {
11362
11362
var f = a . getCategoryItem ( d ) , g = function ( a ) {
11363
11363
return a . test ( f . label ) ;
11364
11364
} , h = _ . reject ( b , g ) ;
11365
11365
e . filteredTemplatesByCategory [ d ] = a . filterTemplates ( c , h ) ;
11366
- } ) ) ;
11366
+ } ) , void ( e . filteredTemplatesNoSubcategory = a . filterTemplates ( e . templatesNoSubcategory , b ) ) ) ;
11367
11367
}
11368
- function g ( ) {
11368
+ function g ( a ) {
11369
+ var b = _ . get ( e , "parentCategory.subcategories" , [ ] ) ;
11370
+ if ( _ . isEmpty ( b ) ) return [ ] ;
11371
+ var c = { } ;
11372
+ _ . each ( b , function ( b ) {
11373
+ _ . each ( b . items , function ( b ) {
11374
+ _ . each ( a [ b . id ] , function ( a ) {
11375
+ var b = _ . get ( a , "metadata.uid" ) ;
11376
+ c [ b ] = ! 0 ;
11377
+ } ) ;
11378
+ } ) ;
11379
+ } ) ;
11380
+ var d = function ( a ) {
11381
+ var b = _ . get ( a , "metadata.uid" ) ;
11382
+ return ! ! c [ b ] ;
11383
+ } , f = e . parentCategory . id ;
11384
+ return _ . reject ( a [ f ] , d ) ;
11385
+ }
11386
+ function h ( ) {
11369
11387
if ( e . projectImageStreams && e . openshiftImageStreams ) {
11370
11388
var b = _ . toArray ( e . projectImageStreams ) . concat ( _ . toArray ( e . openshiftImageStreams ) ) ;
11371
- e . buildersByCategory = a . categorizeImageStreams ( b ) , e . emptyCatalog = e . emptyCatalog && _ . every ( e . buildersByCategory , _ . isEmpty ) , j ( ) ;
11389
+ e . buildersByCategory = a . categorizeImageStreams ( b ) , e . buildersNoSubcategory = g ( e . buildersByCategory ) , e . emptyCatalog = e . emptyCatalog && _ . every ( e . buildersByCategory , _ . isEmpty ) && _ . isEmpty ( e . buildersNoSubcategory ) , l ( ) ;
11372
11390
}
11373
11391
}
11374
- function h ( ) {
11392
+ function i ( ) {
11375
11393
if ( e . projectTemplates && e . openshiftTemplates ) {
11376
11394
var b = _ . toArray ( e . projectTemplates ) . concat ( _ . toArray ( e . openshiftTemplates ) ) ;
11377
- e . templatesByCategory = a . categorizeTemplates ( b ) , e . emptyCatalog = e . emptyCatalog && _ . every ( e . templatesByCategory , _ . isEmpty ) , j ( ) ;
11395
+ e . templatesByCategory = a . categorizeTemplates ( b ) , e . templatesNoSubcategory = g ( e . templatesByCategory ) , e . emptyCatalog = e . emptyCatalog && _ . every ( e . templatesByCategory , _ . isEmpty ) && _ . isEmpty ( e . templatesNoSubcategory ) , l ( ) ;
11378
11396
}
11379
11397
}
11380
- function i ( ) {
11381
- e . noFilterMatches = ! 0 , k = [ ] ;
11398
+ function j ( ) {
11399
+ e . noFilterMatches = ! 0 , m = [ ] ;
11382
11400
var a = { } ;
11383
11401
_ . each ( e . filteredBuildersByCategory , function ( b , c ) {
11384
11402
a [ c ] = _ . size ( b ) ;
@@ -11387,25 +11405,28 @@ a[c] = (a[c] || 0) + _.size(b);
11387
11405
} ) , e . allContentHidden = ! 0 , _ . each ( e . categories , function ( b ) {
11388
11406
var c = ! 1 ;
11389
11407
_ . each ( b . items , function ( b ) {
11390
- a [ b . id ] && ( k . push ( b ) , c = ! 0 ) ;
11408
+ a [ b . id ] && ( m . push ( b ) , c = ! 0 ) ;
11391
11409
} ) , _ . set ( e , [ "hasContent" , b . id ] , c ) , c && ( e . allContentHidden = ! 1 ) ;
11392
- } ) , e . countByCategory = a ;
11410
+ } ) , e . countByCategory = a , e . hasItemsNoSubcategory = ! _ . isEmpty ( e . buildersNoSubcategory ) || ! _ . isEmpty ( e . templatesNoSubcategory ) , e . countFilteredNoSubcategory = _ . size ( e . filteredBuildersNoSubcategory ) + _ . size ( e . filteredTemplatesNoSubcategory ) , e . countFilteredNoSubcategory && ( e . allContentHidden = ! 1 ) ;
11393
11411
}
11394
- function j ( ) {
11395
- e . loaded = e . projectTemplates && e . openshiftTemplates && e . projectImageStreams && e . openshiftImageStreams , f ( ) , i ( ) , e . loaded && ( e . parentCategory && 1 === k . length && ( e . singleCategory = _ . head ( k ) ) , d . log ( "templates by category" , e . templatesByCategory ) , d . log ( "builder images" , e . buildersByCategory ) ) ;
11412
+ function k ( ) {
11413
+ return ! ! e . parentCategory && ( 1 === m . length && ! e . hasItemsNoSubcategory ) ;
11414
+ }
11415
+ function l ( ) {
11416
+ e . loaded = e . projectTemplates && e . openshiftTemplates && e . projectImageStreams && e . openshiftImageStreams , f ( ) , j ( ) , e . loaded && ( k ( ) && ( e . singleCategory = _ . head ( m ) ) , d . log ( "templates by category" , e . templatesByCategory ) , d . log ( "builder images" , e . buildersByCategory ) ) ;
11396
11417
}
11397
11418
e . categories = _ . get ( e , "parentCategory.subcategories" , b . CATALOG_CATEGORIES ) , e . loaded = ! 1 , e . emptyCatalog = ! 0 , e . filter = {
11398
11419
keyword :""
11399
11420
} , e . $watch ( "filter.keyword" , _ . debounce ( function ( ) {
11400
11421
e . $apply ( function ( ) {
11401
- f ( ) , i ( ) ;
11422
+ f ( ) , j ( ) ;
11402
11423
} ) ;
11403
11424
} , 200 , {
11404
11425
maxWait :1e3 ,
11405
11426
trailing :! 0
11406
11427
} ) ) ;
11407
- var k ;
11408
- e . $watchGroup ( [ "openshiftImageStreams" , "projectImageStreams" ] , g ) , e . $watchGroup ( [ "openshiftTemplates" , "projectTemplates" ] , h ) ;
11428
+ var m ;
11429
+ e . $watchGroup ( [ "openshiftImageStreams" , "projectImageStreams" ] , h ) , e . $watchGroup ( [ "openshiftTemplates" , "projectTemplates" ] , i ) ;
11409
11430
}
11410
11431
} ;
11411
11432
} ] ) , angular . module ( "openshiftConsole" ) . directive ( "categoryContent" , [ "CatalogService" , "Constants" , "KeywordService" , "Logger" , function ( a , b , c , d ) {
0 commit comments