Skip to content

Commit

Permalink
Fix bugzilla 1507822 - Update plan info on service instance update
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-phillips-18 committed Oct 31, 2017
1 parent 9b48a7b commit 588d0ab
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
46 changes: 26 additions & 20 deletions app/scripts/controllers/serviceInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 7 additions & 5 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}));
Expand Down

0 comments on commit 588d0ab

Please sign in to comment.