Add file rename

This commit is contained in:
Johannes Zellner
2020-07-09 12:59:29 +02:00
parent 38f3e39258
commit afc90817cf
3 changed files with 64 additions and 2 deletions

View File

@@ -113,10 +113,44 @@ app.controller('FileManagerController', ['$scope', 'Client', function ($scope, C
}
};
$scope.renameEntry = {
busy: false,
error: null,
entry: null,
newName: '',
show: function (entry) {
$scope.renameEntry.error = null;
$scope.renameEntry.entry = entry;
$scope.renameEntry.newName = entry.filePath;
$scope.renameEntry.busy = false;
$('#renameEntryModal').modal('show');
},
submit: function () {
$scope.renameEntry.busy = true;
var oldFilePath = sanitize($scope.cwd + '/' + $scope.renameEntry.entry.filePath);
var newFilePath = sanitize($scope.cwd + '/' + $scope.renameEntry.newName);
Client.filesRename($scope.appId, oldFilePath, newFilePath, function (error, result) {
$scope.renameEntry.busy = false;
if (error) return Client.error(error);
console.log('rename', result);
$scope.refresh();
$('#renameEntryModal').modal('hide');
});
}
};
$scope.entryRemove = {
busy: false,
error: null,
entry: {},
entry: null,
show: function (entry) {
$scope.entryRemove.error = null;