Skip to content

Commit

Permalink
Fix lease deletion logic
Browse files Browse the repository at this point in the history
  • Loading branch information
skanthed committed Nov 19, 2024
1 parent 4a214cc commit 13bf0a6
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,16 @@
const leasesToDelete = response.selectedLeases;
spinnerService.showModalSpinner('Canceling Lease(s)');

var promises = [];
angular.forEach(nodes, function(node) {
promises.push(esiService.deleteLease(leasesToDelete[node.uuid].id)
.then(function(response) {
if (node.leases.length == 1) {
var i = ctrl.nodesSrc.indexOf(node);
if (i !== -1)
ctrl.nodesSrc.splice(i, 1);
}
}));
var promises = nodes.map(node => {
const leaseId = leasesToDelete[node.uuid].uuid;

return esiService.deleteLease(leaseId)
.then(function() {
if (node.leases.length === 1) {
var i = ctrl.nodesSrc.indexOf(node);
if (i !== -1) ctrl.nodesSrc.splice(i, 1);
}
});
});

$q.all(promises)
Expand Down

0 comments on commit 13bf0a6

Please sign in to comment.