mirror of
https://github.com/grafana/grafana.git
synced 2026-09-05 04:40:13 -05:00
PanelContext: Add functionality to update data from panel (#66993)
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
AnnotationEventUIModel,
|
||||
CoreApp,
|
||||
DashboardCursorSync,
|
||||
DataFrame,
|
||||
EventFilterOptions,
|
||||
FieldConfigSource,
|
||||
getDataSourceRef,
|
||||
@@ -42,6 +43,7 @@ import { InspectTab } from 'app/features/inspector/types';
|
||||
import { getPanelLinksSupplier } from 'app/features/panel/panellinks/linkSuppliers';
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
import { applyFilterFromTable } from 'app/features/variables/adhoc/actions';
|
||||
import { onUpdatePanelSnapshotData } from 'app/plugins/datasource/grafana/utils';
|
||||
import { changeSeriesColorConfigFactory } from 'app/plugins/panel/timeseries/overrides/colorSeriesConfigFactory';
|
||||
import { dispatch } from 'app/store/store';
|
||||
import { RenderEvent } from 'app/types/events';
|
||||
@@ -116,6 +118,7 @@ export class PanelStateWrapper extends PureComponent<Props, State> {
|
||||
canEditAnnotations: props.dashboard.canEditAnnotations.bind(props.dashboard),
|
||||
canDeleteAnnotations: props.dashboard.canDeleteAnnotations.bind(props.dashboard),
|
||||
onAddAdHocFilter: this.onAddAdHocFilter,
|
||||
onUpdateData: this.onUpdateData,
|
||||
},
|
||||
data: this.getInitialPanelDataState(),
|
||||
};
|
||||
@@ -146,6 +149,10 @@ export class PanelStateWrapper extends PureComponent<Props, State> {
|
||||
return CoreApp.Dashboard;
|
||||
}
|
||||
|
||||
onUpdateData = (frames: DataFrame[]): Promise<boolean> => {
|
||||
return onUpdatePanelSnapshotData(this.props.panel, frames);
|
||||
};
|
||||
|
||||
onSeriesColorChange = (label: string, color: string) => {
|
||||
this.onFieldConfigChange(changeSeriesColorConfigFactory(label, color, this.props.panel.fieldConfig));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user