mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
parent
6bc467f8e7
commit
17836c5895
@ -3,15 +3,15 @@ import { ComponentClass, ComponentType } from 'react';
|
||||
|
||||
import { FieldConfigOptionsRegistry, StandardEditorContext } from '../field';
|
||||
import {
|
||||
FieldConfigProperty,
|
||||
FieldConfigSource,
|
||||
GrafanaPlugin,
|
||||
PanelEditorProps,
|
||||
PanelMigrationHandler,
|
||||
PanelPluginDataSupport,
|
||||
PanelPluginMeta,
|
||||
PanelProps,
|
||||
PanelTypeChangedHandler,
|
||||
FieldConfigProperty,
|
||||
PanelPluginDataSupport,
|
||||
VisualizationSuggestionsSupplier,
|
||||
} from '../types';
|
||||
import { deprecationWarning } from '../utils';
|
||||
@ -120,7 +120,7 @@ export class PanelPlugin<
|
||||
};
|
||||
|
||||
/**
|
||||
* Legacy angular ctrl. If this exists it will be used instead of the panel
|
||||
* Legacy angular ctrl. If this exists it will be used instead of the panel
|
||||
*/
|
||||
angularPanelCtrl?: any;
|
||||
|
||||
|
@ -15,7 +15,7 @@ export enum FieldMatcherID {
|
||||
numeric = 'numeric',
|
||||
time = 'time', // Can be multiple times
|
||||
first = 'first',
|
||||
firstTimeField = 'firstTimeField', // Only the first fime field
|
||||
firstTimeField = 'firstTimeField', // Only the first time field
|
||||
|
||||
// With arguments
|
||||
byType = 'byType',
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { getFieldDisplayName } from '../../field/fieldState';
|
||||
import { stringToJsRegex } from '../../text/string';
|
||||
import { Field, DataFrame, FieldType, TIME_SERIES_VALUE_FIELD_NAME } from '../../types/dataFrame';
|
||||
import { FieldMatcherInfo, FrameMatcherInfo, FieldMatcher } from '../../types/transformations';
|
||||
import { DataFrame, Field, FieldType, TIME_SERIES_VALUE_FIELD_NAME } from '../../types/dataFrame';
|
||||
import { FieldMatcher, FieldMatcherInfo, FrameMatcherInfo } from '../../types/transformations';
|
||||
|
||||
import { FieldMatcherID, FrameMatcherID } from './ids';
|
||||
|
||||
export interface RegexpOrNamesMatcherOptions {
|
||||
pattern?: string;
|
||||
names?: string[];
|
||||
@ -98,10 +99,10 @@ const multipleFieldNamesMatcher: FieldMatcherInfo<ByNamesMatcherOptions> = {
|
||||
},
|
||||
};
|
||||
|
||||
// In an effor to support migrating to a consistent data contract, the
|
||||
// naming conventions need to get normalized. However many existing setups
|
||||
// In an effort to support migrating to a consistent data contract, the
|
||||
// naming conventions need to get normalized. However, many existing setups
|
||||
// exist that would no longer match names if that changes. This injects
|
||||
// fallback logic when when the data frame has not type version specified
|
||||
// fallback logic when the data frame has not type version specified
|
||||
export function fieldNameFallback(fields: Set<string>) {
|
||||
let fallback: FieldMatcher | undefined = undefined;
|
||||
|
||||
|
@ -5,7 +5,7 @@ import { FrameMatcherInfo } from '../../types/transformations';
|
||||
import { FrameMatcherID } from './ids';
|
||||
|
||||
// General Field matcher
|
||||
const refIdMacher: FrameMatcherInfo<string> = {
|
||||
const refIdMatcher: FrameMatcherInfo<string> = {
|
||||
id: FrameMatcherID.byRefId,
|
||||
name: 'Query refId',
|
||||
description: 'match the refId',
|
||||
@ -24,5 +24,5 @@ const refIdMacher: FrameMatcherInfo<string> = {
|
||||
};
|
||||
|
||||
export function getRefIdMatchers(): FrameMatcherInfo[] {
|
||||
return [refIdMacher];
|
||||
return [refIdMatcher];
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ export const filterFieldsTransformer: DataTransformerInfo<FilterOptions> = {
|
||||
defaultOptions: {},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options: FilterOptions, ctx) => (source) => {
|
||||
@ -86,7 +86,7 @@ export const filterFramesTransformer: DataTransformerInfo<FilterOptions> = {
|
||||
defaultOptions: {},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options, ctx) => (source) => {
|
||||
|
@ -17,7 +17,7 @@ export const filterFieldsByNameTransformer: DataTransformerInfo<FilterFieldsByNa
|
||||
defaultOptions: {},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options, replace) => (source) =>
|
||||
|
@ -16,7 +16,7 @@ export const filterFramesByRefIdTransformer: DataTransformerInfo<FilterFramesByR
|
||||
defaultOptions: {},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options, ctx) => (source) => {
|
||||
|
@ -31,7 +31,7 @@ export const groupByTransformer: DataTransformerInfo<GroupByTransformerOptions>
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options) => (source) =>
|
||||
|
@ -42,7 +42,7 @@ export interface JoinOptions {
|
||||
frames: DataFrame[];
|
||||
|
||||
/**
|
||||
* The field to join -- frames that do not have this field will be droppped
|
||||
* The field to join -- frames that do not have this field will be dropped
|
||||
*/
|
||||
joinBy?: FieldMatcher;
|
||||
|
||||
|
@ -9,10 +9,11 @@ export enum LabelsToFieldsMode {
|
||||
Columns = 'columns', // default mode
|
||||
Rows = 'rows',
|
||||
}
|
||||
|
||||
export interface LabelsToFieldsOptions {
|
||||
mode?: LabelsToFieldsMode;
|
||||
|
||||
/** When empty, this will keep all labels, otherise it will keep only labels matching the value */
|
||||
/** When empty, this will keep all labels, otherwise it will keep only labels matching the value */
|
||||
keepLabels?: string[];
|
||||
|
||||
/**
|
||||
@ -52,7 +53,7 @@ export const labelsToFieldsTransformer: SynchronousDataTransformerInfo<LabelsToF
|
||||
...field,
|
||||
config: {
|
||||
...field.config,
|
||||
// we need to clear thes for this transform as these can contain label names that we no longer want
|
||||
// we need to clear these for this transform as these can contain label names that we no longer want
|
||||
displayName: undefined,
|
||||
displayNameFromDS: undefined,
|
||||
},
|
||||
|
@ -20,7 +20,7 @@ export const orderFieldsTransformer: DataTransformerInfo<OrderFieldsTransformerO
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options) => (source) =>
|
||||
|
@ -22,7 +22,7 @@ export const organizeFieldsTransformer: DataTransformerInfo<OrganizeFieldsTransf
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options, ctx) => (source) =>
|
||||
|
@ -15,6 +15,7 @@ export enum ReduceTransformerMode {
|
||||
SeriesToRows = 'seriesToRows', // default
|
||||
ReduceFields = 'reduceFields', // same structure, add additional row for each type
|
||||
}
|
||||
|
||||
export interface ReduceTransformerOptions {
|
||||
reducers: ReducerID[];
|
||||
fields?: MatcherConfig; // Assume all fields
|
||||
@ -32,7 +33,7 @@ export const reduceTransformer: DataTransformerInfo<ReduceTransformerOptions> =
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options) => (source) =>
|
||||
|
@ -19,7 +19,7 @@ export const renameFieldsTransformer: DataTransformerInfo<RenameFieldsTransforme
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options) => (source) =>
|
||||
|
@ -33,7 +33,7 @@ export const renameByRegexTransformer: DataTransformerInfo<RenameByRegexTransfor
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options) => (source) =>
|
||||
|
@ -28,7 +28,7 @@ export const sortByTransformer: DataTransformerInfo<SortByTransformerOptions> =
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options) => (source) =>
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { ComponentType } from 'react';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { DataQuery, AnnotationQuery as SchemaAnnotationQuery } from '@grafana/schema';
|
||||
import { AnnotationQuery as SchemaAnnotationQuery, DataQuery } from '@grafana/schema';
|
||||
|
||||
import { DataFrame } from './dataFrame';
|
||||
import { QueryEditorProps } from './datasource';
|
||||
@ -103,7 +103,7 @@ export interface AnnotationSupport<TQuery extends DataQuery = DataQuery, TAnno =
|
||||
processEvents?(anno: TAnno, data: DataFrame[]): Observable<AnnotationEvent[] | undefined>;
|
||||
|
||||
/**
|
||||
* Specify a custom QueryEditor for the annotation page. If not specified, the standard one will be used
|
||||
* Specify a custom QueryEditor for the annotation page. If not specified, the standard one will be used
|
||||
*/
|
||||
QueryEditor?: ComponentType<AnnotationQueryEditorProps<TQuery>>;
|
||||
|
||||
|
@ -12,9 +12,9 @@ import {
|
||||
} from '@grafana/data';
|
||||
|
||||
import {
|
||||
getFieldConfigFromFrame,
|
||||
FieldToConfigMapping,
|
||||
evaluteFieldMappings,
|
||||
FieldToConfigMapping,
|
||||
getFieldConfigFromFrame,
|
||||
} from '../fieldToConfigMapping/fieldToConfigMapping';
|
||||
|
||||
export interface ConfigFromQueryTransformOptions {
|
||||
@ -99,7 +99,7 @@ export const configFromDataTransformer: DataTransformerInfo<ConfigFromQueryTrans
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options) => (source) => source.pipe(map((data) => extractConfigFromQuery(options, data))),
|
||||
|
@ -3,11 +3,11 @@ import { map } from 'rxjs/operators';
|
||||
import { DataFrame, DataTransformerID, DataTransformerInfo, Field, getFieldDisplayName, Labels } from '@grafana/data';
|
||||
|
||||
import {
|
||||
getFieldConfigFromFrame,
|
||||
FieldToConfigMapping,
|
||||
evaluteFieldMappings,
|
||||
EvaluatedMappingResult,
|
||||
evaluteFieldMappings,
|
||||
FieldConfigHandlerKey,
|
||||
FieldToConfigMapping,
|
||||
getFieldConfigFromFrame,
|
||||
} from '../fieldToConfigMapping/fieldToConfigMapping';
|
||||
|
||||
export interface RowToFieldsTransformOptions {
|
||||
@ -23,7 +23,7 @@ export const rowsToFieldsTransformer: DataTransformerInfo<RowToFieldsTransformOp
|
||||
defaultOptions: {},
|
||||
|
||||
/**
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* Return a modified copy of the series. If the transform is not or should not
|
||||
* be applied, just return the input series
|
||||
*/
|
||||
operator: (options) => (source) =>
|
||||
|
Loading…
Reference in New Issue
Block a user