mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CloudWatch: Fix display name of metric and namespace (#54860)
* convert value to option * add unit test * fix lint issue
This commit is contained in:
parent
34e06dbe18
commit
a37fa758a2
@ -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(<MetricStatEditor {...props} metricStat={{ ...props.metricStat, metricName: expected }} />);
|
||||
});
|
||||
expect(await screen.findByText(expected)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -61,7 +61,7 @@ export function MetricStatEditor({
|
||||
<EditorField label="Namespace" width={26}>
|
||||
<Select
|
||||
aria-label="Namespace"
|
||||
value={metricStat.namespace}
|
||||
value={metricStat?.namespace && toOption(metricStat.namespace)}
|
||||
allowCustomValue
|
||||
options={namespaces}
|
||||
onChange={({ value: namespace }) => {
|
||||
@ -74,7 +74,7 @@ export function MetricStatEditor({
|
||||
<EditorField label="Metric name" width={16}>
|
||||
<Select
|
||||
aria-label="Metric name"
|
||||
value={metricStat.metricName || null}
|
||||
value={metricStat?.metricName && toOption(metricStat.metricName)}
|
||||
allowCustomValue
|
||||
options={metrics}
|
||||
onChange={({ value: metricName }) => {
|
||||
|
Loading…
Reference in New Issue
Block a user