Commit 04b0bc4c81a5b6701d2111da4975cbd54d2ae8de

Authored by Vladyslav_Prykhodko
1 parent 7801c3d7

UI: Fixed fields length validation for rule nodes and alarm rules

... ... @@ -45,6 +45,9 @@
45 45 <mat-error *ngIf="alarmFormGroup.get('alarmType').hasError('unique')">
46 46 {{ 'device-profile.alarm-type-unique' | translate }}
47 47 </mat-error>
  48 + <mat-error *ngIf="alarmFormGroup.get('alarmType').hasError('maxlength')">
  49 + {{ 'device-profile.alarm-type-max-length' | translate }}
  50 + </mat-error>
48 51 </mat-form-field>
49 52 </div>
50 53 <mat-expansion-panel class="advanced-settings" [expanded]="false">
... ...
... ... @@ -93,7 +93,7 @@ export class DeviceProfileAlarmComponent implements ControlValueAccessor, OnInit
93 93 ngOnInit() {
94 94 this.alarmFormGroup = this.fb.group({
95 95 id: [null, Validators.required],
96   - alarmType: [null, Validators.required],
  96 + alarmType: [null, [Validators.required, Validators.maxLength(255)]],
97 97 createRules: [null],
98 98 clearRule: [null],
99 99 propagate: [null],
... ...
... ... @@ -32,6 +32,9 @@
32 32 || ruleNodeFormGroup.get('name').hasError('pattern')">
33 33 {{ 'rulenode.name-required' | translate }}
34 34 </mat-error>
  35 + <mat-error *ngIf="ruleNodeFormGroup.get('name').hasError('maxlength')">
  36 + {{ 'rulenode.name-max-length' | translate }}
  37 + </mat-error>
35 38 </mat-form-field>
36 39 <mat-checkbox formControlName="debugMode">
37 40 {{ 'rulenode.debug-mode' | translate }}
... ...
... ... @@ -78,7 +78,7 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O
78 78 if (this.ruleNode.component.type !== RuleNodeType.RULE_CHAIN) {
79 79
80 80 this.ruleNodeFormGroup = this.fb.group({
81   - name: [this.ruleNode.name, [Validators.required, Validators.pattern('(.|\\s)*\\S(.|\\s)*')]],
  81 + name: [this.ruleNode.name, [Validators.required, Validators.pattern('(.|\\s)*\\S(.|\\s)*'), Validators.maxLength(255)]],
82 82 debugMode: [this.ruleNode.debugMode, []],
83 83 configuration: [this.ruleNode.configuration, [Validators.required]],
84 84 additionalInfo: this.fb.group(
... ...
... ... @@ -1169,6 +1169,7 @@
1169 1169 "alarm-type": "Alarm type",
1170 1170 "alarm-type-required": "Alarm type is required.",
1171 1171 "alarm-type-unique": "Alarm type must be unique within the device profile alarm rules.",
  1172 + "alarm-type-max-length": "Alarm type should be less than 256",
1172 1173 "create-alarm-pattern": "Create <b>{{alarmType}}</b> alarm",
1173 1174 "create-alarm-rules": "Create alarm rules",
1174 1175 "no-create-alarm-rules": "No create conditions configured",
... ... @@ -2578,6 +2579,7 @@
2578 2579 "add": "Add rule node",
2579 2580 "name": "Name",
2580 2581 "name-required": "Name is required.",
  2582 + "name-max-length": "Name should be less than 256",
2581 2583 "type": "Type",
2582 2584 "description": "Description",
2583 2585 "delete": "Delete rule node",
... ...