Fix typing
This commit is contained in:
@@ -45,7 +45,7 @@ export enum DataTransformerID {
|
||||
groupToNestedTable = 'groupToNestedTable',
|
||||
}
|
||||
|
||||
export const refIDDependentIDs = [
|
||||
export const refIDDependentIDs: string[] = [
|
||||
DataTransformerID.joinByField,
|
||||
DataTransformerID.merge,
|
||||
DataTransformerID.reduce,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { DataFrame } from '../../types/dataFrame';
|
||||
import { SpecialValue } from '../../types/transformations';
|
||||
|
||||
import { DataTransformerID } from './ids';
|
||||
|
||||
/**
|
||||
* Retrieve the maximum number of fields in a series of a dataframe.
|
||||
*/
|
||||
@@ -36,6 +34,6 @@ export function getSpecialValue(specialValue: SpecialValue) {
|
||||
}
|
||||
}
|
||||
|
||||
export const getTransformationLegacyRefId = (transformationId: DataTransformerID, data: DataFrame[]) => {
|
||||
export const getTransformationLegacyRefId = (transformationId: string, data: DataFrame[]) => {
|
||||
return `${transformationId}-${data.map((frame) => frame.refId).join('-')}`;
|
||||
};
|
||||
|
||||
+2
-4
@@ -4,7 +4,6 @@ import { useState } from 'react';
|
||||
|
||||
import {
|
||||
DataTransformerConfig,
|
||||
DataTransformerID,
|
||||
getTransformationLegacyRefId,
|
||||
getNextRefId,
|
||||
GrafanaTheme2,
|
||||
@@ -187,9 +186,8 @@ function TransformationsEditor({ transformations, model, data }: TransformationE
|
||||
// populate refIds for any transformations that don't have them
|
||||
const refLessTransformations = transformations.filter((transformation) => transformation.refId === undefined);
|
||||
refLessTransformations.forEach((transformation) => {
|
||||
const transformationId: DataTransformerID = transformation.id as DataTransformerID;
|
||||
if (refIDDependentIDs.includes(transformationId)) {
|
||||
transformation.refId = getTransformationLegacyRefId(transformationId, data.series);
|
||||
if (refIDDependentIDs.includes(transformation.id)) {
|
||||
transformation.refId = getTransformationLegacyRefId(transformation.id, data.series);
|
||||
} else {
|
||||
transformation.refId = getNextRefId(transformations, 'T-');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user