mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-01 15:00:49 +00:00
Code cleaned up
This commit is contained in:
parent
24ab40bfa9
commit
838359b4ac
@ -218,6 +218,7 @@ import { ConfiguratorDialogEthernetSwitchComponent } from './components/project-
|
|||||||
import { PortsComponent } from './components/preferences/common/ports/ports.component';
|
import { PortsComponent } from './components/preferences/common/ports/ports.component';
|
||||||
import { ConfiguratorDialogSwitchComponent } from './components/project-map/node-editors/configurator/switch/configurator-switch.component';
|
import { ConfiguratorDialogSwitchComponent } from './components/project-map/node-editors/configurator/switch/configurator-switch.component';
|
||||||
import { ConfiguratorDialogVirtualBoxComponent } from './components/project-map/node-editors/configurator/virtualbox/configurator-virtualbox.component';
|
import { ConfiguratorDialogVirtualBoxComponent } from './components/project-map/node-editors/configurator/virtualbox/configurator-virtualbox.component';
|
||||||
|
import { CustomAdaptersTableComponent } from './components/preferences/common/custom-adapters-table/custom-adapters-table.component';
|
||||||
|
|
||||||
if (environment.production) {
|
if (environment.production) {
|
||||||
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
||||||
@ -363,7 +364,8 @@ if (environment.production) {
|
|||||||
ConfiguratorDialogEthernetSwitchComponent,
|
ConfiguratorDialogEthernetSwitchComponent,
|
||||||
PortsComponent,
|
PortsComponent,
|
||||||
ConfiguratorDialogSwitchComponent,
|
ConfiguratorDialogSwitchComponent,
|
||||||
ConfiguratorDialogVirtualBoxComponent
|
ConfiguratorDialogVirtualBoxComponent,
|
||||||
|
CustomAdaptersTableComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
@ -7,6 +7,15 @@ export class PortsMapping {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Properties {
|
export class Properties {
|
||||||
|
adapter_type: string;
|
||||||
|
adapters: number;
|
||||||
|
headless: boolean;
|
||||||
|
linked_clone: boolean;
|
||||||
|
on_close: string;
|
||||||
|
ram: number;
|
||||||
|
usage: string;
|
||||||
|
use_any_adapter: boolean;
|
||||||
|
vmname: string;
|
||||||
ports_mapping: PortsMapping[];
|
ports_mapping: PortsMapping[];
|
||||||
mappings: any;
|
mappings: any;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
<table class="table" mat-table [dataSource]="adapters">
|
||||||
|
<ng-container matColumnDef="adapter_number">
|
||||||
|
<th mat-header-cell *matHeaderCellDef> Adapter number </th>
|
||||||
|
<td mat-cell *matCellDef="let element"> Adapter {{element.adapter_number}} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="port_name">
|
||||||
|
<th mat-header-cell *matHeaderCellDef> Port name </th>
|
||||||
|
<td mat-cell *matCellDef="let element"> Ethernet {{element.adapter_number}} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="adapter_type">
|
||||||
|
<th mat-header-cell *matHeaderCellDef> Adapter type </th>
|
||||||
|
<td mat-cell *matCellDef="let element; let i = index;">
|
||||||
|
<mat-select placeholder="Type" [(ngModel)]="element.adapter_type">
|
||||||
|
<mat-option *ngFor="let type of networkTypes" [value]="type">
|
||||||
|
{{type}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<th mat-header-cell *matHeaderCellDef> Actions </th>
|
||||||
|
<td mat-cell *matCellDef="let element">
|
||||||
|
<button mat-icon-button matTooltip="Delete adapter" (click)="delete(element)">
|
||||||
|
<mat-icon aria-label="Delete adapter">delete</mat-icon>
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||||
|
</table>
|
||||||
|
<button mat-button class="form-field" (click)="onAdd()">Add</button>
|
@ -0,0 +1,30 @@
|
|||||||
|
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||||
|
import { CustomAdapter } from '../../../../models/qemu/qemu-custom-adapter';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-custom-adapters-table',
|
||||||
|
templateUrl: './custom-adapters-table.component.html',
|
||||||
|
styleUrls: ['../../preferences.component.scss']
|
||||||
|
})
|
||||||
|
export class CustomAdaptersTableComponent {
|
||||||
|
@Input() networkTypes = [];
|
||||||
|
@Input() displayedColumns: string[] = [];
|
||||||
|
@Input() adapters: CustomAdapter[] = [];
|
||||||
|
|
||||||
|
public numberOfAdapters: number;
|
||||||
|
|
||||||
|
onAdd() {
|
||||||
|
let adapter: CustomAdapter = {
|
||||||
|
adapter_number: this.adapters.length,
|
||||||
|
adapter_type: this.networkTypes[0]
|
||||||
|
}
|
||||||
|
this.adapters.push(adapter);
|
||||||
|
console.log(this.adapters);
|
||||||
|
this.adapters = [adapter];
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(adapter: CustomAdapter) {
|
||||||
|
this.adapters = this.adapters.filter(elem => elem!== adapter);
|
||||||
|
}
|
||||||
|
}
|
@ -6,31 +6,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="default-content">
|
<div class="default-content">
|
||||||
<div class="container mat-elevation-z8">
|
<div class="container mat-elevation-z8">
|
||||||
<table class="table" mat-table [dataSource]="adapters">
|
<app-custom-adapters-table
|
||||||
<ng-container matColumnDef="adapter_number">
|
[networkTypes]="networkTypes"
|
||||||
<th mat-header-cell *matHeaderCellDef> Adapter number </th>
|
[displayedColumns]="displayedColumns"
|
||||||
<td mat-cell *matCellDef="let element"> Adapter {{element.adapter_number}} </td>
|
[adapters]="adapters"
|
||||||
</ng-container>
|
></app-custom-adapters-table>
|
||||||
|
|
||||||
<ng-container matColumnDef="port_name">
|
|
||||||
<th mat-header-cell *matHeaderCellDef> Port name </th>
|
|
||||||
<td mat-cell *matCellDef="let element"> Ethernet {{element.adapter_number}} </td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<ng-container matColumnDef="adapter_type">
|
|
||||||
<th mat-header-cell *matHeaderCellDef> Adapter type </th>
|
|
||||||
<td mat-cell *matCellDef="let element; let i = index;">
|
|
||||||
<mat-select placeholder="Type" [(ngModel)]="adapters[i].adapter_type">
|
|
||||||
<mat-option *ngFor="let type of networkTypes" [value]="type[0]">
|
|
||||||
{{type[1]}} ({{type[0]}})
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons-bar">
|
<div class="buttons-bar">
|
||||||
<button mat-button (click)="cancelConfigureCustomAdapters()">Cancel</button>
|
<button mat-button (click)="cancelConfigureCustomAdapters()">Cancel</button>
|
||||||
|
@ -31,7 +31,7 @@ export class QemuVmTemplateDetailsComponent implements OnInit {
|
|||||||
binaries: QemuBinary[] = [];
|
binaries: QemuBinary[] = [];
|
||||||
activateCpuThrottling: boolean = true;
|
activateCpuThrottling: boolean = true;
|
||||||
isConfiguratorOpened: boolean = false;
|
isConfiguratorOpened: boolean = false;
|
||||||
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type'];
|
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type', 'actions'];
|
||||||
generalSettingsForm: FormGroup;
|
generalSettingsForm: FormGroup;
|
||||||
|
|
||||||
@ViewChild("customAdaptersConfigurator", {static: false})
|
@ViewChild("customAdaptersConfigurator", {static: false})
|
||||||
|
@ -24,7 +24,7 @@ export class VirtualBoxTemplateDetailsComponent implements OnInit {
|
|||||||
onCloseOptions = [];
|
onCloseOptions = [];
|
||||||
categories = [];
|
categories = [];
|
||||||
networkTypes = [];
|
networkTypes = [];
|
||||||
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type'];
|
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type', 'actions'];
|
||||||
isConfiguratorOpened: boolean = false;
|
isConfiguratorOpened: boolean = false;
|
||||||
generalSettingsForm: FormGroup;
|
generalSettingsForm: FormGroup;
|
||||||
networkForm: FormGroup
|
networkForm: FormGroup
|
||||||
|
@ -20,7 +20,7 @@ export class VmwareTemplateDetailsComponent implements OnInit {
|
|||||||
server: Server;
|
server: Server;
|
||||||
vmwareTemplate: VmwareTemplate;
|
vmwareTemplate: VmwareTemplate;
|
||||||
generalSettingsForm: FormGroup;
|
generalSettingsForm: FormGroup;
|
||||||
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type'];
|
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type', 'actions'];
|
||||||
isConfiguratorOpened: boolean = false;
|
isConfiguratorOpened: boolean = false;
|
||||||
isSymbolSelectionOpened: boolean = false;
|
isSymbolSelectionOpened: boolean = false;
|
||||||
consoleTypes: string[] = [];
|
consoleTypes: string[] = [];
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.configButton {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.select {
|
.select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="default-content">
|
<div class="default-content">
|
||||||
<mat-card class="matCard">
|
<mat-card class="matCard">
|
||||||
<mat-tab-group>
|
<mat-tab-group *ngIf="name">
|
||||||
<mat-tab label="General settings">
|
<mat-tab label="General settings">
|
||||||
<form [formGroup]="generalSettingsForm">
|
<form [formGroup]="generalSettingsForm">
|
||||||
<mat-form-field class="form-field">
|
<mat-form-field class="form-field">
|
||||||
@ -21,41 +21,33 @@
|
|||||||
Auto start console
|
Auto start console
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
<mat-form-field class="form-field">
|
<mat-form-field class="form-field">
|
||||||
<input matInput formControlName="ram" type="number" [(ngModel)]="node.ram" placeholder="RAM">
|
<input matInput formControlName="ram" type="number" [(ngModel)]="node.properties.ram" placeholder="RAM">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field class="form-field">
|
<mat-form-field class="form-field">
|
||||||
<mat-select [ngModelOptions]="{standalone: true}" placeholder="On close" [(ngModel)]="node.on_close">
|
<mat-select [ngModelOptions]="{standalone: true}" placeholder="On close" [(ngModel)]="node.properties.on_close">
|
||||||
<mat-option *ngFor="let option of onCloseOptions" [value]="option[1]">
|
<mat-option *ngFor="let option of onCloseOptions" [value]="option[1]">
|
||||||
{{option[0]}}
|
{{option[0]}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</form>
|
</form>
|
||||||
<mat-checkbox [(ngModel)]="node.headless">
|
<mat-checkbox [(ngModel)]="node.properties.headless">
|
||||||
Start VM in headless mode
|
Start VM in headless mode
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="Network">
|
<mat-tab label="Network">
|
||||||
<form [formGroup]="networkForm">
|
<mat-checkbox [(ngModel)]="node.properties.use_any_adapter">
|
||||||
<mat-form-field class="form-field">
|
|
||||||
<input formControlName="adapters" matInput type="number" [(ngModel)]="node.adapters" placeholder="Adapters">
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field class="form-field">
|
|
||||||
<mat-select [ngModelOptions]="{standalone: true}" placeholder="Type" [(ngModel)]="node.adapter_type">
|
|
||||||
<mat-option *ngFor="let type of networkTypes" [value]="type">
|
|
||||||
{{type}}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
</form>
|
|
||||||
<button mat-button class="configButton" (click)="setCustomAdaptersConfiguratorState(true)">Configure custom adapters</button><br/>
|
|
||||||
<mat-checkbox [(ngModel)]="node.use_any_adapter">
|
|
||||||
Allow GNS3 to use any configured VirtualBox adapter
|
Allow GNS3 to use any configured VirtualBox adapter
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
|
<app-custom-adapters-table
|
||||||
|
[networkTypes]="networkTypes"
|
||||||
|
[displayedColumns]="displayedColumns"
|
||||||
|
[adapters]="node.ports"
|
||||||
|
></app-custom-adapters-table>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="Usage">
|
<mat-tab label="Usage">
|
||||||
<mat-form-field class="form-field">
|
<mat-form-field class="form-field">
|
||||||
<textarea matInput type="text" [(ngModel)]="node.usage"></textarea>
|
<textarea matInput type="text" [(ngModel)]="node.properties.usage"></textarea>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
|
@ -21,6 +21,8 @@ export class ConfiguratorDialogVirtualBoxComponent implements OnInit {
|
|||||||
networkForm: FormGroup;
|
networkForm: FormGroup;
|
||||||
consoleTypes: string[] = [];
|
consoleTypes: string[] = [];
|
||||||
onCloseOptions = [];
|
onCloseOptions = [];
|
||||||
|
|
||||||
|
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type', 'actions'];
|
||||||
networkTypes = [];
|
networkTypes = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
export class Port {
|
export class Port {
|
||||||
adapter_number: number;
|
adapter_number: number;
|
||||||
|
adapter_type: string;
|
||||||
link_type: string;
|
link_type: string;
|
||||||
name: string;
|
name: string;
|
||||||
port_number: number;
|
port_number: number;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user