mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Transformers: configure result transformations after query(alpha) (#18740)
This commit is contained in:
committed by
Dominik Prokop
parent
205c0a58ac
commit
7d32caeac2
@@ -7,7 +7,7 @@ import { getNextRefIdChar } from 'app/core/utils/query';
|
||||
|
||||
// Types
|
||||
import { DataQuery, ScopedVars, DataQueryResponseData, PanelPlugin } from '@grafana/ui';
|
||||
import { DataLink } from '@grafana/data';
|
||||
import { DataLink, DataTransformerConfig } from '@grafana/data';
|
||||
|
||||
import config from 'app/core/config';
|
||||
|
||||
@@ -66,6 +66,7 @@ const mustKeepProps: { [str: string]: boolean } = {
|
||||
transparent: true,
|
||||
pluginVersion: true,
|
||||
queryRunner: true,
|
||||
transformations: true,
|
||||
};
|
||||
|
||||
const defaults: any = {
|
||||
@@ -93,6 +94,7 @@ export class PanelModel {
|
||||
panels?: any;
|
||||
soloMode?: boolean;
|
||||
targets: DataQuery[];
|
||||
transformations?: DataTransformerConfig[];
|
||||
datasource: string;
|
||||
thresholds?: any;
|
||||
pluginVersion?: string;
|
||||
@@ -290,7 +292,6 @@ export class PanelModel {
|
||||
} else if (oldOptions && oldOptions.options) {
|
||||
old = oldOptions.options;
|
||||
}
|
||||
|
||||
this.options = this.options || {};
|
||||
Object.assign(this.options, newPlugin.onPanelTypeChanged(this.options, oldPluginId, old));
|
||||
}
|
||||
@@ -344,6 +345,14 @@ export class PanelModel {
|
||||
this.queryRunner = null;
|
||||
}
|
||||
}
|
||||
|
||||
setTransformations(transformations: DataTransformerConfig[]) {
|
||||
// save for persistence
|
||||
this.transformations = transformations;
|
||||
|
||||
// update query runner transformers
|
||||
this.getQueryRunner().setTransform(transformations);
|
||||
}
|
||||
}
|
||||
|
||||
function getPluginVersion(plugin: PanelPlugin): string {
|
||||
|
||||
Reference in New Issue
Block a user