mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-19 21:17:51 +00:00
Review fixes
This commit is contained in:
parent
c2d5e6fd08
commit
8ad744213b
@ -475,10 +475,13 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
||||
exportProject() {
|
||||
if (this.nodes.filter(node => node.node_type === 'virtualbox').length > 0) {
|
||||
this.toasterService.error('Map with VirtualBox machines cannot be exported.')
|
||||
} else if (this.nodes.filter(node => node.status === 'started').length > 0) {
|
||||
} else if (this.nodes.filter(node =>
|
||||
(node.status === 'started' && node.node_type==='vpcs') ||
|
||||
(node.status === 'started' && node.node_type==='virtualbox') ||
|
||||
(node.status === 'started' && node.node_type==='vmware')).length > 0) {
|
||||
this.toasterService.error('Project with running nodes cannot be exported.')
|
||||
} else {
|
||||
window.location.href = `http://${this.server.host}:${this.server.port}/v2/projects/${this.project.project_id}/export`;
|
||||
location.assign(this.projectService.getExportPath(this.server, this.project));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,6 +143,6 @@ export class ImportProjectDialogComponent implements OnInit {
|
||||
prepareUploadPath(): string {
|
||||
this.uuid = uuid();
|
||||
const projectName = this.projectNameForm.controls['projectName'].value;
|
||||
return `http://${this.server.host}:${this.server.port}/v2/projects/${this.uuid}/import?name=${projectName}`;
|
||||
return this.projectService.getUploadPath(this.server, uuid, projectName);
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,14 @@ export class ProjectService {
|
||||
return this.httpServer.delete(server, `/projects/${project_id}`);
|
||||
}
|
||||
|
||||
getUploadPath(server: Server, uuid: string, project_name: string) {
|
||||
return `http://${server.host}:${server.port}/v2/projects/${uuid}/import?name=${project_name}`;
|
||||
}
|
||||
|
||||
getExportPath(server: Server, project: Project) {
|
||||
return `http://${server.host}:${server.port}/v2/projects/${project.project_id}/export`;
|
||||
}
|
||||
|
||||
export(server: Server, project_id: string): Observable<any> {
|
||||
return this.httpServer.get(server, `/projects/${project_id}/export`)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user