Settings for appliances added

This commit is contained in:
piotrpekala7 2020-06-18 17:12:39 +02:00
parent b8e2bb00ac
commit 7a62a7589a
3 changed files with 16 additions and 1 deletions

View File

@ -113,7 +113,7 @@
<mat-step *ngIf="applianceToInstall">
<ng-template matStepLabel>{{secondActionTitle}}</ng-template>
<mat-card [hidden]="!(action==='install')">
<mat-card [hidden]="!applianceToInstall">
<div>
Server type<br/>
<mat-radio-group class="radio-group">

View File

@ -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 {

View File

@ -14,6 +14,10 @@ export class ApplianceService {
return this.httpServer.get<Appliance[]>(server, '/appliances') as Observable<Appliance[]>;
}
getAppliance(server: Server, url): Observable<Appliance> {
return this.httpServer.get<Appliance>(server, url) as Observable<Appliance>;
}
getUploadPath(server: Server, emulator: string, filename: string) {
return `http://${server.host}:${server.port}/v2/compute/${emulator}/images/${filename}`;
}