Browse Source

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

pull/5526/head
Vladyslav_Prykhodko 5 years ago
parent
commit
04b0bc4c81
  1. 3
      ui-ngx/src/app/modules/home/components/profile/alarm/device-profile-alarm.component.html
  2. 2
      ui-ngx/src/app/modules/home/components/profile/alarm/device-profile-alarm.component.ts
  3. 3
      ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html
  4. 2
      ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts
  5. 2
      ui-ngx/src/assets/locale/locale.constant-en_US.json

3
ui-ngx/src/app/modules/home/components/profile/alarm/device-profile-alarm.component.html

@ -45,6 +45,9 @@
<mat-error *ngIf="alarmFormGroup.get('alarmType').hasError('unique')">
{{ 'device-profile.alarm-type-unique' | translate }}
</mat-error>
<mat-error *ngIf="alarmFormGroup.get('alarmType').hasError('maxlength')">
{{ 'device-profile.alarm-type-max-length' | translate }}
</mat-error>
</mat-form-field>
</div>
<mat-expansion-panel class="advanced-settings" [expanded]="false">

2
ui-ngx/src/app/modules/home/components/profile/alarm/device-profile-alarm.component.ts

@ -93,7 +93,7 @@ export class DeviceProfileAlarmComponent implements ControlValueAccessor, OnInit
ngOnInit() {
this.alarmFormGroup = this.fb.group({
id: [null, Validators.required],
alarmType: [null, Validators.required],
alarmType: [null, [Validators.required, Validators.maxLength(255)]],
createRules: [null],
clearRule: [null],
propagate: [null],

3
ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html

@ -32,6 +32,9 @@
|| ruleNodeFormGroup.get('name').hasError('pattern')">
{{ 'rulenode.name-required' | translate }}
</mat-error>
<mat-error *ngIf="ruleNodeFormGroup.get('name').hasError('maxlength')">
{{ 'rulenode.name-max-length' | translate }}
</mat-error>
</mat-form-field>
<mat-checkbox formControlName="debugMode">
{{ 'rulenode.debug-mode' | translate }}

2
ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts

@ -78,7 +78,7 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O
if (this.ruleNode.component.type !== RuleNodeType.RULE_CHAIN) {
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, []],
configuration: [this.ruleNode.configuration, [Validators.required]],
additionalInfo: this.fb.group(

2
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -1169,6 +1169,7 @@
"alarm-type": "Alarm type",
"alarm-type-required": "Alarm type is required.",
"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-rules": "Create alarm rules",
"no-create-alarm-rules": "No create conditions configured",
@ -2578,6 +2579,7 @@
"add": "Add rule node",
"name": "Name",
"name-required": "Name is required.",
"name-max-length": "Name should be less than 256",
"type": "Type",
"description": "Description",
"delete": "Delete rule node",

Loading…
Cancel
Save