diff --git a/app/scripts/controllers/serviceInstance.js b/app/scripts/controllers/serviceInstance.js index 428d4f0ab3..eebb959b75 100644 --- a/app/scripts/controllers/serviceInstance.js +++ b/app/scripts/controllers/serviceInstance.js @@ -128,33 +128,39 @@ angular.module('openshiftConsole') updateParameterData(); }; - var updateServiceClass = function() { - // If we've previously loaded the service class or a request is in flight, don't do anything. - if (!$scope.serviceInstance || $scope.serviceClass || serviceClassPromise) { - return; - } + var updateServicePlan = function() { + Catalog.getServicePlansForServiceClass($scope.serviceClass).then(function (plans) { + plans = plans.by('metadata.name'); - serviceClassPromise = ServiceInstancesService.fetchServiceClassForInstance($scope.serviceInstance).then(function (serviceClass) { - $scope.serviceClass = serviceClass; - $scope.displayName = serviceInstanceDisplayName($scope.serviceInstance, $scope.serviceClass); + var servicePlanName = _.get($scope.serviceInstance, 'spec.clusterServicePlanRef.name'); + $scope.servicePlans = _.reject(plans, function(plan) { + return _.get(plan, 'status.removedFromBrokerCatalog') && (plan.metadata.name !== servicePlanName); + }); - updateBreadcrumbs(); - serviceClassPromise = null; + $scope.plan = plans[servicePlanName]; - Catalog.getServicePlansForServiceClass($scope.serviceClass).then(function (plans) { - plans = plans.by('metadata.name'); + updateParameterSchema(); + updateEditable(); + }); + }; - var servicePlanName = _.get($scope.serviceInstance, 'spec.clusterServicePlanRef.name'); - $scope.servicePlans = _.reject(plans, function(plan) { - return _.get(plan, 'status.removedFromBrokerCatalog') && (plan.metadata.name !== servicePlanName); - }); + var updateServiceClass = function() { + if (!$scope.serviceInstance || serviceClassPromise) { + return; + } - $scope.plan = plans[servicePlanName]; + if ($scope.serviceClass) { + updateServicePlan(); + } else { + serviceClassPromise = ServiceInstancesService.fetchServiceClassForInstance($scope.serviceInstance).then(function (serviceClass) { + $scope.serviceClass = serviceClass; + $scope.displayName = serviceInstanceDisplayName($scope.serviceInstance, $scope.serviceClass); - updateParameterSchema(); - updateEditable(); + updateBreadcrumbs(); + serviceClassPromise = null; + updateServicePlan(); }); - }); + } }; var serviceResolved = function(serviceInstance, action) { diff --git a/dist/scripts/scripts.js b/dist/scripts/scripts.js index 03a37df93f..7be42062da 100644 --- a/dist/scripts/scripts.js +++ b/dist/scripts/scripts.js @@ -6395,26 +6395,28 @@ e.editAvailable = n && v(e.serviceInstance) && !_.get(e.serviceInstance, "metada }, S = function() { e.parameterFormDefinition = angular.copy(_.get(e.plan, "spec.externalMetadata.schemas.service_instance.update.openshift_form_definition")), e.parameterSchema = _.get(e.plan, "spec.instanceCreateParameterSchema"), b(); }, w = function() { -!e.serviceInstance || e.serviceClass || m || (m = d.fetchServiceClassForInstance(e.serviceInstance).then(function(t) { -e.serviceClass = t, e.displayName = g(e.serviceInstance, e.serviceClass), y(), m = null, i.getServicePlansForServiceClass(e.serviceClass).then(function(t) { +i.getServicePlansForServiceClass(e.serviceClass).then(function(t) { t = t.by("metadata.name"); var n = _.get(e.serviceInstance, "spec.clusterServicePlanRef.name"); e.servicePlans = _.reject(t, function(e) { return _.get(e, "status.removedFromBrokerCatalog") && e.metadata.name !== n; }), e.plan = t[n], S(), C(); }); +}, k = function() { +e.serviceInstance && !m && (e.serviceClass ? w() : m = d.fetchServiceClassForInstance(e.serviceInstance).then(function(t) { +e.serviceClass = t, e.displayName = g(e.serviceInstance, e.serviceClass), y(), m = null, w(); })); -}, k = function(t, n) { +}, P = function(t, n) { e.loaded = !0, e.serviceInstance = t, "DELETED" === n && (e.alerts.deleted = { type: "warning", message: "This provisioned service has been deleted." -}), w(), b(), C(); +}), k(), b(), C(); }; l.get(n.project).then(_.spread(function(a, o) { e.project = a, e.projectContext = o, s.get(e.serviceInstancesVersion, n.instance, o, { errorNotification: !1 }).then(function(t) { -k(t), p.push(s.watchObject(e.serviceInstancesVersion, n.instance, o, k)), p.push(s.watch(h, o, function(n) { +P(t), p.push(s.watchObject(e.serviceInstancesVersion, n.instance, o, P)), p.push(s.watch(h, o, function(n) { var a = n.by("metadata.name"); e.bindings = r.getBindingsForResource(a, t); }));