mirror of https://github.com/portainer/portainer
feat(agent): enable rename
parent
0b8665f148
commit
dc38715cf8
|
@ -38,7 +38,23 @@ angular.module('portainer.agent').controller('HostBrowserController', [
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function renameFile(name, newName) {}
|
function renameFile(name, newName) {
|
||||||
|
var isRoot = ctrl.isRoot();
|
||||||
|
var filePath = isRoot ? '/' + name : this.state.path + '/' + file;
|
||||||
|
var newFilePath = isRoot ? '/' + newName : this.state.path + '/' + newName;
|
||||||
|
|
||||||
|
HostBrowserService.rename(filePath, newFilePath)
|
||||||
|
.then(function onRenameSuccess() {
|
||||||
|
Notifications.success('File successfully renamed', newFilePath);
|
||||||
|
return HostBrowserService.ls(ctrl.state.path);
|
||||||
|
})
|
||||||
|
.then(function onFilesLoaded(files) {
|
||||||
|
ctrl.files = files;
|
||||||
|
})
|
||||||
|
.catch(function notifyOnError(err) {
|
||||||
|
Notifications.error('Failure', err, 'Unable to rename file');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function downloadFile(name) {}
|
function downloadFile(name) {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue