diff --git a/packages/grafana-data/src/utils/index.ts b/packages/grafana-data/src/utils/index.ts index 61444ab922d..6df8d8f21b7 100644 --- a/packages/grafana-data/src/utils/index.ts +++ b/packages/grafana-data/src/utils/index.ts @@ -23,12 +23,4 @@ export { DocsId } from './docs'; export { makeClassES5Compatible } from './makeClassES5Compatible'; export { anyToNumber } from './anyToNumber'; export { withLoadingIndicator, WithLoadingIndicatorOptions } from './withLoadingIndicator'; -export { - getMappedValue, - convertOldAngularValueMappings, - LegacyValueMapping, - LegacyValueMap, - LegacyRangeMap, - LegacyBaseMap, - LegacyMappingType, -} from './valueMappings'; +export { convertOldAngularValueMappings, LegacyMappingType } from './valueMappings'; diff --git a/packages/grafana-data/src/utils/valueMappings.ts b/packages/grafana-data/src/utils/valueMappings.ts index 3cc2a79c1ec..063e47d77a4 100644 --- a/packages/grafana-data/src/utils/valueMappings.ts +++ b/packages/grafana-data/src/utils/valueMappings.ts @@ -126,77 +126,6 @@ export enum LegacyMappingType { RangeToText = 2, } -/** - * @deprecated use MappingType instead - * @internal - */ -export interface LegacyBaseMap { - id: number; // this could/should just be the array index - text: string; // the final display value - type: LegacyMappingType; -} - -/** - * @deprecated use ValueMapping instead - * @internal - */ -export type LegacyValueMapping = LegacyValueMap | LegacyRangeMap; - -/** - * @deprecated use ValueMap instead - * @internal - */ -export interface LegacyValueMap extends LegacyBaseMap { - value: string; -} - -/** - * @deprecated use RangeMap instead - * @internal - */ -export interface LegacyRangeMap extends LegacyBaseMap { - from: string; - to: string; -} - -/** - * @deprecated use getValueMappingResult instead - * @internal - */ -export function getMappedValue(valueMappings: LegacyValueMapping[], value: any): LegacyValueMapping { - const emptyResult = { type: LegacyMappingType.ValueToText, value: '', text: '', from: '', to: '', id: 0 }; - if (!valueMappings?.length) { - return emptyResult; - } - - const upgraded: ValueMapping[] = []; - for (const vm of valueMappings) { - if (isValueMapping(vm)) { - upgraded.push(vm); - continue; - } - upgraded.push(upgradeOldAngularValueMapping(vm)); - } - - if (!upgraded?.length) { - return emptyResult; - } - - const result = getValueMappingResult(upgraded, value); - if (!result) { - return emptyResult; - } - - return { - type: LegacyMappingType.ValueToText, - value: result.text, - text: result.text ?? '', - from: '', - to: '', - id: result.index ?? 0, - }; -} - /** * @alpha * Converts the old Angular value mappings to new react style @@ -309,11 +238,3 @@ function upgradeOldAngularValueMapping(old: any, thresholds?: ThresholdsConfig): return newMappings[0]; } - -function isValueMapping(map: any): map is ValueMapping { - if (!map) { - return false; - } - - return map.hasOwnProperty('options') && typeof map.options === 'object'; -}