New titles for node configurators and enforce min/max for mat-input fields.

This commit is contained in:
grossmj 2024-05-19 16:49:10 +07:00
parent 84a145a701
commit 9287706185
No known key found for this signature in database
GPG Key ID: 0A2D76AC45EA25CD
24 changed files with 43 additions and 39 deletions

View File

@ -159,6 +159,8 @@
<mat-form-field class="form-field">
<input
matInput type="number"
min="1"
max="65535"
[(ngModel)]="newPort.lport"
placeholder="Local port">
</mat-form-field>
@ -171,6 +173,8 @@
<mat-form-field class="form-field">
<input
matInput type="number"
min="1"
max="65535"
[(ngModel)]="newPort.rport"
placeholder="Remote port">
</mat-form-field>

View File

@ -31,7 +31,7 @@
<input formControlName="templateName" matInput type="text" placeholder="Template name" />
</mat-form-field>
<mat-form-field class="form-field">
<input formControlName="numberOfPorts" matInput type="number" placeholder="Number of ports" />
<input formControlName="numberOfPorts" matInput type="number" min="0" placeholder="Number of ports" />
</mat-form-field>
</form>
</mat-card>

View File

@ -29,7 +29,7 @@
<input formControlName="templateName" matInput type="text" placeholder="Template name" />
</mat-form-field>
<mat-form-field class="form-field">
<input formControlName="numberOfPorts" matInput type="number" placeholder="Number of ports" />
<input formControlName="numberOfPorts" matInput type="number" min="0" placeholder="Number of ports" />
</mat-form-field>
</form>
</mat-card>

View File

@ -33,10 +33,10 @@
</table>
<br />
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="newPort.port_number" placeholder="Port" />
<input matInput type="number" min="0" [(ngModel)]="newPort.port_number" placeholder="Port" />
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="newPort.vlan" placeholder="VLAN" />
<input matInput type="number" min="1" max="65535" [(ngModel)]="newPort.vlan" placeholder="VLAN" />
</mat-form-field>
<mat-form-field class="select">
<mat-select placeholder="Type" [ngModelOptions]="{ standalone: true }" [(ngModel)]="newPort.type">

View File

@ -36,12 +36,12 @@
<input matInput type="text" [(ngModel)]="newPort.name" placeholder="Name" />
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="newPort.lport" placeholder="Local port" />
<input matInput type="number" min="0" max="65535" [(ngModel)]="newPort.lport" placeholder="Local port" />
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="text" [(ngModel)]="newPort.rhost" placeholder="Remote host" />
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="newPort.rport" placeholder="Remote port" />
<input matInput type="number" min="0" max="65535" [(ngModel)]="newPort.rport" placeholder="Remote port" />
</mat-form-field>
<button mat-button class="form-field" (click)="onAddUdpInterface()">Add</button>

View File

@ -119,7 +119,7 @@
</mat-expansion-panel-header>
<form [formGroup]="memoryForm">
<mat-form-field class="form-field">
<input matInput type="number" formControlName="ram" [(ngModel)]="iosTemplate.ram" placeholder="RAM size" />
<input matInput type="number" min="1" formControlName="ram" [(ngModel)]="iosTemplate.ram" placeholder="RAM size" />
<span matSuffix>MB</span>
</mat-form-field>
<mat-form-field class="form-field">

View File

@ -109,11 +109,11 @@
><br />
<mat-checkbox [(ngModel)]="iouTemplate.use_default_iou_values"> Use default IOU values for memories </mat-checkbox>
<mat-form-field class="form-field" *ngIf="!iouTemplate.use_default_iou_values">
<input matInput type="number" [(ngModel)]="iouTemplate.ram" placeholder="RAM size" />
<input matInput type="number" min="1" [(ngModel)]="iouTemplate.ram" placeholder="RAM size" />
<span matSuffix>MB</span>
</mat-form-field>
<mat-form-field class="form-field" *ngIf="!iouTemplate.use_default_iou_values">
<input matInput type="number" [(ngModel)]="iouTemplate.nvram" placeholder="NVRAM size" />
<input matInput type="number" min="1" [(ngModel)]="iouTemplate.nvram" placeholder="NVRAM size" />
<span matSuffix>KB</span>
</mat-form-field>
</mat-expansion-panel>

