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 47f2e2e5be..7b1f13756c 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 @@ -79,6 +79,7 @@ [entityId]="entityId" [tenantId]="tenantId" [ownerId]="ownerId" + [isEditValue]="isEditValue" [watchKeyChange]="true" [entityName]="entityName"/> @@ -97,14 +98,16 @@ - + @if (isEditValue) { + + }
alarm-rule.no-clear-alarm-rule diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.ts b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.ts index 6f28a01088..dbb5693d52 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.ts +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.ts @@ -53,7 +53,7 @@ import { EntityService } from '@core/http/entity.service'; @Component({ selector: 'tb-alarm-rules', templateUrl: './alarm-rules.component.html', - styleUrls: [] + styleUrls: ['./alarm-rule-dialog.component.scss'] }) export class AlarmRulesComponent extends EntityComponent { @@ -175,7 +175,8 @@ export class AlarmRulesComponent extends EntityComponent
@@ -75,7 +76,7 @@ matTooltip="{{ 'calculated-fields.test-script-function' | translate }}" matTooltipPosition="above" class="tb-mat-32" - [disabled]="!argumentsList.length" + [disabled]="!argumentsList.length || readonly" (click)="onTestScript($event)"> bug_report @@ -84,7 +85,7 @@ @@ -111,7 +112,7 @@ required> } @else { - {{ 'alarm-rule.no-filter-preview' | translate }} + {{ 'alarm-rule.no-filter-preview' | translate }} } @@ -135,7 +136,7 @@ {{ 'alarm-rule.condition-type-hint' | translate }} } - @if (conditionFormGroup.get('type').value == AlarmConditionType.DURATION) { + @if (conditionFormGroup.get('type').value === AlarmConditionType.DURATION) {
{{ 'alarm-rule.value' | translate }}
@@ -167,7 +168,7 @@
- } @else if (conditionFormGroup.get('type').value == AlarmConditionType.REPEATING) { + } @else if (conditionFormGroup.get('type').value === AlarmConditionType.REPEATING) {
{{ 'alarm-rule.value' | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.ts b/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.ts index b957428169..f39ed364fd 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.ts @@ -196,6 +196,10 @@ export class CfAlarmRuleConditionDialogComponent extends DialogComponent -
@@ -63,7 +63,7 @@
-
+
@@ -90,7 +90,7 @@
-
diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/create-cf-alarm-rules.component.html b/ui-ngx/src/app/modules/home/components/alarm-rules/create-cf-alarm-rules.component.html index 8e265f5033..18ac406c97 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/create-cf-alarm-rules.component.html +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/create-cf-alarm-rules.component.html @@ -48,7 +48,7 @@
} @if (!createAlarmRulesFormArray().controls.length) { - + alarm-rule.add-create-alarm-rule-prompt } diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-complex-filter-predicate-dialog.component.html b/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-complex-filter-predicate-dialog.component.html index 194e1cb715..5ca3cde37b 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-complex-filter-predicate-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-complex-filter-predicate-dialog.component.html @@ -52,10 +52,12 @@ cdkFocusInitial> {{'action.cancel' | translate }} - + @if (!readonly) { + + } diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-complex-filter-predicate-dialog.component.ts b/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-complex-filter-predicate-dialog.component.ts index 1d649882e6..017cefb890 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-complex-filter-predicate-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-complex-filter-predicate-dialog.component.ts @@ -36,6 +36,7 @@ export interface AlarmRuleComplexFilterPredicateDialogData { valueType: EntityKeyValueType; arguments: Record; argumentInUse: string; + readonly: boolean; } @Component({ @@ -63,6 +64,8 @@ export class AlarmRuleComplexFilterPredicateDialogComponent extends arguments = this.data.arguments; + readonly = this.data.readonly; + constructor(protected store: Store, protected router: Router, @Inject(MAT_DIALOG_DATA) public data: AlarmRuleComplexFilterPredicateDialogData, @@ -73,6 +76,10 @@ export class AlarmRuleComplexFilterPredicateDialogComponent extends this.isAdd = this.data.isAdd; this.complexFilterFormGroup.patchValue(this.data.complexPredicate, {emitEvent: false}); + + if (this.readonly) { + this.complexFilterFormGroup.disable({emitEvent: false}); + } } cancel(): void { diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-dialog.component.html b/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-dialog.component.html index 182e64da89..8f6cd68c6a 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-dialog.component.html @@ -46,7 +46,7 @@ } - + filter.value-type.value-type @@ -93,10 +93,12 @@ cdkFocusInitial> {{ 'action.cancel' | translate }} - + @if (!readonly) { + + } diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-dialog.component.ts b/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-dialog.component.ts index 7ca1e744d1..ba3adc1695 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-dialog.component.ts @@ -39,6 +39,7 @@ isAdd: boolean; arguments: Record; usedArguments: Array; + readonly: boolean; } @Component({ @@ -66,6 +67,8 @@ export class AlarmRuleFilterDialogComponent extends DialogComponent; + readonly = this.data.readonly; + constructor(protected store: Store, protected router: Router, @Inject(MAT_DIALOG_DATA) public data: AlarmRuleFilterDialogData, @@ -114,6 +117,10 @@ export class AlarmRuleFilterDialogComponent extends DialogComponent
-
{{ filterControl.value?.argument }}
-
{{ FilterPredicateTypeTranslationMap.get(filterControl.value?.valueType) | translate }}
+
{{ filterControl.value?.argument }}
+
{{ FilterPredicateTypeTranslationMap.get(filterControl.value?.valueType) | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate.component.ts b/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate.component.ts index 006c0129e4..77cc962747 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate.component.ts +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/filter/alarm-rule-filter-predicate.component.ts @@ -203,6 +203,7 @@ export class AlarmRuleFilterPredicateComponent implements ControlValueAccessor, isAdd: false, arguments: this.arguments, argumentInUse: this.argumentInUse, + readonly: this.disabled } }).afterClosed().subscribe( (result) => { 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 3fa48395a9..39692168aa 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 @@ -101,6 +101,7 @@ [entityName]="entityName" [ownerId]="ownerId" [tenantId]="tenantId" + [isEditValue]="isEditValue" > } @case (CalculatedFieldType.PROPAGATION) { @@ -111,6 +112,7 @@ [tenantId]="tenantId" [ownerId]="ownerId" [testScript]="onTestScript.bind(this)" + [isEditValue]="isEditValue" > } @case (CalculatedFieldType.RELATED_ENTITIES_AGGREGATION) { @@ -120,6 +122,7 @@ [entityName]="entityName" [tenantId]="tenantId" [testScript]="onTestScript.bind(this)" + [isEditValue]="isEditValue" > } @case (CalculatedFieldType.ENTITY_AGGREGATION) { @@ -128,6 +131,7 @@ [entityId]="entityId" [entityName]="entityName" [tenantId]="tenantId" + [isEditValue]="isEditValue" > } @default { @@ -139,6 +143,7 @@ [tenantId]="tenantId" [isScript]="entityForm.get('type').value === CalculatedFieldType.SCRIPT" [testScript]="onTestScript.bind(this)" + [isEditValue]="isEditValue" > } } diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.html index d726dadcda..fc3c6ac7b3 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.html @@ -93,7 +93,7 @@
- @if (disable) { + @if (!isEditValue) {
diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.ts index 719e1a0103..11c95352d3 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Component, forwardRef, Input } from '@angular/core'; +import { booleanAttribute, Component, forwardRef, Input } from '@angular/core'; import { ControlValueAccessor, FormBuilder, @@ -87,6 +87,8 @@ export class EntityAggregationComponentComponent implements ControlValueAccessor @Input() testScript: (expression?: string) => Observable; + @Input({transform: booleanAttribute}) isEditValue = true; + readonly minAllowedAggregationIntervalInSecForCF = getCurrentAuthState(this.store).minAllowedAggregationIntervalInSecForCF; readonly intermediateAggregationIntervalInSecForCF = getCurrentAuthState(this.store).intermediateAggregationIntervalInSecForCF; readonly DayInSec = DAY / SECOND; diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.html index 20d6cd3f1c..92fded8a99 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.html @@ -96,7 +96,7 @@
- @if (disable) { + @if (!isEditValue) {