filemanager: make chown support multiple files

This commit is contained in:
Johannes Zellner
2021-01-30 18:20:06 +01:00
parent 778317aa8a
commit 1f3eeb4f43
2 changed files with 14 additions and 10 deletions

View File

@@ -668,18 +668,19 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
$scope.chownEntry = {
busy: false,
error: null,
entry: null,
newOwner: 0,
recursive: false,
showRecursiveOption: false,
show: function (entry) {
show: function () {
$scope.chownEntry.error = null;
$scope.chownEntry.entry = entry;
$scope.chownEntry.newOwner = entry.uid;
// set default uid from first file
$scope.chownEntry.newOwner = $scope.selected[0].uid;
$scope.chownEntry.busy = false;
// default for directories is recursive
$scope.chownEntry.recursive = entry.isDirectory;
$scope.chownEntry.recursive = !!$scope.selected.find(function (entry) { return entry.isDirectory; });
$scope.chownEntry.showRecursiveOption = !!$scope.chownEntry.recursive;
$('#chownEntryModal').modal('show');
},
@@ -687,9 +688,11 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
submit: function () {
$scope.chownEntry.busy = true;
var filePath = sanitize($scope.cwd + '/' + $scope.chownEntry.entry.fileName);
async.eachLimit($scope.selected, 5, function (entry, callback) {
var filePath = sanitize($scope.cwd + '/' + entry.fileName);
Client.filesChown($scope.id, $scope.type, filePath, $scope.chownEntry.newOwner, $scope.chownEntry.recursive, function (error) {
Client.filesChown($scope.id, $scope.type, filePath, $scope.chownEntry.newOwner, $scope.chownEntry.recursive, callback);
}, function (error) {
$scope.chownEntry.busy = false;
if (error) return Client.error(error);
@@ -824,7 +827,7 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
click: function ($itemScope, $event, entry) { $scope.renameEntry.show(entry); }
}, {
text: tr['filemanager.list.menu.chown'],
click: function ($itemScope, $event, entry) { $scope.chownEntry.show(entry); }
click: function ($itemScope, $event, entry) { $scope.chownEntry.show(); }
}, {
text: tr['filemanager.list.menu.extract'],
displayed: function ($itemScope, $event, entry) { return !entry.isDirectory && isArchive(entry.fileName); },