View File

@ -46,7 +46,7 @@
</mat-select> </mat-form-field
><br />
<mat-form-field class="form-field">
<input matInput type="number" placeholder="RAM" formControlName="ramMemory" ngDefaultControl />
<input matInput type="number" min="1" placeholder="RAM" formControlName="ramMemory" ngDefaultControl />
<span matSuffix>MB</span>
</mat-form-field>
</form>

View File

@ -62,11 +62,11 @@
</mat-select>
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="qemuTemplate.ram" placeholder="RAM" />
<input matInput type="number" min="1" [(ngModel)]="qemuTemplate.ram" placeholder="RAM" />
<span matSuffix>MB</span>
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="qemuTemplate.cpus" placeholder="vCPUs" />
<input matInput type="number" min="1" [(ngModel)]="qemuTemplate.cpus" placeholder="vCPUs" />
</mat-form-field>
<mat-form-field class="form-field">
@ -185,7 +185,7 @@
<mat-panel-title> Network </mat-panel-title>
</mat-expansion-panel-header>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="qemuTemplate.adapters" placeholder="Adapters" />
<input matInput type="number" min="0" [(ngModel)]="qemuTemplate.adapters" placeholder="Adapters" />
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="text" [(ngModel)]="qemuTemplate.first_port_name" placeholder="First port name" />
@ -194,7 +194,7 @@
<input matInput type="text" [(ngModel)]="qemuTemplate.port_name_format" placeholder="Name format" />
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="qemuTemplate.port_segment_size" placeholder="Segment size" />
<input matInput type="number" min="0" [(ngModel)]="qemuTemplate.port_segment_size" placeholder="Segment size" />
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="text" [(ngModel)]="qemuTemplate.mac_address" placeholder="Base MAC" />

View File

@ -95,7 +95,7 @@
<mat-panel-title> Network </mat-panel-title>
</mat-expansion-panel-header>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="vmwareTemplate.adapters" placeholder="Adapters" />
<input matInput type="number" min="0" [(ngModel)]="vmwareTemplate.adapters" placeholder="Adapters" />
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="text" [(ngModel)]="vmwareTemplate.first_port_name" placeholder="First port name" />
@ -104,7 +104,7 @@
<input matInput type="text" [(ngModel)]="vmwareTemplate.port_name_format" placeholder="Name format" />
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="vmwareTemplate.port_segment_size" placeholder="Segment size" />
<input matInput type="number" min="0" [(ngModel)]="vmwareTemplate.port_segment_size" placeholder="Segment size" />
</mat-form-field>
<mat-form-field class="form-field">
<mat-select placeholder="Type" [(ngModel)]="vmwareTemplate.adapter_type">

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<h1 mat-dialog-title>Configurator for ATM switch {{ name }}</h1>
<div class="modal-form-container">
<div class="content">
@ -45,17 +45,17 @@
<form [formGroup]="inputForm">
Source
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="sourcePort" formControlName="sourcePort" placeholder="Port" />
<input matInput type="number" min="0" [(ngModel)]="sourcePort" formControlName="sourcePort" placeholder="Port" />
</mat-form-field>
</form>
<form [formGroup]="abstractForm">
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="sourceVpi" formControlName="sourceVpi" placeholder="VPI" />
<input matInput type="number" min="0" [(ngModel)]="sourceVpi" formControlName="sourceVpi" placeholder="VPI" />
</mat-form-field>
</form>
<form [formGroup]="inputForm">
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="sourceVci" formControlName="sourceVci" placeholder="VCI" />
<input matInput type="number" min="0" [(ngModel)]="sourceVci" formControlName="sourceVci" placeholder="VCI" />
</mat-form-field>
Destination
<mat-form-field class="form-field">

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<h1 mat-dialog-title>Configurator for cloud node {{ name }}</h1>
<div class="modal-form-container">
<div class="content">

View File

