mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Types: Adds type safety to appEvents (#19418)
* Types: Add type safety to appEvents
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import $ from 'jquery';
|
||||
import { appEvents } from 'app/core/core';
|
||||
import { CoreEvents } from 'app/types';
|
||||
|
||||
export default function GraphTooltip(this: any, elem: any, dashboard: any, scope: any, getSeriesFn: any) {
|
||||
const self = this;
|
||||
@@ -155,7 +156,7 @@ export default function GraphTooltip(this: any, elem: any, dashboard: any, scope
|
||||
plot.unhighlight();
|
||||
}
|
||||
}
|
||||
appEvents.emit('graph-hover-clear');
|
||||
appEvents.emit(CoreEvents.graphHoverClear);
|
||||
});
|
||||
|
||||
elem.bind('plothover', (event: any, pos: { panelRelY: number; pageY: number }, item: any) => {
|
||||
@@ -163,11 +164,11 @@ export default function GraphTooltip(this: any, elem: any, dashboard: any, scope
|
||||
|
||||
// broadcast to other graph panels that we are hovering!
|
||||
pos.panelRelY = (pos.pageY - elem.offset().top) / elem.height();
|
||||
appEvents.emit('graph-hover', { pos: pos, panel: panel });
|
||||
appEvents.emit(CoreEvents.graphHover, { pos: pos, panel: panel });
|
||||
});
|
||||
|
||||
elem.bind('plotclick', (event: any, pos: any, item: any) => {
|
||||
appEvents.emit('graph-click', { pos: pos, panel: panel, item: item });
|
||||
appEvents.emit(CoreEvents.graphClicked, { pos: pos, panel: panel, item: item });
|
||||
});
|
||||
|
||||
this.clear = (plot: { clearCrosshair: () => void; unhighlight: () => void }) => {
|
||||
|
||||
Reference in New Issue
Block a user