Commit 7e6ac12b by Alexander Zobnin Committed by GitHub

Chore: move dataFramesReceived event to @grafana/data (#24443)

parent 8257633b
import { eventFactory } from './utils'; import { eventFactory } from './utils';
import { DataQueryError, DataQueryResponseData } from './datasource'; import { DataQueryError, DataQueryResponseData } from './datasource';
import { AngularPanelMenuItem } from './panel'; import { AngularPanelMenuItem } from './panel';
import { DataFrame } from './dataFrame';
/** Payloads */ /** Payloads */
export interface PanelChangeViewPayload { export interface PanelChangeViewPayload {
...@@ -15,6 +16,7 @@ export const refresh = eventFactory('refresh'); ...@@ -15,6 +16,7 @@ export const refresh = eventFactory('refresh');
export const componentDidMount = eventFactory('component-did-mount'); export const componentDidMount = eventFactory('component-did-mount');
export const dataError = eventFactory<DataQueryError>('data-error'); export const dataError = eventFactory<DataQueryError>('data-error');
export const dataReceived = eventFactory<DataQueryResponseData[]>('data-received'); export const dataReceived = eventFactory<DataQueryResponseData[]>('data-received');
export const dataFramesReceived = eventFactory<DataFrame[]>('data-frames-received');
export const dataSnapshotLoad = eventFactory<DataQueryResponseData[]>('data-snapshot-load'); export const dataSnapshotLoad = eventFactory<DataQueryResponseData[]>('data-snapshot-load');
export const editModeInitialized = eventFactory('init-edit-mode'); export const editModeInitialized = eventFactory('init-edit-mode');
export const initPanelActions = eventFactory<AngularPanelMenuItem[]>('init-panel-actions'); export const initPanelActions = eventFactory<AngularPanelMenuItem[]>('init-panel-actions');
......
...@@ -16,7 +16,6 @@ import { ...@@ -16,7 +16,6 @@ import {
} from '@grafana/data'; } from '@grafana/data';
import { Unsubscribable } from 'rxjs'; import { Unsubscribable } from 'rxjs';
import { PanelModel } from 'app/features/dashboard/state'; import { PanelModel } from 'app/features/dashboard/state';
import { CoreEvents } from 'app/types';
class MetricsPanelCtrl extends PanelCtrl { class MetricsPanelCtrl extends PanelCtrl {
scope: any; scope: any;
...@@ -204,7 +203,7 @@ class MetricsPanelCtrl extends PanelCtrl { ...@@ -204,7 +203,7 @@ class MetricsPanelCtrl extends PanelCtrl {
} }
try { try {
this.events.emit(CoreEvents.dataFramesReceived, data); this.events.emit(PanelEvents.dataFramesReceived, data);
} catch (err) { } catch (err) {
this.processDataError(err); this.processDataError(err);
} }
......
...@@ -156,7 +156,7 @@ class GraphCtrl extends MetricsPanelCtrl { ...@@ -156,7 +156,7 @@ class GraphCtrl extends MetricsPanelCtrl {
this.contextMenuCtrl = new GraphContextMenuCtrl($scope); this.contextMenuCtrl = new GraphContextMenuCtrl($scope);
this.events.on(PanelEvents.render, this.onRender.bind(this)); this.events.on(PanelEvents.render, this.onRender.bind(this));
this.events.on(CoreEvents.dataFramesReceived, this.onDataFramesReceived.bind(this)); this.events.on(PanelEvents.dataFramesReceived, this.onDataFramesReceived.bind(this));
this.events.on(PanelEvents.dataSnapshotLoad, this.onDataSnapshotLoad.bind(this)); this.events.on(PanelEvents.dataSnapshotLoad, this.onDataSnapshotLoad.bind(this));
this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this)); this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this));
this.events.on(PanelEvents.initPanelActions, this.onInitPanelActions.bind(this)); this.events.on(PanelEvents.initPanelActions, this.onInitPanelActions.bind(this));
......
...@@ -143,7 +143,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl { ...@@ -143,7 +143,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
// Bind grafana panel events // Bind grafana panel events
this.events.on(PanelEvents.render, this.onRender.bind(this)); this.events.on(PanelEvents.render, this.onRender.bind(this));
this.events.on(CoreEvents.dataFramesReceived, this.onDataFramesReceived.bind(this)); this.events.on(PanelEvents.dataFramesReceived, this.onDataFramesReceived.bind(this));
this.events.on(PanelEvents.dataSnapshotLoad, this.onSnapshotLoad.bind(this)); this.events.on(PanelEvents.dataSnapshotLoad, this.onSnapshotLoad.bind(this));
this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this)); this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this));
......
...@@ -28,7 +28,6 @@ import { ...@@ -28,7 +28,6 @@ import {
import { convertOldAngularValueMapping } from '@grafana/ui'; import { convertOldAngularValueMapping } from '@grafana/ui';
import { CoreEvents } from 'app/types';
import config from 'app/core/config'; import config from 'app/core/config';
import { MetricsPanelCtrl } from 'app/plugins/sdk'; import { MetricsPanelCtrl } from 'app/plugins/sdk';
import { LinkSrv } from 'app/features/panel/panellinks/link_srv'; import { LinkSrv } from 'app/features/panel/panellinks/link_srv';
...@@ -124,7 +123,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { ...@@ -124,7 +123,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
super($scope, $injector); super($scope, $injector);
_.defaults(this.panel, this.panelDefaults); _.defaults(this.panel, this.panelDefaults);
this.events.on(CoreEvents.dataFramesReceived, this.onFramesReceived.bind(this)); this.events.on(PanelEvents.dataFramesReceived, this.onFramesReceived.bind(this));
this.events.on(PanelEvents.dataSnapshotLoad, this.onSnapshotLoad.bind(this)); this.events.on(PanelEvents.dataSnapshotLoad, this.onSnapshotLoad.bind(this));
this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this)); this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this));
......
import { DataFrame, eventFactory, TimeRange } from '@grafana/data'; import { eventFactory, TimeRange } from '@grafana/data';
import { DashboardModel } from 'app/features/dashboard/state'; import { DashboardModel } from 'app/features/dashboard/state';
/** /**
...@@ -139,8 +139,6 @@ export const rowCollapsed = eventFactory('row-collapsed'); ...@@ -139,8 +139,6 @@ export const rowCollapsed = eventFactory('row-collapsed');
export const templateVariableValueUpdated = eventFactory('template-variable-value-updated'); export const templateVariableValueUpdated = eventFactory('template-variable-value-updated');
export const submenuVisibilityChanged = eventFactory<boolean>('submenu-visibility-changed'); export const submenuVisibilityChanged = eventFactory<boolean>('submenu-visibility-changed');
export const dataFramesReceived = eventFactory<DataFrame[]>('data-frames-received');
export const graphClicked = eventFactory<GraphClickedPayload>('graph-click'); export const graphClicked = eventFactory<GraphClickedPayload>('graph-click');
export const thresholdChanged = eventFactory<ThresholdChangedPayload>('threshold-changed'); export const thresholdChanged = eventFactory<ThresholdChangedPayload>('threshold-changed');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment