mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-19 13:07:52 +00:00
Configurator for IOU added
This commit is contained in:
parent
c1099b22bb
commit
6f92207847
@ -224,6 +224,7 @@ import { ConfiguratorDialogCloudComponent } from './components/project-map/node-
|
||||
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';
|
||||
import { ConfiguratorDialogIouComponent } from './components/project-map/node-editors/configurator/iou/configurator-iou.component';
|
||||
|
||||
if (environment.production) {
|
||||
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
||||
@ -375,7 +376,8 @@ if (environment.production) {
|
||||
ConfiguratorDialogCloudComponent,
|
||||
UdpTunnelsComponent,
|
||||
ConfiguratorDialogAtmSwitchComponent,
|
||||
ConfiguratorDialogVmwareComponent
|
||||
ConfiguratorDialogVmwareComponent,
|
||||
ConfiguratorDialogIouComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
@ -484,7 +486,8 @@ if (environment.production) {
|
||||
ConfiguratorDialogQemuComponent,
|
||||
ConfiguratorDialogCloudComponent,
|
||||
ConfiguratorDialogAtmSwitchComponent,
|
||||
ConfiguratorDialogVmwareComponent
|
||||
ConfiguratorDialogVmwareComponent,
|
||||
ConfiguratorDialogIouComponent
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
|
@ -16,6 +16,7 @@ export class Properties {
|
||||
linked_clone: boolean;
|
||||
on_close: string;
|
||||
ram: number;
|
||||
nvram: number;
|
||||
usage: string;
|
||||
use_any_adapter: boolean;
|
||||
vmname: string;
|
||||
@ -61,6 +62,8 @@ export class Node {
|
||||
console_host: string;
|
||||
console_type: string;
|
||||
custom_adapters?: CustomAdapter[];
|
||||
ethernet_adapters?: any;
|
||||
serial_adapters?: any;
|
||||
first_port_name: string;
|
||||
height: number;
|
||||
label: Label;
|
||||
|
@ -11,6 +11,7 @@ import { ConfiguratorDialogQemuComponent } from '../../../node-editors/configura
|
||||
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';
|
||||
import { ConfiguratorDialogIouComponent } from '../../../node-editors/configurator/iou/configurator-iou.component';
|
||||
|
||||
|
||||
@Component({
|
||||
@ -40,7 +41,7 @@ export class ConfigActionComponent {
|
||||
} else if (this.node.node_type === 'dynamips') {
|
||||
|
||||
} else if (this.node.node_type === 'iou') {
|
||||
|
||||
this.dialogRef = this.dialog.open(ConfiguratorDialogIouComponent, this.conf);
|
||||
} else if (this.node.node_type === 'qemu') {
|
||||
this.dialogRef = this.dialog.open(ConfiguratorDialogQemuComponent, this.conf);
|
||||
} else if (this.node.node_type === 'virtualbox') {
|
||||
|
@ -0,0 +1,57 @@
|
||||
<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 type="text" formControlName="name" [(ngModel)]="node.name" placeholder="Name">
|
||||
</mat-form-field>
|
||||
</form>
|
||||
<mat-form-field class="select">
|
||||
<mat-select 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 [(ngModel)]="node.console_auto_start">
|
||||
Auto start console
|
||||
</mat-checkbox><br/>
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput type="number" [(ngModel)]="node.properties.ram" placeholder="RAM size">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput type="number" [(ngModel)]="node.properties.nvram" placeholder="NVRAM size">
|
||||
</mat-form-field>
|
||||
</mat-tab>
|
||||
|
||||
<mat-tab label="Network">
|
||||
<br/><form [formGroup]="networkForm">
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput formControlName="ethernetAdapters" type="number" [(ngModel)]="node.ethernet_adapters" placeholder="Ethernet adapters">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput formControlName="serialAdapters" type="number" [(ngModel)]="node.serial_adapters" placeholder="Serial adapters">
|
||||
</mat-form-field>
|
||||
</form>
|
||||
</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,67 @@
|
||||
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 { IouConfigurationService } from '../../../../../services/iou-configuration.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-configurator-iou',
|
||||
templateUrl: './configurator-iou.component.html',
|
||||
styleUrls: ['../configurator.component.scss']
|
||||
})
|
||||
export class ConfiguratorDialogIouComponent implements OnInit {
|
||||
server: Server;
|
||||
node: Node;
|
||||
name: string;
|
||||
generalSettingsForm: FormGroup;
|
||||
networkForm: FormGroup;
|
||||
consoleTypes: string[] = [];
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ConfiguratorDialogIouComponent>,
|
||||
public nodeService: NodeService,
|
||||
private toasterService: ToasterService,
|
||||
private formBuilder: FormBuilder,
|
||||
private configurationService: IouConfigurationService
|
||||
) {
|
||||
this.generalSettingsForm = this.formBuilder.group({
|
||||
name: new FormControl('', Validators.required)
|
||||
});
|
||||
|
||||
this.networkForm = this.formBuilder.group({
|
||||
ethernetAdapters: new FormControl('', Validators.required),
|
||||
serialAdapters: 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.configurationService.getConsoleTypes();
|
||||
}
|
||||
|
||||
onSaveClick() {
|
||||
if (this.generalSettingsForm.valid && this.networkForm.valid) {
|
||||
this.nodeService. updateNode(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