Fix bugzilla 1507822 - Update plan info on service instance update#2409
Conversation
| return; | ||
| } | ||
| var updateServicePlan = function() { | ||
| Catalog.getServicePlansForServiceClass($scope.serviceClass).then(function (plans) { |
There was a problem hiding this comment.
This re-requests plans for the service class on every watch update, correct? It would be better to only request them once on page load and remember them. Watches can trigger often due to status updates on the instance when it's being provisioned.
588d0ab to
e564ac8
Compare
| var servicePlanName = _.get($scope.serviceInstance, 'spec.clusterServicePlanRef.name'); | ||
| $scope.plan = _.find($scope.servicePlans, function(plan) { | ||
| return _.get(plan, 'metadata.name') === servicePlanName; | ||
| }); |
There was a problem hiding this comment.
You can use the shorthand here:
$scope.plan = _.find($scope.servicePlans, { metadata: { name: servicePlanName } });There was a problem hiding this comment.
Thanks, updated.
| var servicePlanName = _.get($scope.serviceInstance, 'spec.clusterServicePlanRef.name'); | ||
| $scope.servicePlans = _.reject(plans, function(plan) { | ||
| $scope.servicePlans = _.reject(plans.by('metadata.name'), function(plan) { | ||
| return _.get(plan, 'status.removedFromBrokerCatalog') && (plan.metadata.name !== servicePlanName); |
There was a problem hiding this comment.
I just realized if you change the instance plan twice without leaving the page, you'll probably be able to select a removed plan again if it was initially selected. Nothing related to this PR, but we might want to test and open an issue.
There was a problem hiding this comment.
Yeah, I thought of the same thing but really really really edge case. Can't think of a good fix except to re-request the plans on a change.
There was a problem hiding this comment.
Check if current instance plan != $scope.plan on instance watch updates and re-filter the existing $scope.servicePlans list?
There was a problem hiding this comment.
True, I was actually thinking of plans that were removed after the original fetch.
e564ac8 to
dce18fd
Compare
|
/kind bug |
|
Automatic merge from submit-queue. |
Fixes bugzilla 1507822 where the service plan information is not updated automatically when the service instance is edited.