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

This commit is contained in:
Alexander Zobnin 2020-05-08 17:33:36 +03:00 committed by GitHub
parent 8257633b1d
commit 7e6ac12b9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 9 deletions

View File

@ -1,6 +1,7 @@
import { eventFactory } from './utils';
import { DataQueryError, DataQueryResponseData } from './datasource';
import { AngularPanelMenuItem } from './panel';
import { DataFrame } from './dataFrame';
/** Payloads */
export interface PanelChangeViewPayload {
@ -15,6 +16,7 @@ export const refresh = eventFactory('refresh');
export const componentDidMount = eventFactory('component-did-mount');
export const dataError = eventFactory<DataQueryError>('data-error');
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 editModeInitialized = eventFactory('init-edit-mode');
export const initPanelActions = eventFactory<AngularPanelMenuItem[]>('init-panel-actions');

View File

@ -16,7 +16,6 @@ import {
} from '@grafana/data';
import { Unsubscribable } from 'rxjs';
import { PanelModel } from 'app/features/dashboard/state';
import { CoreEvents } from 'app/types';
class MetricsPanelCtrl extends PanelCtrl {
scope: any;
@ -204,7 +203,7 @@ class MetricsPanelCtrl extends PanelCtrl {
}
try {
this.events.emit(CoreEvents.dataFramesReceived, data);
this.events.emit(PanelEvents.dataFramesReceived, data);
} catch (err) {
this.processDataError(err);
}

View File

@ -156,7 +156,7 @@ class GraphCtrl extends MetricsPanelCtrl {
this.contextMenuCtrl = new GraphContextMenuCtrl($scope);
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.editModeInitialized, this.onInitEditMode.bind(this));
this.events.on(PanelEvents.initPanelActions, this.onInitPanelActions.bind(this));

View File

@ -143,7 +143,7 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
// Bind grafana panel events
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.editModeInitialized, this.onInitEditMode.bind(this));

View File

@ -28,7 +28,6 @@ import {
import { convertOldAngularValueMapping } from '@grafana/ui';
import { CoreEvents } from 'app/types';
import config from 'app/core/config';
import { MetricsPanelCtrl } from 'app/plugins/sdk';
import { LinkSrv } from 'app/features/panel/panellinks/link_srv';
@ -124,7 +123,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
super($scope, $injector);
_.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.editModeInitialized, this.onInitEditMode.bind(this));

View File

@ -1,4 +1,4 @@
import { DataFrame, eventFactory, TimeRange } from '@grafana/data';
import { eventFactory, TimeRange } from '@grafana/data';
import { DashboardModel } from 'app/features/dashboard/state';
/**
@ -139,8 +139,6 @@ export const rowCollapsed = eventFactory('row-collapsed');
export const templateVariableValueUpdated = eventFactory('template-variable-value-updated');
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 thresholdChanged = eventFactory<ThresholdChangedPayload>('threshold-changed');