mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-05-31 06:20:59 +00:00
Add missing adapter and mac address settings for Qemu and Docker nodes
This commit is contained in:
parent
10c1461d93
commit
55bc69389d
@ -70,6 +70,7 @@ export class Properties {
|
|||||||
qemu_path: string;
|
qemu_path: string;
|
||||||
environment: string;
|
environment: string;
|
||||||
extra_hosts: string;
|
extra_hosts: string;
|
||||||
|
start_command: string;
|
||||||
replicate_network_connection_state: boolean;
|
replicate_network_connection_state: boolean;
|
||||||
memory: number;
|
memory: number;
|
||||||
tpm: boolean;
|
tpm: boolean;
|
||||||
|
@ -33,17 +33,27 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field class="form-field">
|
<mat-form-field class="form-field">
|
||||||
<input formControlName="memory" matInput type="number" min="1" [(ngModel)]="node.properties.memory" placeholder="Maximum memory">
|
<input
|
||||||
|
matInput
|
||||||
|
formControlName="mac_address"
|
||||||
|
type="text"
|
||||||
|
[(ngModel)]="node.properties.mac_address"
|
||||||
|
placeholder="Base MAC"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="form-field">
|
||||||
|
<input formControlName="memory" matInput type="number" min="0" [(ngModel)]="node.properties.memory" placeholder="Maximum memory">
|
||||||
<span matSuffix>MB</span>
|
<span matSuffix>MB</span>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field class="form-field">
|
<mat-form-field class="form-field">
|
||||||
<input formControlName="cpus" matInput type="number" min="1" [(ngModel)]="node.properties.cpus" placeholder="Maximum CPUs">
|
<input formControlName="cpus" matInput type="number" min="0" [(ngModel)]="node.properties.cpus" placeholder="Maximum CPUs">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<button mat-button class="form-field" (click)="configureCustomAdapters()">
|
<!-- <button mat-button class="form-field" (click)="configureCustomAdapters()">-->
|
||||||
Configure custom adapters
|
<!-- Configure custom adapters-->
|
||||||
</button>
|
<!-- </button>-->
|
||||||
|
|
||||||
<mat-form-field class="select">
|
<mat-form-field class="select">
|
||||||
<mat-select
|
<mat-select
|
||||||
|
@ -42,6 +42,7 @@ export class ConfiguratorDialogDockerComponent implements OnInit {
|
|||||||
this.generalSettingsForm = this.formBuilder.group({
|
this.generalSettingsForm = this.formBuilder.group({
|
||||||
name: new UntypedFormControl('', Validators.required),
|
name: new UntypedFormControl('', Validators.required),
|
||||||
adapter: new UntypedFormControl('', Validators.required),
|
adapter: new UntypedFormControl('', Validators.required),
|
||||||
|
mac_address: new UntypedFormControl('', Validators.pattern(this.dockerConfigurationService.getMacAddrRegex())),
|
||||||
memory: new UntypedFormControl('', nonNegativeValidator.get),
|
memory: new UntypedFormControl('', nonNegativeValidator.get),
|
||||||
cpus: new UntypedFormControl('', nonNegativeValidator.get),
|
cpus: new UntypedFormControl('', nonNegativeValidator.get),
|
||||||
startCommand: new UntypedFormControl(''),
|
startCommand: new UntypedFormControl(''),
|
||||||
|
@ -152,15 +152,43 @@
|
|||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="Network">
|
<mat-tab label="Network">
|
||||||
<br />
|
<br />
|
||||||
<br /><mat-checkbox [(ngModel)]="node.properties.replicate_network_connection_state">
|
<mat-form-field class="form-field">
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
min=0
|
||||||
|
type="number"
|
||||||
|
[(ngModel)]="node.properties.adapters"
|
||||||
|
placeholder="Adapters"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
<form [formGroup]="networkSettingsForm">
|
||||||
|
<mat-form-field class="form-field">
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
formControlName="mac_address"
|
||||||
|
type="text"
|
||||||
|
[(ngModel)]="node.properties.mac_address"
|
||||||
|
placeholder="Base MAC"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
</form>
|
||||||
|
<mat-select placeholder="Type" [(ngModel)]="node.properties.adapter_type">
|
||||||
|
<mat-option *ngFor="let type of networkTypes" [value]="type.value">
|
||||||
|
{{ type.name }} ({{ type.value }})
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<!-- <button mat-button class="form-field" (click)="setCustomAdaptersConfiguratorState(true)">-->
|
||||||
|
<!-- Configure custom adapters-->
|
||||||
|
<!-- </button>-->
|
||||||
|
<br /><br /><mat-checkbox [(ngModel)]="node.properties.replicate_network_connection_state">
|
||||||
Replicate network connection state
|
Replicate network connection state
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
<app-custom-adapters-table
|
<!-- <app-custom-adapters-table-->
|
||||||
#customAdapters
|
<!-- #customAdapters-->
|
||||||
[networkTypes]="networkTypes"
|
<!-- [networkTypes]="networkTypes"-->
|
||||||
[displayedColumns]="displayedColumns"
|
<!-- [displayedColumns]="displayedColumns"-->
|
||||||
[adapters]="node.ports"
|
<!-- [adapters]="node.ports"-->
|
||||||
></app-custom-adapters-table>
|
<!-- ></app-custom-adapters-table>-->
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="Advanced">
|
<mat-tab label="Advanced">
|
||||||
<mat-card>
|
<mat-card>
|
||||||
|
@ -22,6 +22,7 @@ export class ConfiguratorDialogQemuComponent implements OnInit {
|
|||||||
node: Node;
|
node: Node;
|
||||||
name: string;
|
name: string;
|
||||||
generalSettingsForm: UntypedFormGroup;
|
generalSettingsForm: UntypedFormGroup;
|
||||||
|
networkSettingsForm: UntypedFormGroup;
|
||||||
consoleTypes: string[] = [];
|
consoleTypes: string[] = [];
|
||||||
onCloseOptions = [];
|
onCloseOptions = [];
|
||||||
bootPriorities = [];
|
bootPriorities = [];
|
||||||
@ -54,6 +55,10 @@ export class ConfiguratorDialogQemuComponent implements OnInit {
|
|||||||
name: new UntypedFormControl('', Validators.required),
|
name: new UntypedFormControl('', Validators.required),
|
||||||
ram: new UntypedFormControl('', Validators.required),
|
ram: new UntypedFormControl('', Validators.required),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.networkSettingsForm = this.formBuilder.group({
|
||||||
|
mac_address: new UntypedFormControl('', Validators.pattern(this.qemuConfigurationService.getMacAddrRegex())),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -103,16 +108,16 @@ export class ConfiguratorDialogQemuComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSaveClick() {
|
onSaveClick() {
|
||||||
if (this.generalSettingsForm.valid) {
|
if (this.generalSettingsForm.valid && this.networkSettingsForm.valid) {
|
||||||
this.node.custom_adapters = [];
|
// this.node.custom_adapters = [];
|
||||||
this.customAdapters.adapters.forEach((n) => {
|
// this.customAdapters.adapters.forEach((n) => {
|
||||||
this.node.custom_adapters.push({
|
// this.node.custom_adapters.push({
|
||||||
adapter_number: n.adapter_number,
|
// adapter_number: n.adapter_number,
|
||||||
adapter_type: n.adapter_type,
|
// adapter_type: n.adapter_type,
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
this.node.properties.adapters = this.node.custom_adapters.length;
|
// this.node.properties.adapters = this.node.custom_adapters.length;
|
||||||
|
|
||||||
this.nodeService.updateNodeWithCustomAdapters(this.controller, this.node).subscribe(() => {
|
this.nodeService.updateNodeWithCustomAdapters(this.controller, this.node).subscribe(() => {
|
||||||
this.toasterService.success(`Node ${this.node.name} updated.`);
|
this.toasterService.success(`Node ${this.node.name} updated.`);
|
||||||
|
@ -27,4 +27,8 @@ export class DockerConfigurationService {
|
|||||||
|
|
||||||
return consoleResolutions;
|
return consoleResolutions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getMacAddrRegex() {
|
||||||
|
return /^([0-9a-fA-F]{2}[:]){5}([0-9a-fA-F]{2})$/;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,34 +76,6 @@ export class QemuConfigurationService {
|
|||||||
{ value: 'vmxnet3', name: 'VMWare Paravirtualized Ethernet v3' },
|
{ value: 'vmxnet3', name: 'VMWare Paravirtualized Ethernet v3' },
|
||||||
];
|
];
|
||||||
|
|
||||||
// let networkTypes = [
|
|
||||||
// 'e1000',
|
|
||||||
// 'e1000-82544gc',
|
|
||||||
// 'e1000-82545em',
|
|
||||||
// 'e1000e',
|
|
||||||
// 'rocker',
|
|
||||||
// 'Intel Gigabit Ethernet',
|
|
||||||
// 'i82550',
|
|
||||||
// 'i82551',
|
|
||||||
// 'i82557a',
|
|
||||||
// 'i82557b',
|
|
||||||
// 'i82557c',
|
|
||||||
// 'i82558a',
|
|
||||||
// 'i82558b',
|
|
||||||
// 'i82559a',
|
|
||||||
// 'i82559b',
|
|
||||||
// 'i82559c',
|
|
||||||
// 'i82559er',
|
|
||||||
// 'i82562',
|
|
||||||
// 'i82801',
|
|
||||||
// 'ne2k_pci',
|
|
||||||
// 'pcnet',
|
|
||||||
// 'rtl8139',
|
|
||||||
// 'virtio',
|
|
||||||
// 'virtio-net-pci',
|
|
||||||
// 'vmxnet3',
|
|
||||||
// ];
|
|
||||||
|
|
||||||
return networkTypes;
|
return networkTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,4 +118,8 @@ export class QemuConfigurationService {
|
|||||||
|
|
||||||
return priorities;
|
return priorities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getMacAddrRegex() {
|
||||||
|
return /^([0-9a-fA-F]{2}[:]){5}([0-9a-fA-F]{2})$/;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user