From 7e6ac12b9aa7e0644b0806805c03a6891864217e Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Fri, 8 May 2020 17:33:36 +0300 Subject: [PATCH] Chore: move dataFramesReceived event to @grafana/data (#24443) --- packages/grafana-data/src/types/panelEvents.ts | 2 ++ public/app/features/panel/metrics_panel_ctrl.ts | 3 +-- public/app/plugins/panel/graph/module.ts | 2 +- public/app/plugins/panel/heatmap/heatmap_ctrl.ts | 2 +- public/app/plugins/panel/singlestat/module.ts | 3 +-- public/app/types/events.ts | 4 +--- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/grafana-data/src/types/panelEvents.ts b/packages/grafana-data/src/types/panelEvents.ts index 0a85512bff4..1c17c49f595 100644 --- a/packages/grafana-data/src/types/panelEvents.ts +++ b/packages/grafana-data/src/types/panelEvents.ts @@ -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('data-error'); export const dataReceived = eventFactory('data-received'); +export const dataFramesReceived = eventFactory('data-frames-received'); export const dataSnapshotLoad = eventFactory('data-snapshot-load'); export const editModeInitialized = eventFactory('init-edit-mode'); export const initPanelActions = eventFactory('init-panel-actions'); diff --git a/public/app/features/panel/metrics_panel_ctrl.ts b/public/app/features/panel/metrics_panel_ctrl.ts index c76ab907b44..ebdd02c9ccc 100644 --- a/public/app/features/panel/metrics_panel_ctrl.ts +++ b/public/app/features/panel/metrics_panel_ctrl.ts @@ -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); } diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index 8cca3eeeb7d..12419cd9c80 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -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)); diff --git a/public/app/plugins/panel/heatmap/heatmap_ctrl.ts b/public/app/plugins/panel/heatmap/heatmap_ctrl.ts index f5c25092ec4..a596eb97bdb 100644 --- a/public/app/plugins/panel/heatmap/heatmap_ctrl.ts +++ b/public/app/plugins/panel/heatmap/heatmap_ctrl.ts @@ -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)); diff --git a/public/app/plugins/panel/singlestat/module.ts b/public/app/plugins/panel/singlestat/module.ts index a661a5862d0..51d7a54103c 100644 --- a/public/app/plugins/panel/singlestat/module.ts +++ b/public/app/plugins/panel/singlestat/module.ts @@ -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)); diff --git a/public/app/types/events.ts b/public/app/types/events.ts index 4ca94be726c..c35e01ce422 100644 --- a/public/app/types/events.ts +++ b/public/app/types/events.ts @@ -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('submenu-visibility-changed'); -export const dataFramesReceived = eventFactory('data-frames-received'); - export const graphClicked = eventFactory('graph-click'); export const thresholdChanged = eventFactory('threshold-changed');