Skip to content

Commit 30645a6

Browse files
committed
refactor(alerting): initial step for seperating alerting and dash model, grafana#6273
1 parent 4c26c55 commit 30645a6

File tree

7 files changed

+678
-642
lines changed

7 files changed

+678
-642
lines changed

pkg/api/alerting.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func NotificationTest(c *middleware.Context, dto dtos.NotificationTestCommand) R
252252
return ApiSuccess("Test notification sent")
253253
}
254254

255-
//POST /api/:alertId/pause
255+
//POST /api/alerts/:alertId/pause
256256
func PauseAlert(c *middleware.Context, dto dtos.PauseAlertCommand) Response {
257257
cmd := models.PauseAlertCommand{
258258
OrgId: c.OrgId,
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
///<reference path="../../headers/common.d.ts" />
2+
3+
import config from 'app/core/config';
4+
import angular from 'angular';
5+
import moment from 'moment';
6+
import _ from 'lodash';
7+
8+
import coreModule from 'app/core/core_module';
9+
10+
export class AlertingSrv {
11+
dashboard: any;
12+
alerts: any[];
13+
14+
init(dashboard, alerts) {
15+
this.dashboard = dashboard;
16+
this.alerts = alerts || [];
17+
}
18+
}
19+
20+
21+
coreModule.service('alertingSrv', AlertingSrv);
22+

public/app/features/dashboard/all.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
define([
22
'./dashboard_ctrl',
3+
'./alerting_srv',
34
'./dashboardLoaderSrv',
45
'./dashnav/dashnav',
56
'./submenu/submenu',

public/app/features/dashboard/dashboard_ctrl.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export class DashboardCtrl {
1616
dashboardKeybindings,
1717
timeSrv,
1818
variableSrv,
19+
alertingSrv,
1920
dashboardSrv,
2021
unsavedChangesSrv,
2122
dynamicDashboardSrv,
@@ -43,6 +44,7 @@ export class DashboardCtrl {
4344

4445
// init services
4546
timeSrv.init(dashboard);
47+
alertingSrv.init(dashboard, data.alerts);
4648

4749
// template values service needs to initialize completely before
4850
// the rest of the dashboard can load

0 commit comments

Comments
 (0)