From 2e3292dbd3cbc387717334a51e26cfcd08e3bacf Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Fri, 9 Sep 2022 14:30:58 +0200 Subject: [PATCH] CloudWatch: Fix display name of metric and namespace (#54860) (#54971) * convert value to option * add unit test * fix lint issue (cherry picked from commit a37fa758a20bc0783cc273adc797f309f1cb7271) Co-authored-by: Erik Sundell --- .../MetricStatEditor/MetricStatEditor.test.tsx | 10 ++++++++++ .../components/MetricStatEditor/MetricStatEditor.tsx | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/cloudwatch/components/MetricStatEditor/MetricStatEditor.test.tsx b/public/app/plugins/datasource/cloudwatch/components/MetricStatEditor/MetricStatEditor.test.tsx index 724462840e7..5ad6019fc2b 100644 --- a/public/app/plugins/datasource/cloudwatch/components/MetricStatEditor/MetricStatEditor.test.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/MetricStatEditor/MetricStatEditor.test.tsx @@ -191,4 +191,14 @@ describe('MetricStatEditor', () => { ]); }); }); + + describe('metric value', () => { + it('should be displayed when a custom value is used and its value is not in the select options', async () => { + const expected = 'CPUUtilzation'; + await act(async () => { + render(); + }); + expect(await screen.findByText(expected)).toBeInTheDocument(); + }); + }); }); diff --git a/public/app/plugins/datasource/cloudwatch/components/MetricStatEditor/MetricStatEditor.tsx b/public/app/plugins/datasource/cloudwatch/components/MetricStatEditor/MetricStatEditor.tsx index c27dd5aab07..899f9ce61c4 100644 --- a/public/app/plugins/datasource/cloudwatch/components/MetricStatEditor/MetricStatEditor.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/MetricStatEditor/MetricStatEditor.tsx @@ -62,7 +62,7 @@ export function MetricStatEditor({ {