mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-18 14:58:15 +00:00
Settings for appliances added
This commit is contained in:
@ -113,7 +113,7 @@
|
|||||||
<mat-step *ngIf="applianceToInstall">
|
<mat-step *ngIf="applianceToInstall">
|
||||||
<ng-template matStepLabel>{{secondActionTitle}}</ng-template>
|
<ng-template matStepLabel>{{secondActionTitle}}</ng-template>
|
||||||
|
|
||||||
<mat-card [hidden]="!(action==='install')">
|
<mat-card [hidden]="!applianceToInstall">
|
||||||
<div>
|
<div>
|
||||||
Server type<br/>
|
Server type<br/>
|
||||||
<mat-radio-group class="radio-group">
|
<mat-radio-group class="radio-group">
|
||||||
|
@ -94,6 +94,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
|
|
||||||
this.uploader.onSuccessItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
|
this.uploader.onSuccessItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
|
||||||
this.toasterService.success('Appliance imported succesfully');
|
this.toasterService.success('Appliance imported succesfully');
|
||||||
|
this.getAppliance(item.url);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.uploaderImage = new FileUploader({});
|
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.uploaderImage.onSuccessItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
|
||||||
this.toasterService.success('Image imported succesfully');
|
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 {
|
addAppliance(event): void {
|
||||||
|
@ -14,6 +14,10 @@ export class ApplianceService {
|
|||||||
return this.httpServer.get<Appliance[]>(server, '/appliances') as Observable<Appliance[]>;
|
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) {
|
getUploadPath(server: Server, emulator: string, filename: string) {
|
||||||
return `http://${server.host}:${server.port}/v2/compute/${emulator}/images/${filename}`;
|
return `http://${server.host}:${server.port}/v2/compute/${emulator}/images/${filename}`;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user