-
Notifications
You must be signed in to change notification settings - Fork 11.7k
/
events.ts
212 lines (172 loc) · 5.06 KB
/
events.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
import { AnnotationQuery, BusEventBase, BusEventWithPayload, eventFactory } from '@grafana/data';
import { IconName, ButtonVariant } from '@grafana/ui';
/**
* Event Payloads
*/
export interface ShowDashSearchPayload {
query?: string;
}
export interface LocationChangePayload {
href: string;
}
export interface ShowModalPayload {
model?: any;
modalClass?: string;
src?: string;
templateHtml?: string;
backdrop?: any;
scope?: any;
}
export interface ShowModalReactPayload {
component: React.ComponentType<any>;
props?: any;
}
export interface ShowConfirmModalPayload {
title?: string;
text?: string;
text2?: string;
text2htmlBind?: boolean;
confirmText?: string;
altActionText?: string;
yesText?: string;
noText?: string;
icon?: IconName;
yesButtonVariant?: ButtonVariant;
onDismiss?: () => void;
onConfirm?: () => void;
onAltAction?: () => void;
}
export interface DataSourceResponse<T> {
data: T;
readonly status: number;
readonly statusText: string;
readonly ok: boolean;
readonly headers: Headers;
readonly redirected: boolean;
readonly type: ResponseType;
readonly url: string;
readonly config: any;
}
type DataSourceResponsePayload = DataSourceResponse<any>;
export interface ToggleKioskModePayload {
exit?: boolean;
}
export interface GraphClickedPayload {
pos: any;
panel: any;
item: any;
}
export interface ThresholdChangedPayload {
threshold: any;
handleIndex: any;
}
export interface DashScrollPayload {
restore?: boolean;
animate?: boolean;
pos?: number;
}
export interface PanelChangeViewPayload {}
/**
* Events
*/
export const dsRequestResponse = eventFactory<DataSourceResponsePayload>('ds-request-response');
export const dsRequestError = eventFactory<any>('ds-request-error');
export const toggleSidemenuHidden = eventFactory('toggle-sidemenu-hidden');
export const templateVariableValueUpdated = eventFactory('template-variable-value-updated');
export const graphClicked = eventFactory<GraphClickedPayload>('graph-click');
/**
* @internal
*/
export const thresholdChanged = eventFactory<ThresholdChangedPayload>('threshold-changed');
/**
* Used for syncing queries badge count in panel edit queries tab
* Think we can get rid of this soon
*/
export class PanelQueriesChangedEvent extends BusEventBase {
static type = 'panel-queries-changed';
}
/**
* Used for syncing transformations badge count in panel edit transform tab
* Think we can get rid of this soon
*/
export class PanelTransformationsChangedEvent extends BusEventBase {
static type = 'panel-transformations-changed';
}
/**
* Used by panel editor to know when panel plugin itself trigger option updates
*/
export class PanelOptionsChangedEvent extends BusEventBase {
static type = 'panels-options-changed';
}
/**
* Used internally by DashboardModel to communicate with DashboardGrid that it needs to re-render
*/
export class DashboardPanelsChangedEvent extends BusEventBase {
static type = 'dashboard-panels-changed';
}
export class DashboardMetaChangedEvent extends BusEventBase {
static type = 'dashboard-meta-changed';
}
export class PanelDirectiveReadyEvent extends BusEventBase {
static type = 'panel-directive-ready';
}
export class RenderEvent extends BusEventBase {
static type = 'render';
}
interface ZoomOutEventPayload {
scale: number;
updateUrl?: boolean;
}
export class ZoomOutEvent extends BusEventWithPayload<ZoomOutEventPayload> {
static type = 'zoom-out';
}
export enum ShiftTimeEventDirection {
Left = -1,
Right = 1,
}
interface ShiftTimeEventPayload {
direction: ShiftTimeEventDirection;
updateUrl?: boolean;
}
export class ShiftTimeEvent extends BusEventWithPayload<ShiftTimeEventPayload> {
static type = 'shift-time';
}
export class AbsoluteTimeEvent extends BusEventBase {
static type = 'absolute-time';
}
export class RemovePanelEvent extends BusEventWithPayload<number> {
static type = 'remove-panel';
}
/**
* @deprecated use ShowModalReactEvent instead that has this capability built in
*/
export class ShowModalEvent extends BusEventWithPayload<ShowModalPayload> {
static type = 'show-modal';
}
export class ShowConfirmModalEvent extends BusEventWithPayload<ShowConfirmModalPayload> {
static type = 'show-confirm-modal';
}
export class ShowModalReactEvent extends BusEventWithPayload<ShowModalReactPayload> {
static type = 'show-react-modal';
}
/**
* @deprecated use ShowModalReactEvent instead that has this capability built in
*/
export class HideModalEvent extends BusEventBase {
static type = 'hide-modal';
}
export class DashboardSavedEvent extends BusEventBase {
static type = 'dashboard-saved';
}
export class AnnotationQueryStarted extends BusEventWithPayload<AnnotationQuery> {
static type = 'annotation-query-started';
}
export class AnnotationQueryFinished extends BusEventWithPayload<AnnotationQuery> {
static type = 'annotation-query-finished';
}
export class PanelEditEnteredEvent extends BusEventWithPayload<number> {
static type = 'panel-edit-started';
}
export class PanelEditExitedEvent extends BusEventWithPayload<number> {
static type = 'panel-edit-finished';
}