Fix for appliances

This commit is contained in:
piotrpekala7 2020-08-04 14:30:56 +02:00
parent af564d6cd7
commit ffb3646d08
2 changed files with 28 additions and 13 deletions

View File

@ -113,17 +113,17 @@
<mat-step *ngIf="applianceToInstall">
<ng-template matStepLabel>{{secondActionTitle}}</ng-template>
<mat-card [hidden]="applianceToInstall">
Please select appliance to install first
<mat-card [hidden]="!(!isLinuxPlatform && !isGns3VmAvailable && !applianceToInstall.dynamips)">
Please configure GNS3 VM to install selected appliance
</mat-card>
<mat-card [hidden]="!applianceToInstall">
<mat-card [hidden]="!(isLinuxPlatform || isGns3VmAvailable || applianceToInstall.dynamips)">
<div *ngIf="applianceToInstall.qemu">
<div>
Server type<br/>
<mat-radio-group class="radio-group">
<mat-radio-button [disabled]="true" class="radio-button" value="1" (click)="setServerType('local')">Install the appliance locally</mat-radio-button>
<mat-radio-button class="radio-button" value="2" checked (click)="setServerType('gns3 vm')">Install the appliance on the GNS3 VM</mat-radio-button>
<mat-radio-button [disabled]="!isLinuxPlatform" [checked]="!isGns3VmChosen" class="radio-button" value="1" (click)="setServerType('local')">Install the appliance locally</mat-radio-button>
<mat-radio-button [disabled]="!isGns3VmAvailable" [checked]="isGns3VmChosen" class="radio-button" value="2" (click)="setServerType('gns3 vm')">Install the appliance on the GNS3 VM</mat-radio-button>
</mat-radio-group>
</div>
<div>
@ -170,8 +170,8 @@
<div>
Server type<br/>
<mat-radio-group class="radio-group">
<mat-radio-button [disabled]="true" class="radio-button" value="1" (click)="setServerType('local')">Install the appliance locally</mat-radio-button>
<mat-radio-button class="radio-button" value="2" checked (click)="setServerType('gns3 vm')">Install the appliance on the GNS3 VM</mat-radio-button>
<mat-radio-button [disabled]="!isLinuxPlatform" [checked]="!isGns3VmChosen" class="radio-button" value="1" (click)="setServerType('local')">Install the appliance locally</mat-radio-button>
<mat-radio-button [disabled]="!isGns3VmAvailable" [checked]="isGns3VmChosen" class="radio-button" value="2" (click)="setServerType('gns3 vm')">Install the appliance on the GNS3 VM</mat-radio-button>
</mat-radio-group>
</div>
<button mat-raised-button color="primary" (click)="createDockerTemplate()" class="create-button">Create docker template</button>
@ -181,8 +181,8 @@
<div>
Server type<br/>
<mat-radio-group class="radio-group">
<mat-radio-button class="radio-button" value="1" (click)="setServerType('local')">Install the appliance locally</mat-radio-button>
<mat-radio-button class="radio-button" value="2" checked (click)="setServerType('gns3 vm')">Install the appliance on the GNS3 VM</mat-radio-button>
<mat-radio-button [checked]="!isGns3VmChosen" class="radio-button" value="1" (click)="setServerType('local')">Install the appliance locally</mat-radio-button>
<mat-radio-button [disabled]="!isGns3VmAvailable" [checked]="isGns3VmChosen" class="radio-button" value="2" (click)="setServerType('gns3 vm')">Install the appliance on the GNS3 VM</mat-radio-button>
</mat-radio-group>
</div>
<div>
@ -214,8 +214,8 @@
<div>
Server type<br/>
<mat-radio-group class="radio-group">
<mat-radio-button [disabled]="true" class="radio-button" value="1" (click)="setServerType('local')">Install the appliance locally</mat-radio-button>
<mat-radio-button class="radio-button" value="2" checked (click)="setServerType('gns3 vm')">Install the appliance on the GNS3 VM</mat-radio-button>
<mat-radio-button [disabled]="!isLinuxPlatform" [checked]="!isGns3VmChosen" class="radio-button" value="1" (click)="setServerType('local')">Install the appliance locally</mat-radio-button>
<mat-radio-button [disabled]="!isGns3VmAvailable" [checked]="isGns3VmChosen" class="radio-button" value="2" (click)="setServerType('gns3 vm')">Install the appliance on the GNS3 VM</mat-radio-button>
</mat-radio-group>
</div>
<div>

View File

@ -26,6 +26,7 @@ import { IouService } from '../../../services/iou.service';
import { IouTemplate } from '../../../models/templates/iou-template';
import { TemplateService } from '../../../services/template.service';
import { Template } from '../../../models/template';
import { ComputeService } from '../../../services/compute.service';
@Component({
selector: 'app-new-template-dialog',
@ -56,7 +57,10 @@ export class NewTemplateDialogComponent implements OnInit {
public applianceToInstall: Appliance;
public selectedImages: any[];
private isGns3VmChosen = true;
public isGns3VmAvailable = false;
public isLinuxPlatform = false;
private isGns3VmChosen = false;
private isLocalComputerChosen = false;
public qemuBinaries: QemuBinary[] = [];
@ -85,10 +89,21 @@ export class NewTemplateDialogComponent implements OnInit {
private iosService: IosService,
private iouService: IouService,
private templateService: TemplateService,
public dialog: MatDialog
public dialog: MatDialog,
private computeService: ComputeService
) {}
ngOnInit() {
this.computeService.getComputes(this.server).subscribe((computes) => {
computes.forEach(compute => {
if (compute.compute_id === 'vm') {
this.isGns3VmAvailable = true;
this.isGns3VmChosen = true;
}
if (compute.capabilities.platform === 'linux') this.isLinuxPlatform = true;
})
});
this.qemuService.getImages(this.server).subscribe((qemuImages) => {
this.qemuImages = qemuImages;
});