@ -33,12 +33,12 @@
</mat-form-field>
<mat-form-field class="form-field">
<input formControlName="memory" matInput type="number" [(ngModel)]="node.properties.memory" placeholder="Maximum memory">
<input formControlName="memory" matInput type="number" min="1" [(ngModel)]="node.properties.memory" placeholder="Maximum memory">
<span matSuffix>MB</span>
</mat-form-field>
<mat-form-field class="form-field">
<input formControlName="cpus" matInput type="number" [(ngModel)]="node.properties.cpus" placeholder="Maximum CPUs">
<input formControlName="cpus" matInput type="number" min="1" [(ngModel)]="node.properties.cpus" placeholder="Maximum CPUs">
</mat-form-field>
<button mat-button class="form-field" (click)="configureCustomAdapters()">

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<h1 mat-dialog-title>Configurator for Ethernet switch {{ name }}</h1>
<div class="modal-form-container">
<div class="content">

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<h1 mat-dialog-title>Configurator for Ethernet hub {{ name }}</h1>
<div class="modal-form-container">
<div class="content">

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<h1 mat-dialog-title>Configurator for IOS router {{ name }}</h1>
<div class="modal-form-container">
<div class="content">

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<h1 mat-dialog-title>Configurator for IOU device {{ name }}</h1>
<div class="modal-form-container">
<div class="content">
@ -22,11 +22,11 @@
<mat-checkbox [(ngModel)]="node.console_auto_start"> Auto start console </mat-checkbox><br />
<mat-checkbox [(ngModel)]="node.properties.use_default_iou_values"> Use default IOU values for memories </mat-checkbox>
<mat-form-field class="form-field" *ngIf="!node.properties.use_default_iou_values">
<input matInput type="number" [(ngModel)]="node.properties.ram" placeholder="RAM size" />
<input matInput type="number" min="1" [(ngModel)]="node.properties.ram" placeholder="RAM size" />
<span matSuffix>MB</span>
</mat-form-field>
<mat-form-field class="form-field" *ngIf="!node.properties.use_default_iou_values">
<input matInput type="number" [(ngModel)]="node.properties.nvram" placeholder="NVRAM size" />
<input matInput type="number" min="1" [(ngModel)]="node.properties.nvram" placeholder="NVRAM size" />
<span matSuffix>KB</span>
</mat-form-field>
</mat-tab>

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<h1 mat-dialog-title>Configurator for NAT node {{ name }}</h1>
<div class="modal-form-container">
<div class="content">

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<h1 mat-dialog-title>Configurator for Qemu VM {{ name }}</h1>
<div class="modal-form-container">
<div class="content">
@ -30,7 +30,7 @@
</mat-form-field>
</form>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="node.properties.cpus" placeholder="vCPUs" />
<input matInput type="number" min="1" [(ngModel)]="node.properties.cpus" placeholder="vCPUs" />
</mat-form-field>
<mat-form-field class="form-field">

View File

@ -97,7 +97,7 @@
<input matInput type="text" [(ngModel)]="qemuImg.path" formControlName="path" placeholder="File location" />
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="qemuImg.size" formControlName="size" placeholder="Disk size" />
<input matInput type="number" min="1" [(ngModel)]="qemuImg.size" formControlName="size" placeholder="Disk size" />
</mat-form-field>
</form>
</mat-card>

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<h1 mat-dialog-title>Configurator for Frame-Relay switch {{ name }}</h1>
<div class="modal-form-container">
<div class="content">
@ -43,10 +43,10 @@
<form [formGroup]="inputForm">
Source
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="sourcePort" formControlName="sourcePort" placeholder="Port" />
<input matInput type="number" min="0" [(ngModel)]="sourcePort" formControlName="sourcePort" placeholder="Port" />
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="sourceDlci" formControlName="sourceDlci" placeholder="DLCI" />
<input matInput type="number" min="1" [(ngModel)]="sourceDlci" formControlName="sourceDlci" placeholder="DLCI" />
</mat-form-field>
Destination
<mat-form-field class="form-field">

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<h1 mat-dialog-title>Configurator for VirtualBox VM {{ name }}</h1>
<div class="modal-form-container">
<div class="content">

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<h1 mat-dialog-title>Configurator for VMware VM {{ name }}</h1>
<div class="modal-form-container">
<div class="content">

View File

@ -1,4 +1,4 @@
<h1 mat-dialog-title>Configurator for node {{ name }}</h1>
<h1 mat-dialog-title>Configurator for VPCS node {{ name }}</h1>
<div class="modal-form-container">
<div class="content">