From 276c3064b029c3103268192b1d32cc743321e277 Mon Sep 17 00:00:00 2001 From: ArtemDzhereleiko Date: Fri, 2 Jan 2026 16:38:27 +0200 Subject: [PATCH 1/2] UI: Preview for argument table --- ...ulated-field-argument-panel.component.html | 16 ++++--- ...lculated-field-argument-panel.component.ts | 6 +++ ...lated-field-arguments-table.component.html | 43 ++++++++++++------- ...culated-field-arguments-table.component.ts | 3 +- ...eofencing-zone-groups-panel.component.html | 16 ++++--- ...-geofencing-zone-groups-panel.component.ts | 5 +++ ...eofencing-zone-groups-table.component.html | 39 +++++++++++------ ...-geofencing-zone-groups-table.component.ts | 3 +- ...culated-field-metrics-panel.component.html | 20 +++++---- ...alculated-field-metrics-panel.component.ts | 7 ++- ...culated-field-metrics-table.component.html | 29 +++++++++---- ...alculated-field-metrics-table.component.ts | 5 ++- .../assets/locale/locale.constant-en_US.json | 1 + 13 files changed, 126 insertions(+), 67 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.html index 30533dc714..484f1f9238 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.html @@ -188,13 +188,15 @@ (click)="cancel()"> {{ 'action.cancel' | translate }} - + @if (!readonly) { + + } diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.ts index 51d14c9478..d6271409f8 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.ts @@ -88,6 +88,7 @@ export class CalculatedFieldArgumentPanelComponent implements OnInit, AfterViewI maxlength: 'calculated-fields.hint.argument-name-max-length', forbidden: 'calculated-fields.hint.argument-name-forbidden' }; + @Input() readonly = false; @ViewChild('entityAutocomplete') entityAutocomplete: EntityAutocompleteComponent; @@ -176,6 +177,11 @@ export class CalculatedFieldArgumentPanelComponent implements OnInit, AfterViewI this.argumentTypes = Object.values(ArgumentType) .filter(type => type !== ArgumentType.Rolling || this.isScript); + + if (this.readonly) { + this.argumentType.disable({emitEvent: false}); + this.argumentFormGroup.disable({emitEvent: false}); + } } ngAfterViewInit(): void { 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 99b4225db2..c61ce4c467 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,22 +93,33 @@
- + @if (disable) { + + } @else { + + } - + @if (!readonly) { + + }
diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.ts index 3484e717cb..9216eaa12c 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.ts @@ -71,6 +71,7 @@ export class CalculatedFieldGeofencingZoneGroupsPanelComponent implements OnInit @Input() entityName: string; @Input() ownerId: EntityId; @Input() usedNames: string[]; + @Input() readonly = false; @ViewChild('entityAutocomplete') entityAutocomplete: EntityAutocompleteComponent; @@ -160,6 +161,10 @@ export class CalculatedFieldGeofencingZoneGroupsPanelComponent implements OnInit this.currentEntityFilter = getCalculatedFieldCurrentEntityFilter(this.entityName, this.entityId); this.updateEntityFilter(this.zone.refEntityId?.entityType); + + if (this.readonly) { + this.geofencingFormGroup.disable({emitEvent: false}); + } } fetchOptions(searchText: string): Observable> { 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 fa0ba32f22..d661f5021a 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,20 +96,31 @@
- + @if (disable) { + + } @else { + + } @@ -119,7 +119,7 @@
@@ -213,12 +213,14 @@ (click)="cancel()"> {{ 'action.cancel' | translate }} - + @if (!readonly) { + + } diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-panel.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-panel.component.ts index 811f7b87fa..49dca514d2 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-panel.component.ts @@ -42,7 +42,7 @@ interface CalculatedFieldAggMetricValuePanel extends CalculatedFieldAggMetricVal @Component({ selector: 'tb-calculated-field-metrics-panel', templateUrl: './calculated-field-metrics-panel.component.html', - styleUrl: '../common/calculated-field-panel.scss', + styleUrls: ['../common/calculated-field-panel.scss', '../../calculated-field.component.scss'], }) export class CalculatedFieldMetricsPanelComponent implements OnInit { @@ -54,6 +54,7 @@ export class CalculatedFieldMetricsPanelComponent implements OnInit { @Input() editorCompleter: TbEditorCompleter; @Input() highlightRules: AceHighlightRules; @Input({required: true}) testScript: (expression?: string) => Observable; + @Input() readonly = false; metricDataApplied = output(); filterExpanded = false; @@ -107,6 +108,10 @@ export class CalculatedFieldMetricsPanelComponent implements OnInit { if (this.simpleMode) { this.AggFunctions = this.AggFunctions.filter(aggFunc => aggFunc !== AggFunction.COUNT_UNIQUE); } + + if (this.readonly) { + this.metricForm.disable({emitEvent: false}); + } } saveMetric(): void { diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-table.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-table.component.html index 4693d3afb4..3b50b9e152 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-table.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-table.component.html @@ -93,15 +93,26 @@
- + @if (disable) { + + } @else { + + }