diff --git a/src/app/components/project-map/new-template-dialog/new-template-dialog.component.html b/src/app/components/project-map/new-template-dialog/new-template-dialog.component.html index 7aa5a930..3dcbc942 100644 --- a/src/app/components/project-map/new-template-dialog/new-template-dialog.component.html +++ b/src/app/components/project-map/new-template-dialog/new-template-dialog.component.html @@ -113,7 +113,7 @@ {{secondActionTitle}} - +
Server type
diff --git a/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts b/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts index fb3cd156..29e06ad3 100644 --- a/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts +++ b/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts @@ -94,6 +94,7 @@ export class NewTemplateDialogComponent implements OnInit { this.uploader.onSuccessItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => { this.toasterService.success('Appliance imported succesfully'); + this.getAppliance(item.url); }; this.uploaderImage = new FileUploader({}); @@ -108,6 +109,16 @@ export class NewTemplateDialogComponent implements OnInit { this.uploaderImage.onSuccessItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => { this.toasterService.success('Image imported succesfully'); }; + + this.getAppliance('http://127.0.0.1:3080/v2/compute/qemu/images/firefox.gns3a'); + } + + getAppliance(url: string) { + let str = url.split('/v2'); + let appliancePath = str[str.length-1]; + this.applianceService.getAppliance(this.server, appliancePath).subscribe((appliance: Appliance) => { + this.applianceToInstall = appliance; + }); } addAppliance(event): void { diff --git a/src/app/services/appliances.service.ts b/src/app/services/appliances.service.ts index d6af6e73..9b1665a7 100644 --- a/src/app/services/appliances.service.ts +++ b/src/app/services/appliances.service.ts @@ -14,6 +14,10 @@ export class ApplianceService { return this.httpServer.get(server, '/appliances') as Observable; } + getAppliance(server: Server, url): Observable { + return this.httpServer.get(server, url) as Observable; + } + getUploadPath(server: Server, emulator: string, filename: string) { return `http://${server.host}:${server.port}/v2/compute/${emulator}/images/${filename}`; }