New port setting for GNS3 VM preferences

This commit is contained in:
piotrpekala7 2020-05-07 17:18:53 +02:00
parent cace01ce9a
commit 81b388a7fe
3 changed files with 7 additions and 0 deletions

View File

@ -27,6 +27,9 @@
Run the VM in headless mode
</mat-checkbox>
<form *ngIf="gns3vm.engine !== 'remote'" [formGroup]="vmForm">
<mat-form-field *ngIf="gns3vm.engine === 'virtualbox' || gns3vm.engine === 'vmware'" class="form-field">
<input matInput type="number" placeholder="Port">
</mat-form-field>
<mat-form-field class="form-field">
<input matInput formControlName="ram" type="number" placeholder="RAM">
<span matSuffix>MB</span>

View File

@ -21,6 +21,7 @@ export class Gns3vmComponent implements OnInit {
public vmEngines: Gns3vmEngine[];
public vms: VM[] = [];
public vmForm: FormGroup;
public port: number;
constructor(
private route: ActivatedRoute,
@ -44,6 +45,7 @@ export class Gns3vmComponent implements OnInit {
this.gns3vm = vm;
this.vmForm.controls['ram'].setValue(this.gns3vm.ram);
this.vmForm.controls['vcpus'].setValue(this.gns3vm.vcpus);
if (this.gns3vm.port) this.port = this.gns3vm.port;
this.gns3vmService.getGns3vmEngines(this.server).subscribe((vmEngines: Gns3vmEngine[]) => {
this.vmEngines = vmEngines;
});
@ -75,6 +77,7 @@ export class Gns3vmComponent implements OnInit {
if ((this.vmForm.valid && this.gns3vm.vmname) || (this.gns3vm.engine==='remote' && this.gns3vm.vmname)) {
this.gns3vm.ram = this.vmForm.get('ram').value;
this.gns3vm.vcpus= this.vmForm.get('vcpus').value;
if (this.port) this.gns3vm.port = this.port;
this.gns3vmService.updateGns3vm(this.server, this.gns3vm).subscribe(() => {
this.toasterService.success('GNS3 VM updated.');

View File

@ -2,6 +2,7 @@ export interface Gns3vm {
enable: boolean;
engine: string;
headless: boolean;
port: number;
ram: number;
vcpus: number;
vmname: string;