From 91216537a816d32ff3f34f177cf82370ab050b85 Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Wed, 4 Mar 2026 14:24:46 +0100 Subject: [PATCH 1/4] Fixed CF name validation --- .../dialog/calculated-field-dialog.component.html | 6 ------ .../dialog/calculated-field-dialog.component.ts | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html index f5f009b320..38c6991c1f 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html @@ -38,8 +38,6 @@ @if (fieldFormGroup.get('name').hasError('required')) { {{ 'common.hint.title-required' | translate }} - } @else if (fieldFormGroup.get('name').hasError('pattern')) { - {{ 'common.hint.title-pattern' | translate }} } @else if (fieldFormGroup.get('name').hasError('maxlength')) { {{ 'common.hint.title-max-length' | translate }} } @@ -89,8 +87,6 @@ @if (configFormGroup.get('expressionSIMPLE').hasError('required')) { {{ 'calculated-fields.hint.expression-required' | translate }} - } @else if (configFormGroup.get('expressionSIMPLE').hasError('pattern')) { - {{ 'calculated-fields.hint.expression-invalid' | translate }} } @else if (configFormGroup.get('expressionSIMPLE').hasError('maxLength')) { {{ 'calculated-fields.hint.expression-max-length' | translate }} } @@ -173,8 +169,6 @@ @if (outputFormGroup.get('name').hasError('required')) { {{ 'common.hint.key-required' | translate }} - } @else if (outputFormGroup.get('name').hasError('pattern')) { - {{ 'common.hint.key-pattern' | translate }} } @else if (outputFormGroup.get('name').hasError('maxlength')) { {{ 'common.hint.key-max-length' | translate }} } diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts index 5a4cc6cedb..3dcc759fc4 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts @@ -33,7 +33,7 @@ import { OutputType, OutputTypeTranslations } from '@shared/models/calculated-field.models'; -import { digitsRegex, oneSpaceInsideRegex } from '@shared/models/regex.constants'; +import { digitsRegex } from '@shared/models/regex.constants'; import { AttributeScope } from '@shared/models/telemetry/telemetry.models'; import { EntityType } from '@shared/models/entity-type.models'; import { map, startWith, switchMap } from 'rxjs/operators'; @@ -65,15 +65,15 @@ export interface CalculatedFieldDialogData { export class CalculatedFieldDialogComponent extends DialogComponent { fieldFormGroup = this.fb.group({ - name: ['', [Validators.required, Validators.pattern(oneSpaceInsideRegex), Validators.maxLength(255)]], + name: ['', [Validators.required, Validators.maxLength(255)]], type: [CalculatedFieldType.SIMPLE], debugSettings: [], configuration: this.fb.group({ arguments: this.fb.control({}), - expressionSIMPLE: ['', [Validators.required, Validators.pattern(oneSpaceInsideRegex), Validators.maxLength(255)]], + expressionSIMPLE: ['', [Validators.required, Validators.maxLength(255)]], expressionSCRIPT: [calculatedFieldDefaultScript], output: this.fb.group({ - name: ['', [Validators.required, Validators.pattern(oneSpaceInsideRegex), Validators.maxLength(255)]], + name: ['', [Validators.required, Validators.maxLength(255)]], scope: [{ value: AttributeScope.SERVER_SCOPE, disabled: true }], type: [OutputType.Timeseries], decimalsByDefault: [null as number, [Validators.min(0), Validators.max(15), Validators.pattern(digitsRegex)]], From 61d4fa6f575ca0cc1f39fd82a7edfbb5499a1950 Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Wed, 4 Mar 2026 14:45:22 +0100 Subject: [PATCH 2/4] Removed pattern validation from name field on CF and Alarm rules --- ui-ngx/src/app/core/services/calculated-field-form.service.ts | 4 ++-- .../components/alarm-rules/alarm-rule-dialog.component.html | 2 -- .../home/components/alarm-rules/alarm-rules.component.html | 2 -- .../calculated-fields/calculated-field.component.html | 2 -- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/ui-ngx/src/app/core/services/calculated-field-form.service.ts b/ui-ngx/src/app/core/services/calculated-field-form.service.ts index 1bedbf99a7..404676d383 100644 --- a/ui-ngx/src/app/core/services/calculated-field-form.service.ts +++ b/ui-ngx/src/app/core/services/calculated-field-form.service.ts @@ -38,7 +38,7 @@ export class CalculatedFieldFormService { buildForm(): FormGroup { return this.fb.group({ - name: ['', [Validators.required, Validators.pattern(oneSpaceInsideRegex), Validators.maxLength(255)]], + name: ['', [Validators.required, Validators.maxLength(255)]], entityId: [null, Validators.required], type: [CalculatedFieldType.SIMPLE], debugSettings: [], @@ -48,7 +48,7 @@ export class CalculatedFieldFormService { buildAlarmRuleForm(): FormGroup { return this.fb.group({ - name: ['', [Validators.required, Validators.pattern(oneSpaceInsideRegex), Validators.maxLength(255)]], + name: ['', [Validators.required, Validators.maxLength(255)]], entityId: [null, Validators.required], type: [CalculatedFieldType.ALARM], debugSettings: [], diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.html b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.html index 3b5379a9d9..27c7ecf63e 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.html @@ -40,8 +40,6 @@ @if (fieldFormGroup.get('name').hasError('required')) { {{ 'alarm-rule.alarm-type-required' | translate }} - } @else if (fieldFormGroup.get('name').hasError('pattern')) { - {{ 'alarm-rule.alarm-type-pattern' | translate }} } @else if (fieldFormGroup.get('name').hasError('maxlength')) { {{ 'alarm-rule.alarm-type-max-length' | translate }} } diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.html b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.html index 7b1f13756c..c7fd7da063 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.html +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.html @@ -47,8 +47,6 @@ @if (entityForm.get('name').hasError('required')) { {{ 'common.hint.title-required' | translate }} - } @else if (entityForm.get('name').hasError('pattern')) { - {{ 'common.hint.title-pattern' | translate }} } @else if (entityForm.get('name').hasError('maxlength')) { {{ 'common.hint.title-max-length' | translate }} } diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.html index 39692168aa..9eb8680594 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.html @@ -47,8 +47,6 @@ @if (entityForm.get('name').hasError('required')) { {{ 'common.hint.title-required' | translate }} - } @else if (entityForm.get('name').hasError('pattern')) { - {{ 'common.hint.title-pattern' | translate }} } @else if (entityForm.get('name').hasError('maxlength')) { {{ 'common.hint.title-max-length' | translate }} } From 08f39aa35c25447cd08b5b07cb278dcfc39359fb Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Wed, 4 Mar 2026 16:19:04 +0100 Subject: [PATCH 3/4] Fix merge miss --- .../components/dialog/calculated-field-dialog.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts index 52e1c0f3de..4e37e67c71 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts @@ -29,8 +29,6 @@ import { calculatedFieldTypes, CalculatedFieldTypeTranslations } from '@shared/models/calculated-field.models'; -import { digitsRegex } from '@shared/models/regex.constants'; -import { AttributeScope } from '@shared/models/telemetry/telemetry.models'; import { EntityType } from '@shared/models/entity-type.models'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { CalculatedFieldsService } from '@core/http/calculated-fields.service'; From 2ece50e03b9ce78fc1be5c47671513b7430cadda Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Wed, 4 Mar 2026 14:24:46 +0100 Subject: [PATCH 4/4] Fixed CF name validation --- .../dialog/calculated-field-dialog.component.html | 6 ------ .../dialog/calculated-field-dialog.component.ts | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html index f5f009b320..38c6991c1f 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html @@ -38,8 +38,6 @@ @if (fieldFormGroup.get('name').hasError('required')) { {{ 'common.hint.title-required' | translate }} - } @else if (fieldFormGroup.get('name').hasError('pattern')) { - {{ 'common.hint.title-pattern' | translate }} } @else if (fieldFormGroup.get('name').hasError('maxlength')) { {{ 'common.hint.title-max-length' | translate }} } @@ -89,8 +87,6 @@ @if (configFormGroup.get('expressionSIMPLE').hasError('required')) { {{ 'calculated-fields.hint.expression-required' | translate }} - } @else if (configFormGroup.get('expressionSIMPLE').hasError('pattern')) { - {{ 'calculated-fields.hint.expression-invalid' | translate }} } @else if (configFormGroup.get('expressionSIMPLE').hasError('maxLength')) { {{ 'calculated-fields.hint.expression-max-length' | translate }} } @@ -173,8 +169,6 @@ @if (outputFormGroup.get('name').hasError('required')) { {{ 'common.hint.key-required' | translate }} - } @else if (outputFormGroup.get('name').hasError('pattern')) { - {{ 'common.hint.key-pattern' | translate }} } @else if (outputFormGroup.get('name').hasError('maxlength')) { {{ 'common.hint.key-max-length' | translate }} } diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts index 5a4cc6cedb..3dcc759fc4 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts @@ -33,7 +33,7 @@ import { OutputType, OutputTypeTranslations } from '@shared/models/calculated-field.models'; -import { digitsRegex, oneSpaceInsideRegex } from '@shared/models/regex.constants'; +import { digitsRegex } from '@shared/models/regex.constants'; import { AttributeScope } from '@shared/models/telemetry/telemetry.models'; import { EntityType } from '@shared/models/entity-type.models'; import { map, startWith, switchMap } from 'rxjs/operators'; @@ -65,15 +65,15 @@ export interface CalculatedFieldDialogData { export class CalculatedFieldDialogComponent extends DialogComponent { fieldFormGroup = this.fb.group({ - name: ['', [Validators.required, Validators.pattern(oneSpaceInsideRegex), Validators.maxLength(255)]], + name: ['', [Validators.required, Validators.maxLength(255)]], type: [CalculatedFieldType.SIMPLE], debugSettings: [], configuration: this.fb.group({ arguments: this.fb.control({}), - expressionSIMPLE: ['', [Validators.required, Validators.pattern(oneSpaceInsideRegex), Validators.maxLength(255)]], + expressionSIMPLE: ['', [Validators.required, Validators.maxLength(255)]], expressionSCRIPT: [calculatedFieldDefaultScript], output: this.fb.group({ - name: ['', [Validators.required, Validators.pattern(oneSpaceInsideRegex), Validators.maxLength(255)]], + name: ['', [Validators.required, Validators.maxLength(255)]], scope: [{ value: AttributeScope.SERVER_SCOPE, disabled: true }], type: [OutputType.Timeseries], decimalsByDefault: [null as number, [Validators.min(0), Validators.max(15), Validators.pattern(digitsRegex)]],