Removing data from appliance dialog

This commit is contained in:
piotrpekala7 2021-06-10 16:21:49 +02:00
parent 5270134626
commit 62c94275a9
2 changed files with 11 additions and 57 deletions

View File

@ -129,31 +129,23 @@
<mat-step *ngIf="applianceToInstall"> <mat-step *ngIf="applianceToInstall">
<ng-template matStepLabel>{{ secondActionTitle }}</ng-template> <ng-template matStepLabel>{{ secondActionTitle }}</ng-template>
<mat-card [hidden]="!(!isLinuxPlatform && !isGns3VmAvailable && !applianceToInstall.dynamips)"> <mat-card [hidden]="!(!isLinuxPlatform && !applianceToInstall.dynamips)">
Please configure GNS3 VM to install selected appliance Please configure GNS3 VM to install selected appliance
</mat-card> </mat-card>
<mat-card [hidden]="!(isLinuxPlatform || isGns3VmAvailable || applianceToInstall.dynamips)"> <mat-card [hidden]="!(isLinuxPlatform || applianceToInstall.dynamips)">
<div *ngIf="applianceToInstall.qemu"> <div *ngIf="applianceToInstall.qemu">
<div> <div>
Server type<br /> Server type<br />
<mat-radio-group class="radio-group"> <mat-radio-group class="radio-group">
<mat-radio-button <mat-radio-button
[disabled]="!isLinuxPlatform" [disabled]="!isLinuxPlatform"
[checked]="!isGns3VmChosen" [checked]="isLocalComputerChosen"
class="radio-button" class="radio-button"
value="1" value="1"
(click)="setServerType('local')" (click)="setServerType('local')"
>Install the appliance locally</mat-radio-button >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> </mat-radio-group>
</div> </div>
<div> <div>
@ -302,20 +294,12 @@
<mat-radio-group class="radio-group"> <mat-radio-group class="radio-group">
<mat-radio-button <mat-radio-button
[disabled]="!isLinuxPlatform" [disabled]="!isLinuxPlatform"
[checked]="!isGns3VmChosen" [checked]="isLocalComputerChosen"
class="radio-button" class="radio-button"
value="1" value="1"
(click)="setServerType('local')" (click)="setServerType('local')"
>Install the appliance locally</mat-radio-button >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> </mat-radio-group>
</div> </div>
<button mat-raised-button color="primary" (click)="createDockerTemplate()" class="create-button"> <button mat-raised-button color="primary" (click)="createDockerTemplate()" class="create-button">
@ -328,20 +312,12 @@
Server type<br /> Server type<br />
<mat-radio-group class="radio-group"> <mat-radio-group class="radio-group">
<mat-radio-button <mat-radio-button
[checked]="!isGns3VmChosen" [checked]="isLocalComputerChosen"
class="radio-button" class="radio-button"
value="1" value="1"
(click)="setServerType('local')" (click)="setServerType('local')"
>Install the appliance locally</mat-radio-button >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> </mat-radio-group>
</div> </div>
<div> <div>
@ -386,20 +362,12 @@
<mat-radio-group class="radio-group"> <mat-radio-group class="radio-group">
<mat-radio-button <mat-radio-button
[disabled]="!isLinuxPlatform" [disabled]="!isLinuxPlatform"
[checked]="!isGns3VmChosen" [checked]="isLocalComputerChosen"
class="radio-button" class="radio-button"
value="1" value="1"
(click)="setServerType('local')" (click)="setServerType('local')"
>Install the appliance locally</mat-radio-button >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> </mat-radio-group>
</div> </div>
<div> <div>

View File

