Skip to content

Commit

Permalink
fix(deletion): delete registries batch by batch EE-7084
Browse files Browse the repository at this point in the history
  • Loading branch information
cmenginnz committed May 22, 2024
1 parent ccb6dd7 commit 4c40fde
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions app/portainer/views/registries/registriesController.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import _ from 'lodash-es';
import { confirmDelete } from '@@/modals/confirm';
import { RegistryTypes } from 'Portainer/models/registryTypes';
import { processItemsInBatches } from '@/react/common/processItemsInBatches';

angular.module('portainer.app').controller('RegistriesController', [
'$q',
Expand Down Expand Up @@ -32,25 +33,21 @@ angular.module('portainer.app').controller('RegistriesController', [
});
};

function deleteSelectedRegistries(selectedItems) {
var actionCount = selectedItems.length;
angular.forEach(selectedItems, function (registry) {
RegistryService.deleteRegistry(registry.Id)
async function deleteSelectedRegistries(selectedItems) {
async function doRemove(registry) {
return RegistryService.deleteRegistry(registry.Id)
.then(function success() {
Notifications.success('Registry successfully removed', registry.Name);
var index = $scope.registries.indexOf(registry);
$scope.registries.splice(index, 1);
})
.catch(function error(err) {
Notifications.error('Failure', err, 'Unable to remove registry');
})
.finally(function final() {
--actionCount;
if (actionCount === 0) {
$state.reload();
}
});
});
}

await processItemsInBatches(selectedItems, doRemove);
$state.reload();
}

function initView() {
Expand Down

0 comments on commit 4c40fde

Please sign in to comment.