Transformations: Add frame source picker to allow transforming annotations (#77842)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Leon Sorokin
2024-01-02 23:33:31 -06:00
committed by GitHub
co-authored by Ryan McKinley
parent a5957ba555
commit fb79be4a43
16 changed files with 165 additions and 56 deletions
+7 -6
View File
@@ -1,4 +1,8 @@
import { DataQuery as SchemaDataQuery, DataSourceRef as SchemaDataSourceRef } from '@grafana/schema';
import {
DataQuery as SchemaDataQuery,
DataSourceRef as SchemaDataSourceRef,
DataTopic as SchemaDataTopic,
} from '@grafana/schema';
/**
* @deprecated use the type from @grafana/schema
@@ -13,12 +17,9 @@ export interface DataSourceRef extends SchemaDataSourceRef {}
/**
* Attached to query results (not persisted)
*
* @public
* @deprecated use the type from @grafana/schema
*/
export enum DataTopic {
Annotations = 'annotations',
AlertStates = 'alertStates',
}
export { SchemaDataTopic as DataTopic };
/**
* Abstract representation of any label-based query
@@ -8,6 +8,16 @@
// Run 'make gen-cue' from repository root to regenerate.
/**
* A topic is attached to DataFrame metadata in query results.
* This specifies where the data should be used.
*/
export enum DataTopic {
AlertStates = 'alertStates',
Annotations = 'annotations',
Series = 'series',
}
/**
* TODO docs
*/
@@ -0,0 +1,5 @@
package common
// A topic is attached to DataFrame metadata in query results.
// This specifies where the data should be used.
DataTopic: "series" | "annotations" | "alertStates" @cuetsy(kind="enum",memberNames="Series|Annotations|AlertStates")
@@ -623,6 +623,10 @@ export interface DataTransformerConfig {
* Valid options depend on the transformer id
*/
options: unknown;
/**
* Where to pull DataFrames from as input to transformation
*/
topic?: ('series' | 'annotations' | 'alertStates'); // replaced with common.DataTopic
}
/**
@@ -1,4 +1,4 @@
import { DataSourceRef as CommonDataSourceRef, DataSourceRef } from '../common/common.gen';
import { DataSourceRef as CommonDataSourceRef, DataSourceRef, DataTopic } from '../common/common.gen';
import * as raw from '../raw/dashboard/x/dashboard_types.gen';
import { DataQuery } from './common.types';
@@ -59,6 +59,7 @@ export interface MatcherConfig<TConfig = any> extends raw.MatcherConfig {
export interface DataTransformerConfig<TOptions = any> extends raw.DataTransformerConfig {
options: TOptions;
topic?: DataTopic;
}
export interface TimePickerConfig extends raw.TimePickerConfig {}