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 1ffa7ccf77..c7eeaa253b 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 @@ -16,7 +16,7 @@ -->
-
{{ 'calculated-fields.metrics.metric-settings' | translate }}
+
{{ 'calculated-fields.argument-settings' | translate }}
@if (hint) {
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 94e2967d23..555fc35f0c 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 @@ -88,7 +88,7 @@ -
+
diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/related-entities-aggregation-configuration/calculated-field-metrics-panel.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/related-entities-aggregation-configuration/calculated-field-metrics-panel.component.ts index 79f727cca7..d21db8ece9 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/related-entities-aggregation-configuration/calculated-field-metrics-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/related-entities-aggregation-configuration/calculated-field-metrics-panel.component.ts @@ -25,10 +25,8 @@ import { AggInputTypeTranslations, CalculatedFieldAggMetricValue } from '@shared/models/calculated-field.models'; -import { map } from 'rxjs/operators'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { EntityFilter } from '@shared/models/query/query.models'; -import { Observable, of } from 'rxjs'; import { ScriptLanguage } from '@shared/models/rule-node.models'; import { TbEditorCompleter } from '@shared/models/ace/completion.models'; import { AceHighlightRules } from '@shared/models/ace/ace.models'; @@ -93,13 +91,22 @@ export class CalculatedFieldMetricsPanelComponent implements OnInit { this.validateFilter(data.allowFilter); this.validateInputTypeFilter(data.input?.type ?? AggInputType.key); + this.validateInputKey(); this.functionArgs = ['ctx', ...this.arguments]; } - fetchOptions(searchText: string): Observable> { - const search = searchText ? searchText?.toLowerCase() : ''; - return of(this.arguments).pipe(map(name => name?.filter(option => option.toLowerCase().includes(search)))); + saveMetric(): void { + const value = this.metricForm.value as CalculatedFieldAggMetricValuePanel; + if (!value.allowFilter) { + delete value.filter; + } + delete value.allowFilter; + this.metricDataApplied.emit(value); + } + + cancel(): void { + this.popover.hide(); } private observeFilterAllowChange(): void { @@ -134,17 +141,11 @@ export class CalculatedFieldMetricsPanelComponent implements OnInit { } } - saveZone(): void { - const value = this.metricForm.value as CalculatedFieldAggMetricValuePanel; - if (!value.allowFilter) { - delete value.filter; + private validateInputKey() { + if (this.metric.input?.type === AggInputType.key && !this.arguments.includes(this.metric.input.key)) { + this.metricForm.get('input.key').setValue(null); + this.metricForm.get('input.key').markAsTouched(); } - delete value.allowFilter; - this.metricDataApplied.emit(value); - } - - cancel(): void { - this.popover.hide(); } private uniqNameRequired(): ValidatorFn { diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/related-entities-aggregation-configuration/calculated-field-metrics-table.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/related-entities-aggregation-configuration/calculated-field-metrics-table.component.html index 31483c81ef..4e05a0bbd5 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/related-entities-aggregation-configuration/calculated-field-metrics-table.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/related-entities-aggregation-configuration/calculated-field-metrics-table.component.html @@ -64,7 +64,7 @@ -
+