fix(deletion): delete registries batch by batch EE-7084 (#11856)

pull/11875/head
cmeng 2024-05-24 14:30:36 +12:00 committed by GitHub
parent ccb6dd7f1a
commit 11404aaecb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 11 deletions

View File

@ -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',
@ -32,10 +33,9 @@ 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);
@ -43,14 +43,11 @@ angular.module('portainer.app').controller('RegistriesController', [
})
.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() {