/
legacyEvents.ts
48 lines (42 loc) · 1.73 KB
/
legacyEvents.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { DataQueryError, DataQueryResponseData } from './datasource';
import { AngularPanelMenuItem } from './panel';
import { DataFrame } from './dataFrame';
import { eventFactory } from '../events/eventFactory';
import { BusEventBase, BusEventWithPayload } from '../events/types';
import { DataHoverPayload } from '../events';
export type AlertPayload = [string, string?];
export type AlertErrorPayload = [string, (string | Error)?];
export const AppEvents = {
alertSuccess: eventFactory<AlertPayload>('alert-success'),
alertWarning: eventFactory<AlertPayload>('alert-warning'),
alertError: eventFactory<AlertErrorPayload>('alert-error'),
};
export const PanelEvents = {
refresh: eventFactory('refresh'),
componentDidMount: eventFactory('component-did-mount'),
dataReceived: eventFactory<DataQueryResponseData[]>('data-received'),
dataError: eventFactory<DataQueryError>('data-error'),
dataFramesReceived: eventFactory<DataFrame[]>('data-frames-received'),
dataSnapshotLoad: eventFactory<DataQueryResponseData[]>('data-snapshot-load'),
editModeInitialized: eventFactory('init-edit-mode'),
initPanelActions: eventFactory<AngularPanelMenuItem[]>('init-panel-actions'),
initialized: eventFactory('panel-initialized'),
panelTeardown: eventFactory('panel-teardown'),
render: eventFactory<any>('render'),
};
/** @public */
export interface LegacyGraphHoverEventPayload extends DataHoverPayload {
pos: any;
panel: {
id: number;
};
}
/** @alpha */
export class LegacyGraphHoverEvent extends BusEventWithPayload<LegacyGraphHoverEventPayload> {
static type = 'graph-hover';
}
/** @alpha */
export class LegacyGraphHoverClearEvent extends BusEventBase {
static type = 'graph-hover-clear';
payload: DataHoverPayload = { point: {} };
}