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