UI: Fixed fields length validation for rule nodes and alarm rules
This commit is contained in:
parent
7801c3d7aa
commit
04b0bc4c81
@ -45,6 +45,9 @@
|
|||||||
<mat-error *ngIf="alarmFormGroup.get('alarmType').hasError('unique')">
|
<mat-error *ngIf="alarmFormGroup.get('alarmType').hasError('unique')">
|
||||||
{{ 'device-profile.alarm-type-unique' | translate }}
|
{{ 'device-profile.alarm-type-unique' | translate }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
|
<mat-error *ngIf="alarmFormGroup.get('alarmType').hasError('maxlength')">
|
||||||
|
{{ 'device-profile.alarm-type-max-length' | translate }}
|
||||||
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<mat-expansion-panel class="advanced-settings" [expanded]="false">
|
<mat-expansion-panel class="advanced-settings" [expanded]="false">
|
||||||
|
|||||||
@ -93,7 +93,7 @@ export class DeviceProfileAlarmComponent implements ControlValueAccessor, OnInit
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.alarmFormGroup = this.fb.group({
|
this.alarmFormGroup = this.fb.group({
|
||||||
id: [null, Validators.required],
|
id: [null, Validators.required],
|
||||||
alarmType: [null, Validators.required],
|
alarmType: [null, [Validators.required, Validators.maxLength(255)]],
|
||||||
createRules: [null],
|
createRules: [null],
|
||||||
clearRule: [null],
|
clearRule: [null],
|
||||||
propagate: [null],
|
propagate: [null],
|
||||||
|
|||||||
@ -32,6 +32,9 @@
|
|||||||
|| ruleNodeFormGroup.get('name').hasError('pattern')">
|
|| ruleNodeFormGroup.get('name').hasError('pattern')">
|
||||||
{{ 'rulenode.name-required' | translate }}
|
{{ 'rulenode.name-required' | translate }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
|
<mat-error *ngIf="ruleNodeFormGroup.get('name').hasError('maxlength')">
|
||||||
|
{{ 'rulenode.name-max-length' | translate }}
|
||||||
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-checkbox formControlName="debugMode">
|
<mat-checkbox formControlName="debugMode">
|
||||||
{{ 'rulenode.debug-mode' | translate }}
|
{{ 'rulenode.debug-mode' | translate }}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O
|
|||||||
if (this.ruleNode.component.type !== RuleNodeType.RULE_CHAIN) {
|
if (this.ruleNode.component.type !== RuleNodeType.RULE_CHAIN) {
|
||||||
|
|
||||||
this.ruleNodeFormGroup = this.fb.group({
|
this.ruleNodeFormGroup = this.fb.group({
|
||||||
name: [this.ruleNode.name, [Validators.required, Validators.pattern('(.|\\s)*\\S(.|\\s)*')]],
|
name: [this.ruleNode.name, [Validators.required, Validators.pattern('(.|\\s)*\\S(.|\\s)*'), Validators.maxLength(255)]],
|
||||||
debugMode: [this.ruleNode.debugMode, []],
|
debugMode: [this.ruleNode.debugMode, []],
|
||||||
configuration: [this.ruleNode.configuration, [Validators.required]],
|
configuration: [this.ruleNode.configuration, [Validators.required]],
|
||||||
additionalInfo: this.fb.group(
|
additionalInfo: this.fb.group(
|
||||||
|
|||||||
@ -1169,6 +1169,7 @@
|
|||||||
"alarm-type": "Alarm type",
|
"alarm-type": "Alarm type",
|
||||||
"alarm-type-required": "Alarm type is required.",
|
"alarm-type-required": "Alarm type is required.",
|
||||||
"alarm-type-unique": "Alarm type must be unique within the device profile alarm rules.",
|
"alarm-type-unique": "Alarm type must be unique within the device profile alarm rules.",
|
||||||
|
"alarm-type-max-length": "Alarm type should be less than 256",
|
||||||
"create-alarm-pattern": "Create <b>{{alarmType}}</b> alarm",
|
"create-alarm-pattern": "Create <b>{{alarmType}}</b> alarm",
|
||||||
"create-alarm-rules": "Create alarm rules",
|
"create-alarm-rules": "Create alarm rules",
|
||||||
"no-create-alarm-rules": "No create conditions configured",
|
"no-create-alarm-rules": "No create conditions configured",
|
||||||
@ -2578,6 +2579,7 @@
|
|||||||
"add": "Add rule node",
|
"add": "Add rule node",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"name-required": "Name is required.",
|
"name-required": "Name is required.",
|
||||||
|
"name-max-length": "Name should be less than 256",
|
||||||
"type": "Type",
|
"type": "Type",
|
||||||
"description": "Description",
|
"description": "Description",
|
||||||
"delete": "Delete rule node",
|
"delete": "Delete rule node",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user