Dialog for cloud added

This commit is contained in:
Piotr Pekala 2019-09-13 07:29:59 -07:00
parent 9800e3ea4c
commit a50209455c
3 changed files with 39 additions and 13 deletions

View File

@ -82,7 +82,7 @@
placeholder="Ethernet interface"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="ethernetInterface">
<mat-option *ngFor="let type of " [value]="type">
<mat-option *ngFor="let type of ethernetInterfaces" [value]="type">
{{type}}
</mat-option>
</mat-select>

View File

@ -6,11 +6,33 @@
<mat-card class="matCard">
<mat-tab-group *ngIf="name">
<mat-tab label="Ethernet interfaces">
<div class="form-field" *ngFor="let port of portsMappingEthernet">
<div class="form-field">{{port.name}}</div><br/><br/>
</div>
<mat-form-field class="select">
<mat-select
placeholder="Ethernet interface"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="ethernetInterface">
<mat-option *ngFor="let type of ethernetInterfaces" [value]="type">
{{type}}
</mat-option>
</mat-select>
</mat-form-field>
<button mat-button class="form-field" (click)="onAddEthernetInterface()">Add</button>
</mat-tab>
<mat-tab label="TAP interfaces">
<div class="form-field" *ngFor="let port of portsMappingTap">
<div class="form-field">{{port.name}}</div><br/><br/>
</div>
<mat-form-field class="form-field">
<input
matInput type="text"
[(ngModel)]="tapInterface"
placeholder="TAP interface">
</mat-form-field>
<button mat-button class="form-field" (click)="onAddTapInterface()">Add</button>
</mat-tab>
<mat-tab label="UDP tunnels">

View File

@ -34,6 +34,9 @@ export class ConfiguratorDialogCloudComponent implements OnInit {
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type', 'actions'];
networkTypes = [];
tapInterface: string = '';
ethernetInterface: string = '';
ethernetInterfaces: string[] = ['Ethernet 2', 'Ethernet 3'];
@ViewChild("udpTunnels", {static: false}) udpTunnels: UdpTunnelsComponent;
@ -70,22 +73,23 @@ export class ConfiguratorDialogCloudComponent implements OnInit {
this.consoleTypes = this.builtInTemplatesConfigurationService.getConsoleTypesForCloudNodes();
}
onAddTapInterface() {
if (this.tapInterface) {
this.portsMappingTap.push({
interface: this.tapInterface,
name: this.tapInterface,
port_number: 0,
type: "tap"
});
}
}
onSaveClick() {
if (this.generalSettingsForm.valid) {
this.portsMappingUdp = this.udpTunnels.dataSourceUdp;
this.node.properties.ports_mapping = this.portsMappingUdp.concat(this.portsMappingEthernet).concat(this.portsMappingTap);
// this.node.custom_adapters = [];
// this.customAdapters.adapters.forEach(n => {
// this.node.custom_adapters.push({
// adapter_number: n.adapter_number,
// adapter_type: n.adapter_type
// })
// });
// this.node.properties.adapters = this.node.custom_adapters.length;
this.nodeService. updateNode(this.server, this.node).subscribe(() => {
this.toasterService.success(`Node ${this.node.name} updated.`);
this.onCancelClick();