in source/frontend/src/app/pages/sftp-main/sftp-main.component.ts [520:564]
newFolderCreate() {
const filePath = this.currentFolderPath;
const newFilePath = filePath + '/' + this.newFolderInputText;
const input = {
new_node_path: newFilePath,
node_type: 'folder',
node_name: this.newFolderInputText
};
this.sftpService.createFolder(input).subscribe(
res => {
this.logger.log('created folder: ' + JSON.stringify(res));
this.displayFolderDialog = false;
let new_node = {
collapsedIcon: "fas fa-folder",
data: newFilePath,
expandedIcon: "fas fa-folder-open",
icon: "",
key: newFilePath,
label: this.newFolderInputText,
leaf: false
} as TreeNode;
this.selectedTreeNode.children.push(new_node);
this.onFolderPathSelect({node: new_node});
this.selectedTreeNode.expanded = true;
this.newFolderInputText = '';
this.messageService.add({ severity: 'success', summary: 'Folder Actions.', detail: 'Your folder was successfully created.' });
setTimeout(() => {
this.messageService.clear();
}, 2000);
},
err => {
this.messageService.add({ severity: 'error', summary: 'Something went wrong while creating the folder', detail: err.error.message+" Status: "+err.error.status });
this.logger.error('Error creating folder: ' + JSON.stringify(err.error.message));
setTimeout(() => {
this.messageService.clear();
}, 2000);
},
() => this.logger.log('creating folder operation completed.')
);
}