mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Transforms: Fix schema definition (#62619)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { MonoTypeOperatorFunction } from 'rxjs';
|
||||
|
||||
import { MatcherConfig } from '@grafana/schema';
|
||||
import { MatcherConfig, DataTransformerConfig } from '@grafana/schema';
|
||||
|
||||
import { RegistryItemWithOptions } from '../utils/Registry';
|
||||
|
||||
@@ -41,27 +41,9 @@ export interface SynchronousDataTransformerInfo<TOptions = any> extends DataTran
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
* @deprecated use TransformationConfig from schema
|
||||
*/
|
||||
export interface DataTransformerConfig<TOptions = any> {
|
||||
/**
|
||||
* Unique identifier of transformer
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Disabled transformations are skipped
|
||||
*/
|
||||
disabled?: boolean;
|
||||
|
||||
/** Optional frame matcher. When missing it will be applied to all results */
|
||||
filter?: MatcherConfig;
|
||||
|
||||
/**
|
||||
* Options to be passed to the transformer
|
||||
*/
|
||||
options: TOptions;
|
||||
}
|
||||
export type { DataTransformerConfig };
|
||||
|
||||
export type FrameMatcher = (frame: DataFrame) => boolean;
|
||||
export type FieldMatcher = (field: Field, frame: DataFrame, allFrames: DataFrame[]) => boolean;
|
||||
|
||||
@@ -25,7 +25,6 @@ export type {
|
||||
RegexMap,
|
||||
SpecialValueMap,
|
||||
ValueMappingResult,
|
||||
Transformation,
|
||||
LibraryPanelRef,
|
||||
RowPanel,
|
||||
GraphPanel,
|
||||
@@ -44,7 +43,6 @@ export {
|
||||
defaultThresholdsConfig,
|
||||
MappingType,
|
||||
SpecialValueMatch,
|
||||
defaultTransformation,
|
||||
DashboardCursorSync,
|
||||
defaultDashboardCursorSync,
|
||||
defaultRowPanel
|
||||
@@ -63,6 +61,7 @@ export type {
|
||||
Dashboard,
|
||||
VariableModel,
|
||||
DataSourceRef,
|
||||
DataTransformerConfig,
|
||||
Panel,
|
||||
FieldConfigSource,
|
||||
MatcherConfig,
|
||||
|
||||
@@ -353,22 +353,27 @@ export interface ValueMappingResult {
|
||||
|
||||
/**
|
||||
* TODO docs
|
||||
* FIXME this is extremely underspecfied; wasn't obvious which typescript types corresponded to it
|
||||
*/
|
||||
export interface Transformation {
|
||||
export interface DataTransformerConfig {
|
||||
/**
|
||||
* only apply to some frames
|
||||
* Disabled transformations are skipped
|
||||
*/
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* Optional frame matcher. When missing it will be applied to all results
|
||||
*/
|
||||
filter?: MatcherConfig;
|
||||
hide: boolean;
|
||||
/**
|
||||
* Unique identifier of transformer
|
||||
*/
|
||||
id: string;
|
||||
options: Record<string, unknown>;
|
||||
/**
|
||||
* Options to be passed to the transformer
|
||||
* Valid options depend on the transformer id
|
||||
*/
|
||||
options: unknown;
|
||||
}
|
||||
|
||||
export const defaultTransformation: Partial<Transformation> = {
|
||||
hide: false,
|
||||
};
|
||||
|
||||
/**
|
||||
* 0 for no shared crosshair or tooltip (default).
|
||||
* 1 for shared crosshair.
|
||||
@@ -479,7 +484,7 @@ export interface Panel {
|
||||
* Panel title.
|
||||
*/
|
||||
title?: string;
|
||||
transformations: Array<Transformation>;
|
||||
transformations: Array<DataTransformerConfig>;
|
||||
/**
|
||||
* Whether to display the panel without a background.
|
||||
*/
|
||||
|
||||
@@ -47,6 +47,10 @@ export interface MatcherConfig<TConfig = any> extends raw.MatcherConfig {
|
||||
options?: TConfig;
|
||||
}
|
||||
|
||||
export interface DataTransformerConfig<TOptions = any> extends raw.DataTransformerConfig {
|
||||
options: TOptions;
|
||||
}
|
||||
|
||||
export const defaultDashboard = raw.defaultDashboard as Dashboard;
|
||||
export const defaultVariableModel = {
|
||||
...raw.defaultVariableModel,
|
||||
|
||||
Reference in New Issue
Block a user