Fix error when setting alerts for Azure Monitor (#42989)

* pass the correct value to buildScaleKey()

* drop unnecessary type casting

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>

* fix linting errors

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
This commit is contained in:
Santiago 2021-12-16 12:51:14 -03:00 committed by GitHub
parent f789a7f88c
commit 15c214d467
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import React, { useState, useLayoutEffect, useMemo, useRef } from 'react'; import React, { useState, useLayoutEffect, useMemo, useRef } from 'react';
import { FieldConfigSource, ThresholdsConfig, getValueFormat, FieldConfig } from '@grafana/data'; import { FieldConfigSource, ThresholdsConfig, getValueFormat } from '@grafana/data';
import { UPlotConfigBuilder, buildScaleKey, GraphFieldConfig } from '@grafana/ui'; import { UPlotConfigBuilder, buildScaleKey } from '@grafana/ui';
import { ThresholdDragHandle } from './ThresholdDragHandle'; import { ThresholdDragHandle } from './ThresholdDragHandle';
import uPlot from 'uplot'; import uPlot from 'uplot';
@ -42,7 +42,7 @@ export const ThresholdControlsPlugin: React.FC<ThresholdControlsPluginProps> = (
if (!thresholds) { if (!thresholds) {
return null; return null;
} }
const scale = buildScaleKey(fieldConfig as FieldConfig<GraphFieldConfig>); const scale = buildScaleKey(fieldConfig.defaults);
const decimals = fieldConfig.defaults.decimals; const decimals = fieldConfig.defaults.decimals;
const handles = []; const handles = [];