diff --git a/app/scripts/controllers/overview.js b/app/scripts/controllers/overview.js index 27dc45a8c1..4b46231742 100644 --- a/app/scripts/controllers/overview.js +++ b/app/scripts/controllers/overview.js @@ -325,7 +325,7 @@ function OverviewController($scope, }; // Updated on viewBy changes to include the app label when appropriate. - var filterFields = ['metadata.name', 'spec.externalServiceClassName']; + var filterFields = ['metadata.name', 'spec.externalClusterServiceClassName']; var filterByName = function(items) { return KeywordService.filterForKeywords(items, filterFields, state.filterKeywords); }; diff --git a/app/scripts/controllers/serviceInstance.js b/app/scripts/controllers/serviceInstance.js index 1102e7d518..285b27747c 100644 --- a/app/scripts/controllers/serviceInstance.js +++ b/app/scripts/controllers/serviceInstance.js @@ -29,7 +29,7 @@ angular.module('openshiftConsole') var serviceInstanceDisplayName = $filter('serviceInstanceDisplayName'); // API Versions - var serviceInstancesVersion = APIService.getPreferredVersion('serviceinstances'); + $scope.serviceInstancesVersion = APIService.getPreferredVersion('serviceinstances'); var updateBreadcrumbs = function() { $scope.breadcrumbs.push({ @@ -81,10 +81,10 @@ angular.module('openshiftConsole') $scope.projectContext = context; DataService - .get(serviceInstancesVersion, $routeParams.instance, context, { errorNotification: false }) + .get($scope.serviceInstancesVersion, $routeParams.instance, context, { errorNotification: false }) .then(function(serviceInstance) { serviceResolved(serviceInstance); - watches.push(DataService.watchObject(serviceInstancesVersion, $routeParams.instance, context, serviceResolved)); + watches.push(DataService.watchObject($scope.serviceInstancesVersion, $routeParams.instance, context, serviceResolved)); }, function(error) { $scope.loaded = true; $scope.alerts["load"] = { diff --git a/app/scripts/directives/overview/listRow.js b/app/scripts/directives/overview/listRow.js index bb7e7b9fb1..5a5f31518f 100644 --- a/app/scripts/directives/overview/listRow.js +++ b/app/scripts/directives/overview/listRow.js @@ -44,6 +44,8 @@ var isBinaryBuild = $filter('isBinaryBuild'); var enableTechPreviewFeature = $filter('enableTechPreviewFeature'); + row.serviceBindingsVersion = APIService.getPreferredVersion('servicebindings'); + var updateTriggers = function(apiObject) { var triggers = _.get(apiObject, 'spec.triggers'); if (_.isEmpty(triggers)) { @@ -174,13 +176,13 @@ // Create Binding is displayed. if (enableTechPreviewFeature('pod_presets') && !_.isEmpty(row.state.bindableServiceInstances) && - canI({resource: 'serviceinstancecredentials', group: 'servicecatalog.k8s.io'}, 'create')) { + canI(row.serviceBindingsVersion, 'create')) { return true; } // Delete Binding is displayed. if (enableTechPreviewFeature('pod_presets') && !_.isEmpty(deleteableBindings) && - canI({resource: 'serviceinstancecredentials', group: 'servicecatalog.k8s.io'}, 'delete')) { + canI(row.serviceBindingsVersion, 'delete')) { return true; } // Check if one of the start build actions is displayed @@ -210,13 +212,13 @@ // Create Binding is displayed. if (enableTechPreviewFeature('pod_presets') && !_.isEmpty(row.state.bindableServiceInstances) && - canI({resource: 'serviceinstancecredentials', group: 'servicecatalog.k8s.io'}, 'create')) { + canI(row.serviceBindingsVersion, 'create')) { return true; } // Delete Binding is displayed. if (enableTechPreviewFeature('pod_presets') && !_.isEmpty(deleteableBindings) && - canI({resource: 'serviceinstancecredentials', group: 'servicecatalog.k8s.io'}, 'delete')) { + canI(row.serviceBindingsVersion, 'delete')) { return true; } return false; diff --git a/app/scripts/directives/overview/serviceInstanceRow.js b/app/scripts/directives/overview/serviceInstanceRow.js index e9bf02aef4..2e633bb03d 100644 --- a/app/scripts/directives/overview/serviceInstanceRow.js +++ b/app/scripts/directives/overview/serviceInstanceRow.js @@ -4,6 +4,7 @@ angular.module('openshiftConsole').component('serviceInstanceRow', { controller: [ '$filter', + 'APIService', 'AuthorizationService', 'BindingService', 'ListRowUtils', @@ -20,6 +21,7 @@ }); function ServiceInstanceRow($filter, + APIService, AuthorizationService, BindingService, ListRowUtils, @@ -32,6 +34,9 @@ var serviceInstanceDisplayName = $filter('serviceInstanceDisplayName'); + row.serviceBindingsVersion = APIService.getPreferredVersion('servicebindings'); + row.serviceInstancesVersion = APIService.getPreferredVersion('serviceinstances'); + var getServiceClass = function() { var serviceClassName = ServiceInstancesService.getServiceClassNameForInstance(row.apiObject); return _.get(row, ['state','serviceClasses', serviceClassName]); @@ -81,15 +86,15 @@ } // We can create bindings - if (row.isBindable && AuthorizationService.canI({resource: 'serviceinstancecredentials', group: 'servicecatalog.k8s.io'}, 'create')) { + if (row.isBindable && AuthorizationService.canI(row.serviceBindingsVersion, 'create')) { return true; } // We can delete bindings - if (!_.isEmpty(row.deleteableBindings) && AuthorizationService.canI({resource: 'serviceinstancecredentials', group: 'servicecatalog.k8s.io'}, 'delete')) { + if (!_.isEmpty(row.deleteableBindings) && AuthorizationService.canI(row.serviceBindingsVersion, 'delete')) { return true; } // We can delete instances - if (AuthorizationService.canI({resource: 'serviceinstances', group: 'servicecatalog.k8s.io'}, 'delete')) { + if (AuthorizationService.canI(row.serviceInstancesVersion, 'delete')) { return true; } diff --git a/app/scripts/directives/serviceBinding.js b/app/scripts/directives/serviceBinding.js index e1ee812853..30678a5251 100644 --- a/app/scripts/directives/serviceBinding.js +++ b/app/scripts/directives/serviceBinding.js @@ -3,6 +3,8 @@ (function() { angular.module('openshiftConsole').component('serviceBinding', { controller: [ + "APIService", + "ServiceInstancesService", ServiceBinding ], controllerAs: '$ctrl', @@ -17,14 +19,16 @@ templateUrl: 'views/directives/_service-binding.html' }); - function ServiceBinding() { + function ServiceBinding(APIService, + ServiceInstancesService) { var ctrl = this; + ctrl.serviceBindingsVersion = APIService.getPreferredVersion('servicebindings'); var updateServiceClass = function() { if (_.get(ctrl.refApiObject, 'kind') !== 'ServiceInstance') { var instanceName = _.get(ctrl.binding, 'spec.instanceRef.name'); var instance = _.get(ctrl.serviceInstances, [instanceName]); - var serviceClassName = _.get(instance, 'spec.serviceClassRef.name'); + var serviceClassName = ServiceInstancesService.getServiceClassNameForInstance(instance); ctrl.serviceClass = _.get(ctrl.serviceClasses, [serviceClassName]); } }; diff --git a/app/scripts/filters/canI.js b/app/scripts/filters/canI.js index be06e02406..64fbf98535 100644 --- a/app/scripts/filters/canI.js +++ b/app/scripts/filters/canI.js @@ -34,7 +34,7 @@ angular _.assign({}, APIService.getPreferredVersion('imagestreams'), {verbs: ['update', 'delete']}) ], 'serviceInstances': [ - {group: 'servicecatalog.k8s.io', resource: 'serviceinstances', verbs: ['update', 'delete']} + _.assign({}, APIService.getPreferredVersion('serviceinstances'), {verbs: ['update', 'delete']}) ], 'persistentVolumeClaims': [ {group: '', resource: 'persistentvolumeclaims', verbs: ['update', 'delete']} diff --git a/app/scripts/services/serviceInstances.js b/app/scripts/services/serviceInstances.js index fb8364972f..4429da98bf 100644 --- a/app/scripts/services/serviceInstances.js +++ b/app/scripts/services/serviceInstances.js @@ -14,7 +14,7 @@ angular.module("openshiftConsole") var servicePlansVersion = APIService.getPreferredVersion('clusterserviceplans'); var getServiceClassNameForInstance = function(serviceInstance) { - return _.get(serviceInstance, 'spec.serviceClassRef.name'); + return _.get(serviceInstance, 'spec.clusterServiceClassRef.name'); }; var fetchServiceClassForInstance = function(serviceInstance) { @@ -23,7 +23,7 @@ angular.module("openshiftConsole") }; var getServicePlanNameForInstance = function(serviceInstance) { - return _.get(serviceInstance, 'spec.servicePlanRef.name'); + return _.get(serviceInstance, 'spec.clusterServicePlanRef.name'); }; var fetchServicePlanForInstance = function(serviceInstance) { diff --git a/app/views/browse/service-instance.html b/app/views/browse/service-instance.html index 66542f6298..6f4d72015c 100644 --- a/app/views/browse/service-instance.html +++ b/app/views/browse/service-instance.html @@ -20,10 +20,10 @@