-
+ @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 {
+
+ }