Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 588d0ab

Browse files
committedOct 31, 2017
Fix bugzilla 1507822 - Update plan info on service instance update
1 parent 9b48a7b commit 588d0ab

File tree

2 files changed

+33
-25
lines changed

2 files changed

+33
-25
lines changed
 

‎app/scripts/controllers/serviceInstance.js

+26-20
Original file line numberDiff line numberDiff line change
@@ -128,33 +128,39 @@ angular.module('openshiftConsole')
128128
updateParameterData();
129129
};
130130

131-
var updateServiceClass = function() {
132-
// If we've previously loaded the service class or a request is in flight, don't do anything.
133-
if (!$scope.serviceInstance || $scope.serviceClass || serviceClassPromise) {
134-
return;
135-
}
131+
var updateServicePlan = function() {
132+
Catalog.getServicePlansForServiceClass($scope.serviceClass).then(function (plans) {
133+
plans = plans.by('metadata.name');
136134

137-
serviceClassPromise = ServiceInstancesService.fetchServiceClassForInstance($scope.serviceInstance).then(function (serviceClass) {
138-
$scope.serviceClass = serviceClass;
139-
$scope.displayName = serviceInstanceDisplayName($scope.serviceInstance, $scope.serviceClass);
135+
var servicePlanName = _.get($scope.serviceInstance, 'spec.clusterServicePlanRef.name');
136+
$scope.servicePlans = _.reject(plans, function(plan) {
137+
return _.get(plan, 'status.removedFromBrokerCatalog') && (plan.metadata.name !== servicePlanName);
138+
});
140139

141-
updateBreadcrumbs();
142-
serviceClassPromise = null;
140+
$scope.plan = plans[servicePlanName];
143141

144-
Catalog.getServicePlansForServiceClass($scope.serviceClass).then(function (plans) {
145-
plans = plans.by('metadata.name');
142+
updateParameterSchema();
143+
updateEditable();
144+
});
145+
};
146146

147-
var servicePlanName = _.get($scope.serviceInstance, 'spec.clusterServicePlanRef.name');
148-
$scope.servicePlans = _.reject(plans, function(plan) {
149-
return _.get(plan, 'status.removedFromBrokerCatalog') && (plan.metadata.name !== servicePlanName);
150-
});
147+
var updateServiceClass = function() {
148+
if (!$scope.serviceInstance || serviceClassPromise) {
149+
return;
150+
}
151151

152-
$scope.plan = plans[servicePlanName];
152+
if ($scope.serviceClass) {
153+
updateServicePlan();
154+
} else {
155+
serviceClassPromise = ServiceInstancesService.fetchServiceClassForInstance($scope.serviceInstance).then(function (serviceClass) {
156+
$scope.serviceClass = serviceClass;
157+
$scope.displayName = serviceInstanceDisplayName($scope.serviceInstance, $scope.serviceClass);
153158

154-
updateParameterSchema();
155-
updateEditable();
159+
updateBreadcrumbs();
160+
serviceClassPromise = null;
161+
updateServicePlan();
156162
});
157-
});
163+
}
158164
};
159165

160166
var serviceResolved = function(serviceInstance, action) {

‎dist/scripts/scripts.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -6395,26 +6395,28 @@ e.editAvailable = n && v(e.serviceInstance) && !_.get(e.serviceInstance, "metada
63956395
}, S = function() {
63966396
e.parameterFormDefinition = angular.copy(_.get(e.plan, "spec.externalMetadata.schemas.service_instance.update.openshift_form_definition")), e.parameterSchema = _.get(e.plan, "spec.instanceCreateParameterSchema"), b();
63976397
}, w = function() {
6398-
!e.serviceInstance || e.serviceClass || m || (m = d.fetchServiceClassForInstance(e.serviceInstance).then(function(t) {
6399-
e.serviceClass = t, e.displayName = g(e.serviceInstance, e.serviceClass), y(), m = null, i.getServicePlansForServiceClass(e.serviceClass).then(function(t) {
6398+
i.getServicePlansForServiceClass(e.serviceClass).then(function(t) {
64006399
t = t.by("metadata.name");
64016400
var n = _.get(e.serviceInstance, "spec.clusterServicePlanRef.name");
64026401
e.servicePlans = _.reject(t, function(e) {
64036402
return _.get(e, "status.removedFromBrokerCatalog") && e.metadata.name !== n;
64046403
}), e.plan = t[n], S(), C();
64056404
});
6405+
}, k = function() {
6406+
e.serviceInstance && !m && (e.serviceClass ? w() : m = d.fetchServiceClassForInstance(e.serviceInstance).then(function(t) {
6407+
e.serviceClass = t, e.displayName = g(e.serviceInstance, e.serviceClass), y(), m = null, w();
64066408
}));
6407-
}, k = function(t, n) {
6409+
}, P = function(t, n) {
64086410
e.loaded = !0, e.serviceInstance = t, "DELETED" === n && (e.alerts.deleted = {
64096411
type: "warning",
64106412
message: "This provisioned service has been deleted."
6411-
}), w(), b(), C();
6413+
}), k(), b(), C();
64126414
};
64136415
l.get(n.project).then(_.spread(function(a, o) {
64146416
e.project = a, e.projectContext = o, s.get(e.serviceInstancesVersion, n.instance, o, {
64156417
errorNotification: !1
64166418
}).then(function(t) {
6417-
k(t), p.push(s.watchObject(e.serviceInstancesVersion, n.instance, o, k)), p.push(s.watch(h, o, function(n) {
6419+
P(t), p.push(s.watchObject(e.serviceInstancesVersion, n.instance, o, P)), p.push(s.watch(h, o, function(n) {
64186420
var a = n.by("metadata.name");
64196421
e.bindings = r.getBindingsForResource(a, t);
64206422
}));

0 commit comments

Comments
 (0)
Please sign in to comment.