@@ -93,6 +93,7 @@ function OverviewController($scope,
93
93
recentPipelinesByDeploymentConfig : { } ,
94
94
routesByService : { } ,
95
95
servicesByObjectUID : { } ,
96
+ serviceInstances : { } ,
96
97
// Set to true below when metrics are available.
97
98
showMetrics : false
98
99
} ;
@@ -156,7 +157,8 @@ function OverviewController($scope,
156
157
_ . size ( overview . deployments ) +
157
158
_ . size ( overview . vanillaReplicaSets ) +
158
159
_ . size ( overview . statefulSets ) +
159
- _ . size ( overview . monopods ) ;
160
+ _ . size ( overview . monopods ) +
161
+ _ . size ( overview . state . serviceInstances ) ;
160
162
} ;
161
163
162
164
// The size of all visible top-level items after filtering.
@@ -166,7 +168,8 @@ function OverviewController($scope,
166
168
_ . size ( overview . filteredDeployments ) +
167
169
_ . size ( overview . filteredReplicaSets ) +
168
170
_ . size ( overview . filteredStatefulSets ) +
169
- _ . size ( overview . filteredMonopods ) ;
171
+ _ . size ( overview . filteredMonopods ) +
172
+ _ . size ( overview . state . serviceInstances ) ;
170
173
} ;
171
174
172
175
// Show the "Get Started" message if the project is empty.
@@ -183,7 +186,8 @@ function OverviewController($scope,
183
186
overview . deployments &&
184
187
overview . replicaSets &&
185
188
overview . statefulSets &&
186
- overview . pods ;
189
+ overview . pods &&
190
+ overview . state . serviceInstances ;
187
191
188
192
state . expandAll = loaded && overview . size === 1 ;
189
193
@@ -1061,6 +1065,33 @@ function OverviewController($scope,
1061
1065
} ) ;
1062
1066
} ;
1063
1067
1068
+ var refreshSecrets = _ . debounce ( function ( context ) {
1069
+ DataService . list ( "secrets" , context , null , { errorNotification : false } ) . then ( function ( secretData ) {
1070
+ state . secrets = secretData . by ( "metadata.name" ) ;
1071
+ } ) ;
1072
+ } , 300 ) ;
1073
+
1074
+ // TODO: code duplicated from directives/bindService.js
1075
+ // extract & share
1076
+ var sortServiceInstances = function ( ) {
1077
+ if ( ! state . serviceInstances && ! state . serviceClasses ) {
1078
+ return ;
1079
+ }
1080
+ state . orderedServiceInstances = _ . toArray ( state . serviceInstances ) . sort ( function ( left , right ) {
1081
+ var leftName = _ . get ( state . serviceClasses , [ left . spec . serviceClassName , 'osbMetadata' , 'displayName' ] ) || left . spec . serviceClassName ;
1082
+ var rightName = _ . get ( state . serviceClasses , [ left . spec . serviceClassName , 'osbMetadata' , 'displayName' ] ) || right . spec . serviceClassName ;
1083
+
1084
+ // Fall back to sorting by `metadata.name` if the display names are the
1085
+ // same so that the sort is stable.
1086
+ if ( leftName === rightName ) {
1087
+ leftName = _ . get ( left , 'metadata.name' , '' ) ;
1088
+ rightName = _ . get ( right , 'metadata.name' , '' ) ;
1089
+ }
1090
+
1091
+ return leftName . localeCompare ( rightName ) ;
1092
+ } ) ;
1093
+ } ;
1094
+
1064
1095
var watches = [ ] ;
1065
1096
ProjectsService . get ( $routeParams . project ) . then ( _ . spread ( function ( project , context ) {
1066
1097
// Project must be set on `$scope` for the projects dropdown.
@@ -1221,15 +1252,19 @@ function OverviewController($scope,
1221
1252
resource : 'instances'
1222
1253
} , context , function ( serviceInstances ) {
1223
1254
state . serviceInstances = serviceInstances . by ( 'metadata.name' ) ;
1255
+ sortServiceInstances ( ) ;
1256
+ updateFilter ( ) ;
1224
1257
} , { poll : limitWatches , pollInterval : DEFAULT_POLL_INTERVAL } ) ) ;
1225
1258
}
1226
1259
1227
1260
if ( Constants . ENABLE_TECH_PREVIEW_FEATURE . service_catalog_landing_page ) {
1228
1261
watches . push ( DataService . watch ( {
1229
1262
group : 'servicecatalog.k8s.io' ,
1230
1263
resource : 'bindings'
1231
- } , context , function ( serviceBindings ) {
1232
- state . serviceBindings = serviceBindings . by ( 'metadata.name' ) ;
1264
+ } , context , function ( bindings ) {
1265
+ state . bindings = bindings . by ( 'metadata.name' ) ;
1266
+ refreshSecrets ( context ) ;
1267
+ updateFilter ( ) ;
1233
1268
} , { poll : limitWatches , pollInterval : DEFAULT_POLL_INTERVAL } ) ) ;
1234
1269
}
1235
1270
@@ -1247,6 +1282,8 @@ function OverviewController($scope,
1247
1282
resource : 'serviceclasses'
1248
1283
} , context , function ( serviceClasses ) {
1249
1284
state . serviceClasses = serviceClasses . by ( 'metadata.name' ) ;
1285
+ sortServiceInstances ( ) ;
1286
+ updateFilter ( ) ;
1250
1287
} ) ;
1251
1288
}
1252
1289
0 commit comments