@ -58,11 +58,7 @@ export class NewTemplateDialogComponent implements OnInit {
public appliances: Appliance[] = []; public appliances: Appliance[] = [];
public applianceToInstall: Appliance; public applianceToInstall: Appliance;
public selectedImages: any[]; public selectedImages: any[];
public isGns3VmAvailable = false;
public isLinuxPlatform = false; public isLinuxPlatform = false;
private isGns3VmChosen = false;
private isLocalComputerChosen = false; private isLocalComputerChosen = false;
public qemuBinaries: QemuBinary[] = []; public qemuBinaries: QemuBinary[] = [];
@ -106,10 +102,6 @@ export class NewTemplateDialogComponent implements OnInit {
this.computeService.getComputes(this.server).subscribe((computes) => { this.computeService.getComputes(this.server).subscribe((computes) => {
computes.forEach((compute) => { computes.forEach((compute) => {
if (compute.compute_id === 'vm') {
this.isGns3VmAvailable = true;
this.isGns3VmChosen = true;
}
if (compute.capabilities.platform === 'linux') this.isLinuxPlatform = true; if (compute.capabilities.platform === 'linux') this.isLinuxPlatform = true;
}); });
}); });
@ -283,14 +275,8 @@ export class NewTemplateDialogComponent implements OnInit {
} }
setServerType(serverType: string) { setServerType(serverType: string) {
if (serverType === 'gns3 vm') {
this.isGns3VmChosen = true;
this.isLocalComputerChosen = false;
} else {
this.isGns3VmChosen = false;
this.isLocalComputerChosen = true; this.isLocalComputerChosen = true;
} }
}
sortData(sort: Sort) { sortData(sort: Sort) {
if (!sort.active || sort.direction === '') return; if (!sort.active || sort.direction === '') return;
@ -487,7 +473,7 @@ export class NewTemplateDialogComponent implements OnInit {
iouTemplate.category = this.getCategory(); iouTemplate.category = this.getCategory();
iouTemplate.default_name_format = this.applianceToInstall.port_name_format; iouTemplate.default_name_format = this.applianceToInstall.port_name_format;
iouTemplate.symbol = this.applianceToInstall.symbol; iouTemplate.symbol = this.applianceToInstall.symbol;
iouTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; iouTemplate.compute_id = 'local';
iouTemplate.template_id = uuid(); iouTemplate.template_id = uuid();
iouTemplate.path = image.filename; iouTemplate.path = image.filename;
iouTemplate.template_type = 'iou'; iouTemplate.template_type = 'iou';
@ -536,7 +522,7 @@ export class NewTemplateDialogComponent implements OnInit {
iosTemplate.category = this.getCategory(); iosTemplate.category = this.getCategory();
iosTemplate.default_name_format = this.applianceToInstall.port_name_format; iosTemplate.default_name_format = this.applianceToInstall.port_name_format;
iosTemplate.symbol = this.applianceToInstall.symbol; iosTemplate.symbol = this.applianceToInstall.symbol;
iosTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; iosTemplate.compute_id = 'local';
iosTemplate.template_id = uuid(); iosTemplate.template_id = uuid();
iosTemplate.image = image.filename; iosTemplate.image = image.filename;
iosTemplate.template_type = 'dynamips'; iosTemplate.template_type = 'dynamips';
@ -574,7 +560,7 @@ export class NewTemplateDialogComponent implements OnInit {
dockerTemplate.category = this.getCategory(); dockerTemplate.category = this.getCategory();
dockerTemplate.default_name_format = this.applianceToInstall.port_name_format; dockerTemplate.default_name_format = this.applianceToInstall.port_name_format;
dockerTemplate.symbol = this.applianceToInstall.symbol; dockerTemplate.symbol = this.applianceToInstall.symbol;
dockerTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; dockerTemplate.compute_id = 'local';
dockerTemplate.template_id = uuid(); dockerTemplate.template_id = uuid();
dockerTemplate.image = this.applianceToInstall.docker.image; dockerTemplate.image = this.applianceToInstall.docker.image;
dockerTemplate.template_type = 'docker'; dockerTemplate.template_type = 'docker';
@ -631,7 +617,7 @@ export class NewTemplateDialogComponent implements OnInit {
qemuTemplate.port_name_format = this.applianceToInstall.port_name_format; qemuTemplate.port_name_format = this.applianceToInstall.port_name_format;
qemuTemplate.symbol = this.applianceToInstall.symbol; qemuTemplate.symbol = this.applianceToInstall.symbol;
qemuTemplate.qemu_path = this.selectedBinary.path; qemuTemplate.qemu_path = this.selectedBinary.path;
qemuTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; qemuTemplate.compute_id = 'local';
qemuTemplate.template_id = uuid(); qemuTemplate.template_id = uuid();
qemuTemplate.hda_disk_image = version.images.hda_disk_image; qemuTemplate.hda_disk_image = version.images.hda_disk_image;
qemuTemplate.hdb_disk_image = version.images.hdb_disk_image; qemuTemplate.hdb_disk_image = version.images.hdb_disk_image;