@@ -24,7 +24,7 @@ func ValidateOrgAlert(c *models.ReqContext) {
24
24
id := c .ParamsInt64 (":alertId" )
25
25
query := models.GetAlertByIdQuery {Id : id }
26
26
27
- if err := bus .DispatchCtx (c .Req .Context (), & query ); err != nil {
27
+ if err := bus .Dispatch (c .Req .Context (), & query ); err != nil {
28
28
c .JsonApiErr (404 , "Alert not found" , nil )
29
29
return
30
30
}
@@ -47,7 +47,7 @@ func GetAlertStatesForDashboard(c *models.ReqContext) response.Response {
47
47
DashboardId : c .QueryInt64 ("dashboardId" ),
48
48
}
49
49
50
- if err := bus .DispatchCtx (c .Req .Context (), & query ); err != nil {
50
+ if err := bus .Dispatch (c .Req .Context (), & query ); err != nil {
51
51
return response .Error (500 , "Failed to fetch alert states" , err )
52
52
}
53
53
@@ -90,7 +90,7 @@ func GetAlerts(c *models.ReqContext) response.Response {
90
90
Permission : models .PERMISSION_VIEW ,
91
91
}
92
92
93
- err := bus .DispatchCtx (c .Req .Context (), & searchQuery )
93
+ err := bus .Dispatch (c .Req .Context (), & searchQuery )
94
94
if err != nil {
95
95
return response .Error (500 , "List alerts failed" , err )
96
96
}
@@ -121,7 +121,7 @@ func GetAlerts(c *models.ReqContext) response.Response {
121
121
query .State = states
122
122
}
123
123
124
- if err := bus .DispatchCtx (c .Req .Context (), & query ); err != nil {
124
+ if err := bus .Dispatch (c .Req .Context (), & query ); err != nil {
125
125
return response .Error (500 , "List alerts failed" , err )
126
126
}
127
127
@@ -181,7 +181,7 @@ func GetAlert(c *models.ReqContext) response.Response {
181
181
id := c .ParamsInt64 (":alertId" )
182
182
query := models.GetAlertByIdQuery {Id : id }
183
183
184
- if err := bus .DispatchCtx (c .Req .Context (), & query ); err != nil {
184
+ if err := bus .Dispatch (c .Req .Context (), & query ); err != nil {
185
185
return response .Error (500 , "List alerts failed" , err )
186
186
}
187
187
@@ -232,7 +232,7 @@ func GetAlertNotifications(c *models.ReqContext) response.Response {
232
232
func getAlertNotificationsInternal (c * models.ReqContext ) ([]* models.AlertNotification , error ) {
233
233
query := & models.GetAllAlertNotificationsQuery {OrgId : c .OrgId }
234
234
235
- if err := bus .DispatchCtx (c .Req .Context (), query ); err != nil {
235
+ if err := bus .Dispatch (c .Req .Context (), query ); err != nil {
236
236
return nil , err
237
237
}
238
238
@@ -249,7 +249,7 @@ func GetAlertNotificationByID(c *models.ReqContext) response.Response {
249
249
return response .Error (404 , "Alert notification not found" , nil )
250
250
}
251
251
252
- if err := bus .DispatchCtx (c .Req .Context (), query ); err != nil {
252
+ if err := bus .Dispatch (c .Req .Context (), query ); err != nil {
253
253
return response .Error (500 , "Failed to get alert notifications" , err )
254
254
}
255
255
@@ -270,7 +270,7 @@ func GetAlertNotificationByUID(c *models.ReqContext) response.Response {
270
270
return response .Error (404 , "Alert notification not found" , nil )
271
271
}
272
272
273
- if err := bus .DispatchCtx (c .Req .Context (), query ); err != nil {
273
+ if err := bus .Dispatch (c .Req .Context (), query ); err != nil {
274
274
return response .Error (500 , "Failed to get alert notifications" , err )
275
275
}
276
276
@@ -288,7 +288,7 @@ func CreateAlertNotification(c *models.ReqContext) response.Response {
288
288
}
289
289
cmd .OrgId = c .OrgId
290
290
291
- if err := bus .DispatchCtx (c .Req .Context (), & cmd ); err != nil {
291
+ if err := bus .Dispatch (c .Req .Context (), & cmd ); err != nil {
292
292
if errors .Is (err , models .ErrAlertNotificationWithSameNameExists ) || errors .Is (err , models .ErrAlertNotificationWithSameUIDExists ) {
293
293
return response .Error (409 , "Failed to create alert notification" , err )
294
294
}
@@ -314,7 +314,7 @@ func (hs *HTTPServer) UpdateAlertNotification(c *models.ReqContext) response.Res
314
314
return response .Error (500 , "Failed to update alert notification" , err )
315
315
}
316
316
317
- if err := bus .DispatchCtx (c .Req .Context (), & cmd ); err != nil {
317
+ if err := bus .Dispatch (c .Req .Context (), & cmd ); err != nil {
318
318
if errors .Is (err , models .ErrAlertNotificationNotFound ) {
319
319
return response .Error (404 , err .Error (), err )
320
320
}
@@ -330,7 +330,7 @@ func (hs *HTTPServer) UpdateAlertNotification(c *models.ReqContext) response.Res
330
330
Id : cmd .Id ,
331
331
}
332
332
333
- if err := bus .DispatchCtx (c .Req .Context (), & query ); err != nil {
333
+ if err := bus .Dispatch (c .Req .Context (), & query ); err != nil {
334
334
return response .Error (500 , "Failed to get alert notification" , err )
335
335
}
336
336
@@ -350,7 +350,7 @@ func (hs *HTTPServer) UpdateAlertNotificationByUID(c *models.ReqContext) respons
350
350
return response .Error (500 , "Failed to update alert notification" , err )
351
351
}
352
352
353
- if err := bus .DispatchCtx (c .Req .Context (), & cmd ); err != nil {
353
+ if err := bus .Dispatch (c .Req .Context (), & cmd ); err != nil {
354
354
if errors .Is (err , models .ErrAlertNotificationNotFound ) {
355
355
return response .Error (404 , err .Error (), nil )
356
356
}
@@ -362,7 +362,7 @@ func (hs *HTTPServer) UpdateAlertNotificationByUID(c *models.ReqContext) respons
362
362
Uid : cmd .Uid ,
363
363
}
364
364
365
- if err := bus .DispatchCtx (c .Req .Context (), & query ); err != nil {
365
+ if err := bus .Dispatch (c .Req .Context (), & query ); err != nil {
366
366
return response .Error (500 , "Failed to get alert notification" , err )
367
367
}
368
368
@@ -379,7 +379,7 @@ func (hs *HTTPServer) fillWithSecureSettingsData(ctx context.Context, cmd *model
379
379
Id : cmd .Id ,
380
380
}
381
381
382
- if err := bus .DispatchCtx (ctx , query ); err != nil {
382
+ if err := bus .Dispatch (ctx , query ); err != nil {
383
383
return err
384
384
}
385
385
@@ -407,7 +407,7 @@ func (hs *HTTPServer) fillWithSecureSettingsDataByUID(ctx context.Context, cmd *
407
407
Uid : cmd .Uid ,
408
408
}
409
409
410
- if err := bus .DispatchCtx (ctx , query ); err != nil {
410
+ if err := bus .Dispatch (ctx , query ); err != nil {
411
411
return err
412
412
}
413
413
@@ -431,7 +431,7 @@ func DeleteAlertNotification(c *models.ReqContext) response.Response {
431
431
Id : c .ParamsInt64 (":notificationId" ),
432
432
}
433
433
434
- if err := bus .DispatchCtx (c .Req .Context (), & cmd ); err != nil {
434
+ if err := bus .Dispatch (c .Req .Context (), & cmd ); err != nil {
435
435
if errors .Is (err , models .ErrAlertNotificationNotFound ) {
436
436
return response .Error (404 , err .Error (), nil )
437
437
}
@@ -447,7 +447,7 @@ func DeleteAlertNotificationByUID(c *models.ReqContext) response.Response {
447
447
Uid : web .Params (c .Req )[":uid" ],
448
448
}
449
449
450
- if err := bus .DispatchCtx (c .Req .Context (), & cmd ); err != nil {
450
+ if err := bus .Dispatch (c .Req .Context (), & cmd ); err != nil {
451
451
if errors .Is (err , models .ErrAlertNotificationNotFound ) {
452
452
return response .Error (404 , err .Error (), nil )
453
453
}
@@ -475,7 +475,7 @@ func NotificationTest(c *models.ReqContext) response.Response {
475
475
SecureSettings : dto .SecureSettings ,
476
476
}
477
477
478
- if err := bus .DispatchCtx (c .Req .Context (), cmd ); err != nil {
478
+ if err := bus .Dispatch (c .Req .Context (), cmd ); err != nil {
479
479
if errors .Is (err , models .ErrSmtpNotEnabled ) {
480
480
return response .Error (412 , err .Error (), err )
481
481
}
@@ -501,7 +501,7 @@ func PauseAlert(c *models.ReqContext) response.Response {
501
501
result ["alertId" ] = alertID
502
502
503
503
query := models.GetAlertByIdQuery {Id : alertID }
504
- if err := bus .DispatchCtx (c .Req .Context (), & query ); err != nil {
504
+ if err := bus .Dispatch (c .Req .Context (), & query ); err != nil {
505
505
return response .Error (500 , "Get Alert failed" , err )
506
506
}
507
507
@@ -531,7 +531,7 @@ func PauseAlert(c *models.ReqContext) response.Response {
531
531
Paused : dto .Paused ,
532
532
}
533
533
534
- if err := bus .DispatchCtx (c .Req .Context (), & cmd ); err != nil {
534
+ if err := bus .Dispatch (c .Req .Context (), & cmd ); err != nil {
535
535
return response .Error (500 , "" , err )
536
536
}
537
537
@@ -557,7 +557,7 @@ func PauseAllAlerts(c *models.ReqContext) response.Response {
557
557
Paused : dto .Paused ,
558
558
}
559
559
560
- if err := bus .DispatchCtx (c .Req .Context (), & updateCmd ); err != nil {
560
+ if err := bus .Dispatch (c .Req .Context (), & updateCmd ); err != nil {
561
561
return response .Error (500 , "Failed to pause alerts" , err )
562
562
}
563
563
0 commit comments