Transformers: PartitionByValues (#56767)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Leon Sorokin
2022-10-20 17:22:02 -05:00
committed by GitHub
parent 60b14a2ec2
commit 883d61d191
8 changed files with 467 additions and 11 deletions

View File

@@ -32,7 +32,8 @@ export const filterFieldsByNameTransformer: DataTransformerInfo<FilterFieldsByNa
),
};
const getMatcherConfig = (options?: RegexpOrNamesMatcherOptions): MatcherConfig | undefined => {
// Exported to share with other implementations, but not exported to `@grafana/data`
export const getMatcherConfig = (options?: RegexpOrNamesMatcherOptions): MatcherConfig | undefined => {
if (!options) {
return undefined;
}

View File

@@ -35,4 +35,5 @@ export enum DataTransformerID {
extractFields = 'extractFields',
groupingToMatrix = 'groupingToMatrix',
limit = 'limit',
partitionByValues = 'partitionByValues',
}

View File

@@ -1,21 +1,19 @@
import { DataTransformerInfo } from '../../types/transformations';
import { DataFrame } from '../../types';
import { SynchronousDataTransformerInfo } from '../../types/transformations';
import { DataTransformerID } from './ids';
export interface NoopTransformerOptions {
include?: string;
exclude?: string;
}
export interface NoopTransformerOptions {}
export const noopTransformer: DataTransformerInfo<NoopTransformerOptions> = {
export const noopTransformer: SynchronousDataTransformerInfo<NoopTransformerOptions> = {
id: DataTransformerID.noop,
name: 'noop',
description: 'No-operation transformer',
defaultOptions: {},
/**
* Return a modified copy of the series. If the transform is not or should not
* be applied, just return the input series
*/
/** no operation */
operator: (options: NoopTransformerOptions) => (source) => source,
/** no operation */
transformer: (options: NoopTransformerOptions) => (data: DataFrame[]) => data,
};