mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-23 23:02:22 +00:00
Configurator for VMware added
This commit is contained in:
parent
75bf2ef3de
commit
fb06398517
@ -223,6 +223,7 @@ import { ConfiguratorDialogQemuComponent } from './components/project-map/node-e
|
||||
import { ConfiguratorDialogCloudComponent } from './components/project-map/node-editors/configurator/cloud/configurator-cloud.component';
|
||||
import { UdpTunnelsComponent } from './components/preferences/common/udp-tunnels/udp-tunnels.component';
|
||||
import { ConfiguratorDialogAtmSwitchComponent } from './components/project-map/node-editors/configurator/atm_switch/configurator-atm-switch.component';
|
||||
import { ConfiguratorDialogVmwareComponent } from './components/project-map/node-editors/configurator/vmware/configurator-vmware.component';
|
||||
|
||||
if (environment.production) {
|
||||
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
||||
@ -373,7 +374,8 @@ if (environment.production) {
|
||||
ConfiguratorDialogQemuComponent,
|
||||
ConfiguratorDialogCloudComponent,
|
||||
UdpTunnelsComponent,
|
||||
ConfiguratorDialogAtmSwitchComponent
|
||||
ConfiguratorDialogAtmSwitchComponent,
|
||||
ConfiguratorDialogVmwareComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
@ -481,7 +483,8 @@ if (environment.production) {
|
||||
ConfiguratorDialogVirtualBoxComponent,
|
||||
ConfiguratorDialogQemuComponent,
|
||||
ConfiguratorDialogCloudComponent,
|
||||
ConfiguratorDialogAtmSwitchComponent
|
||||
ConfiguratorDialogAtmSwitchComponent,
|
||||
ConfiguratorDialogVmwareComponent
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
|
@ -10,6 +10,7 @@ import { ConfiguratorDialogVirtualBoxComponent } from '../../../node-editors/con
|
||||
import { ConfiguratorDialogQemuComponent } from '../../../node-editors/configurator/qemu/configurator-qemu.component';
|
||||
import { ConfiguratorDialogCloudComponent } from '../../../node-editors/configurator/cloud/configurator-cloud.component';
|
||||
import { ConfiguratorDialogAtmSwitchComponent } from '../../../node-editors/configurator/atm_switch/configurator-atm-switch.component';
|
||||
import { ConfiguratorDialogVmwareComponent } from '../../../node-editors/configurator/vmware/configurator-vmware.component';
|
||||
|
||||
|
||||
@Component({
|
||||
@ -45,7 +46,7 @@ export class ConfigActionComponent {
|
||||
} else if (this.node.node_type === 'virtualbox') {
|
||||
this.dialogRef = this.dialog.open(ConfiguratorDialogVirtualBoxComponent, this.conf);
|
||||
} else if (this.node.node_type === 'vmware') {
|
||||
|
||||
this.dialogRef = this.dialog.open(ConfiguratorDialogVmwareComponent, this.conf);
|
||||
} else if (this.node.node_type === 'docker') {
|
||||
|
||||
} else if (this.node.node_type === 'nat') {
|
||||
|
@ -0,0 +1,63 @@
|
||||
<h1 mat-dialog-title>Configurator for node {{name}}</h1>
|
||||
|
||||
<div class="modal-form-container">
|
||||
<div class="content">
|
||||
<div class="default-content">
|
||||
<mat-card class="matCard">
|
||||
<mat-tab-group *ngIf="name">
|
||||
<mat-tab label="General settings">
|
||||
<br/><form [formGroup]="generalSettingsForm">
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput formControlName="name" type="text" [(ngModel)]="node.name" placeholder="Name">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="select">
|
||||
<mat-select [ngModelOptions]="{standalone: true}" placeholder="Console type" [(ngModel)]="node.console_type">
|
||||
<mat-option *ngFor="let type of consoleTypes" [value]="type">
|
||||
{{type}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-checkbox [ngModelOptions]="{standalone: true}" [(ngModel)]="node.console_auto_start">
|
||||
Auto start console
|
||||
</mat-checkbox>
|
||||
<mat-form-field class="form-field">
|
||||
<mat-select [ngModelOptions]="{standalone: true}" placeholder="On close" [(ngModel)]="node.properties.on_close">
|
||||
<mat-option *ngFor="let option of onCloseOptions" [value]="option[1]">
|
||||
{{option[0]}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</form>
|
||||
<mat-checkbox [(ngModel)]="node.properties.headless">
|
||||
Start VM in headless mode
|
||||
</mat-checkbox>
|
||||
<mat-checkbox [(ngModel)]="node.properties.linked_clone">
|
||||
Use a linked base VM (experimental)
|
||||
</mat-checkbox>
|
||||
</mat-tab>
|
||||
<mat-tab label="Network">
|
||||
<br/><mat-checkbox [(ngModel)]="node.properties.use_any_adapter">
|
||||
Allow GNS3 to override non custom VMware adapter
|
||||
</mat-checkbox>
|
||||
<app-custom-adapters-table
|
||||
#customAdapters
|
||||
[networkTypes]="networkTypes"
|
||||
[displayedColumns]="displayedColumns"
|
||||
[adapters]="node.ports"
|
||||
></app-custom-adapters-table>
|
||||
</mat-tab>
|
||||
<mat-tab label="Usage">
|
||||
<mat-form-field class="form-field">
|
||||
<textarea matInput type="text" [(ngModel)]="node.properties.usage"></textarea>
|
||||
</mat-form-field>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button (click)="onCancelClick()" color="accent">Cancel</button>
|
||||
<button mat-button (click)="onSaveClick()" tabindex="2" mat-raised-button color="primary">Apply</button>
|
||||
</div>
|
@ -0,0 +1,80 @@
|
||||
import { Component, OnInit, Input, ViewChild } from "@angular/core";
|
||||
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||
import { Node } from '../../../../../cartography/models/node';
|
||||
import { Server } from '../../../../../models/server';
|
||||
import { NodeService } from '../../../../../services/node.service';
|
||||
import { ToasterService } from '../../../../../services/toaster.service';
|
||||
import { MatDialogRef } from '@angular/material';
|
||||
import { CustomAdaptersTableComponent } from '../../../../../components/preferences/common/custom-adapters-table/custom-adapters-table.component';
|
||||
import { VmwareConfigurationService } from '../../../../../services/vmware-configuration.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-configurator-vmware',
|
||||
templateUrl: './configurator-vmware.component.html',
|
||||
styleUrls: ['../configurator.component.scss']
|
||||
})
|
||||
export class ConfiguratorDialogVmwareComponent implements OnInit {
|
||||
server: Server;
|
||||
node: Node;
|
||||
name: string;
|
||||
generalSettingsForm: FormGroup;
|
||||
consoleTypes: string[] = [];
|
||||
onCloseOptions = [];
|
||||
|
||||
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type', 'actions'];
|
||||
networkTypes = [];
|
||||
|
||||
@ViewChild("customAdapters", {static: false}) customAdapters: CustomAdaptersTableComponent;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ConfiguratorDialogVmwareComponent>,
|
||||
public nodeService: NodeService,
|
||||
private toasterService: ToasterService,
|
||||
private formBuilder: FormBuilder,
|
||||
private vmwareConfigurationService: VmwareConfigurationService
|
||||
) {
|
||||
this.generalSettingsForm = this.formBuilder.group({
|
||||
name: new FormControl('', Validators.required)
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.nodeService.getNode(this.server, this.node).subscribe((node: Node) => {
|
||||
this.node = node;
|
||||
this.name = node.name;
|
||||
this.getConfiguration();
|
||||
})
|
||||
}
|
||||
|
||||
getConfiguration() {
|
||||
this.consoleTypes = this.vmwareConfigurationService.getConsoleTypes();
|
||||
this.onCloseOptions = this.vmwareConfigurationService.getOnCloseoptions();
|
||||
this.networkTypes = this.vmwareConfigurationService.getNetworkTypes();
|
||||
}
|
||||
|
||||
onSaveClick() {
|
||||
if (this.generalSettingsForm.valid) {
|
||||
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.updateNodeWithCustomAdapters(this.server, this.node).subscribe(() => {
|
||||
this.toasterService.success(`Node ${this.node.name} updated.`);
|
||||
this.onCancelClick();
|
||||
});
|
||||
} else {
|
||||
this.toasterService.error(`Fill all required fields.`);
|
||||
}
|
||||
}
|
||||
|
||||
onCancelClick() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user