filemanager: allow to delete all selected files

This commit is contained in:
Johannes Zellner
2021-01-30 17:08:32 +01:00
parent 5880101d9a
commit c12dfcef54
2 changed files with 13 additions and 7 deletions

View File

@@ -703,11 +703,9 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
$scope.entryRemove = {
busy: false,
error: null,
entry: null,
show: function (entry) {
show: function () {
$scope.entryRemove.error = null;
$scope.entryRemove.entry = entry;
$('#entryRemoveModal').modal('show');
},
@@ -715,9 +713,11 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
submit: function () {
$scope.entryRemove.busy = true;
var filePath = sanitize($scope.cwd + '/' + $scope.entryRemove.entry.fileName);
async.eachLimit($scope.selected, 5, function (entry, callback) {
var filePath = sanitize($scope.cwd + '/' + entry.fileName);
Client.filesRemove($scope.id, $scope.type, filePath, function (error) {
Client.filesRemove($scope.id, $scope.type, filePath, callback);
}, function (error) {
$scope.entryRemove.busy = false;
if (error) return Client.error(error);
@@ -725,6 +725,7 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
$('#entryRemoveModal').modal('hide');
});
}
};
@@ -830,11 +831,12 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
click: function ($itemScope, $event, entry) { extract(entry); }
}, {
text: tr['filemanager.list.menu.download'],
enabled: function () { return $scope.selected.length === 1; },
click: function ($itemScope, $event, entry) { download(entry); }
}, {
text: tr['filemanager.list.menu.delete'],
hasTopDivider: true,
click: function ($itemScope, $event, entry) { $scope.entryRemove.show(entry); }
click: function ($itemScope, $event, entry) { $scope.entryRemove.show(); }
}
];
});