From 8668757459feca8b5792662d2dacd07b0bf94e74 Mon Sep 17 00:00:00 2001 From: Maryam Saeidi Date: Tue, 12 Nov 2024 13:01:36 +0100 Subject: [PATCH] [Custom threshold] Fix the custom equation label on the preview lens chart (#199618) Fixes #181876 ## Summary This PR fixes the custom equation label on the preview lens chart. |With label|Without label|With group by field| |---|---|---| |![image](https://github.com/user-attachments/assets/b4f1a1e7-8e67-4b24-ae48-379fe393f90a)|![image](https://github.com/user-attachments/assets/3ef2733f-9ce8-4b37-8ecf-c19c1371aced)|![image](https://github.com/user-attachments/assets/d638f49e-98e2-4df7-8852-84dc62b9f739)| --- .../components/rule_condition_chart/rule_condition_chart.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/observability_solution/observability/public/components/rule_condition_chart/rule_condition_chart.tsx b/x-pack/plugins/observability_solution/observability/public/components/rule_condition_chart/rule_condition_chart.tsx index 407637520dda7..4567d7c37b10b 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/rule_condition_chart/rule_condition_chart.tsx +++ b/x-pack/plugins/observability_solution/observability/public/components/rule_condition_chart/rule_condition_chart.tsx @@ -68,6 +68,7 @@ export interface RuleConditionChartExpressions { timeSize?: number; timeUnit?: TimeUnitChar; equation?: string; + label?: string; } export interface RuleConditionChartProps { metricExpression: RuleConditionChartExpressions; @@ -108,6 +109,7 @@ export function RuleConditionChart({ threshold, comparator, equation, + label, warningComparator, warningThreshold, } = metricExpression; @@ -332,7 +334,7 @@ export function RuleConditionChart({ const baseLayer = { type: 'formula', value: formula, - label: formula, + label: label ?? formula, groupBy, format: { id: formatId, @@ -409,6 +411,7 @@ export function RuleConditionChart({ comparator, dataView, equation, + label, searchConfiguration, formula, formulaAsync.value,