@@ -11,28 +11,11 @@ angular.module('openshiftConsole')
11
11
LabelFilter ,
12
12
Logger ,
13
13
ProjectsService ) {
14
-
15
- //var overview = this;
16
- //var limitWatches = $filter('isIE')() || $filter('isEdge')();
17
- //var DEFAULT_POLL_INTERVAL = 60 * 1000; // milliseconds
18
-
19
- // Enable service catalog features if the new experience is enabled and the
20
- // servicecatalog.k8s.io resources are available.
21
- var SERVICE_CATALOG_ENABLED =
22
- _ . get ( Constants , 'ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page' ) &&
23
- APIService . apiInfo ( { group : 'servicecatalog.k8s.io' , resource : 'serviceclasses' } ) &&
24
- APIService . apiInfo ( { group : 'servicecatalog.k8s.io' , resource : 'instances' } ) &&
25
- APIService . apiInfo ( { group : 'servicecatalog.k8s.io' , resource : 'bindings' } ) ;
26
-
27
- $scope . projectName = $routeParams . project ;
28
14
$scope . serviceInstances = { } ;
29
15
$scope . unfilteredServiceInstances = { } ;
30
- //$scope.routesByService = {};
31
- //$scope.routes = {};
32
16
$scope . labelSuggestions = { } ;
33
17
$scope . alerts = $scope . alerts || { } ;
34
18
$scope . emptyMessage = "Loading..." ;
35
- $scope . emptyMessageRoutes = "Loading..." ;
36
19
37
20
var watches = [ ] ;
38
21
@@ -176,68 +159,57 @@ angular.module('openshiftConsole')
176
159
. then ( _ . spread ( function ( project , context ) {
177
160
$scope . project = project ;
178
161
179
- var canI = $filter ( 'canI' ) ;
180
-
181
- if ( SERVICE_CATALOG_ENABLED && canI ( { resource : 'instances' , group : 'servicecatalog.k8s.io' } , 'watch' ) ) {
182
- watches . push ( DataService . watch ( {
183
- group : 'servicecatalog.k8s.io' ,
184
- resource : 'instances'
185
- } , context , function ( serviceInstances ) {
186
- $scope . emptyMessage = "No provisioned services to show" ;
187
- state . unfilteredServiceInstances = serviceInstances . by ( 'metadata.name' ) ;
188
-
189
- //_.each(state.unfilteredServiceInstances, function (instance) {
190
- // var notifications = ResourceAlertsService.getServiceInstanceAlerts(instance);
191
- // setNotifications(instance, notifications);
192
- //});
193
-
194
- sortServiceInstances ( ) ;
195
- updateFilter ( ) ;
196
- updateFilterWarning ( ) ;
197
-
198
- //updateLabelSuggestions(state.serviceInstances);
199
- LabelFilter . addLabelSuggestionsFromResources ( state . unfilteredServiceInstances , $scope . labelSuggestions ) ;
200
- LabelFilter . setLabelSuggestions ( $scope . labelSuggestions ) ;
201
-
202
- Logger . log ( "provisioned services (subscribe)" , state . unfilteredServiceInstances ) ;
203
-
204
- //}, {poll: limitWatches, pollInterval: DEFAULT_POLL_INTERVAL}));
205
- } ) ) ;
206
- }
207
-
208
- if ( SERVICE_CATALOG_ENABLED && canI ( { resource : 'bindings' , group : 'servicecatalog.k8s.io' } , 'watch' ) ) {
209
- watches . push ( DataService . watch ( {
210
- group : 'servicecatalog.k8s.io' ,
211
- resource : 'bindings'
212
- } , context , function ( bindings ) {
213
- state . bindings = bindings . by ( 'metadata.name' ) ;
214
- state . bindingsByInstanceRef = _ . groupBy ( state . bindings , 'spec.instanceRef.name' ) ;
215
- groupBindings ( ) ;
216
- //refreshSecrets(context);
217
- //}, {poll: limitWatches, pollInterval: DEFAULT_POLL_INTERVAL}));
218
- } ) ) ;
219
- }
220
-
221
- if ( SERVICE_CATALOG_ENABLED && canI ( { resource : 'instances' , group : 'servicecatalog.k8s.io' } , 'watch' ) ) {
222
- DataService . list ( {
223
- group : 'servicecatalog.k8s.io' ,
224
- resource : 'serviceclasses'
225
- } , context , function ( serviceClasses ) {
226
- state . serviceClasses = serviceClasses . by ( 'metadata.name' ) ;
227
- sortServiceInstances ( ) ;
228
- updateFilter ( ) ;
229
- } ) ;
230
- }
162
+ watches . push ( DataService . watch ( {
163
+ group : 'servicecatalog.k8s.io' ,
164
+ resource : 'instances'
165
+ } , context , function ( serviceInstances ) {
166
+ $scope . emptyMessage = "No provisioned services to show" ;
167
+ state . unfilteredServiceInstances = serviceInstances . by ( 'metadata.name' ) ;
168
+
169
+ //_.each(state.unfilteredServiceInstances, function (instance) {
170
+ // var notifications = ResourceAlertsService.getServiceInstanceAlerts(instance);
171
+ // setNotifications(instance, notifications);
172
+ //});
173
+
174
+ sortServiceInstances ( ) ;
175
+ updateFilter ( ) ;
176
+ updateFilterWarning ( ) ;
177
+
178
+ //updateLabelSuggestions(state.serviceInstances);
179
+ LabelFilter . addLabelSuggestionsFromResources ( state . unfilteredServiceInstances , $scope . labelSuggestions ) ;
180
+ LabelFilter . setLabelSuggestions ( $scope . labelSuggestions ) ;
181
+
182
+ Logger . log ( "provisioned services (subscribe)" , state . unfilteredServiceInstances ) ;
183
+ } ) ) ;
184
+
185
+ watches . push ( DataService . watch ( {
186
+ group : 'servicecatalog.k8s.io' ,
187
+ resource : 'bindings'
188
+ } , context , function ( bindings ) {
189
+ state . bindings = bindings . by ( 'metadata.name' ) ;
190
+ state . bindingsByInstanceRef = _ . groupBy ( state . bindings , 'spec.instanceRef.name' ) ;
191
+ groupBindings ( ) ;
192
+ //refreshSecrets(context);
193
+ } ) ) ;
194
+
195
+ DataService . list ( {
196
+ group : 'servicecatalog.k8s.io' ,
197
+ resource : 'serviceclasses'
198
+ } , context , function ( serviceClasses ) {
199
+ state . serviceClasses = serviceClasses . by ( 'metadata.name' ) ;
200
+ sortServiceInstances ( ) ;
201
+ updateFilter ( ) ;
202
+ } ) ;
231
203
232
204
function updateFilterWarning ( ) {
233
205
if ( ! LabelFilter . getLabelSelector ( ) . isEmpty ( ) && _ . isEmpty ( $scope . serviceInstances ) && ! _ . isEmpty ( $scope . unfilteredServiceInstances ) ) {
234
- $scope . alerts [ "services " ] = {
206
+ $scope . alerts [ "all-instances-filtered " ] = {
235
207
type : "warning" ,
236
- details : "The active filters are hiding all services."
208
+ details : "The active filters are hiding all provisioned services."
237
209
} ;
238
210
}
239
211
else {
240
- delete $scope . alerts [ "services " ] ;
212
+ delete $scope . alerts [ "all-instances-filtered " ] ;
241
213
}
242
214
}
243
215
0 commit comments