Add file rename
This commit is contained in:
+1
-1
@@ -2404,7 +2404,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
|
||||
};
|
||||
|
||||
Client.prototype.filesRename = function (appId, path, newPath, callback) {
|
||||
put('/api/v1/apps/' + appId + '/files/' + path, { newFilePath: newPath }, function (error, data, status) {
|
||||
put('/api/v1/apps/' + appId + '/files/' + path, { newFilePath: newPath }, {}, function (error, data, status) {
|
||||
if (error) return callback(error);
|
||||
if (status !== 200) return callback(new ClientError(status, data));
|
||||
|
||||
|
||||
+35
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user