Skip to content

Commit f5809c0

Browse files
committed
fix(build): trying to fix build
1 parent 9cd5177 commit f5809c0

File tree

4 files changed

+34
-57
lines changed

4 files changed

+34
-57
lines changed
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
package notifiers
22

3-
import . "github.com/smartystreets/goconvey/convey"
4-
5-
func TestBaseNotifier( /* t *testing.T */ ) {
6-
// Convey("Parsing base notification state", t, func() {
7-
//
8-
// Convey("matches", func() {
9-
// json := `
10-
// {
11-
// "states": "critical"
12-
// }`
13-
//
14-
// settingsJSON, _ := simplejson.NewJson([]byte(json))
15-
// not := NewNotifierBase("ops", "email", settingsJSON)
16-
// So(not.MatchSeverity(m.AlertSeverityCritical), ShouldBeTrue)
17-
// })
18-
//
19-
// Convey("does not match", func() {
20-
// json := `
21-
// {
22-
// "severityFilter": "critical"
23-
// }`
24-
//
25-
// settingsJSON, _ := simplejson.NewJson([]byte(json))
26-
// not := NewNotifierBase("ops", "email", settingsJSON)
27-
// So(not.MatchSeverity(m.AlertSeverityWarning), ShouldBeFalse)
28-
// })
29-
// })
30-
}
3+
// import . "github.com/smartystreets/goconvey/convey"
4+
//
5+
// func TestBaseNotifier( t *testing.T ) {
6+
// Convey("Parsing base notification state", t, func() {
7+
//
8+
// Convey("matches", func() {
9+
// json := `
10+
// {
11+
// "states": "critical"
12+
// }`
13+
//
14+
// settingsJSON, _ := simplejson.NewJson([]byte(json))
15+
// not := NewNotifierBase("ops", "email", settingsJSON)
16+
// So(not.MatchSeverity(m.AlertSeverityCritical), ShouldBeTrue)
17+
// })
18+
//
19+
// Convey("does not match", func() {
20+
// json := `
21+
// {
22+
// "severityFilter": "critical"
23+
// }`
24+
//
25+
// settingsJSON, _ := simplejson.NewJson([]byte(json))
26+
// not := NewNotifierBase("ops", "email", settingsJSON)
27+
// So(not.MatchSeverity(m.AlertSeverityWarning), ShouldBeFalse)
28+
// })
29+
// })
30+
// }

pkg/services/alerting/test_notification.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,38 +35,34 @@ func handleNotificationTestCommand(cmd *NotificationTestCommand) error {
3535
return err
3636
}
3737

38-
notifier.sendNotifications([]Notifier{notifiers}, createTestEvalContext(cmd.State))
38+
notifier.sendNotifications([]Notifier{notifiers}, createTestEvalContext())
3939

4040
return nil
4141
}
4242

43-
func createTestEvalContext(state m.AlertStateType) *EvalContext {
43+
func createTestEvalContext() *EvalContext {
4444

4545
testRule := &Rule{
4646
DashboardId: 1,
4747
PanelId: 1,
4848
Name: "Test notification",
4949
Message: "Someone is testing the alert notification within grafana.",
50-
State: state,
50+
State: m.AlertStateAlerting,
5151
}
5252

5353
ctx := NewEvalContext(testRule)
5454
ctx.ImagePublicUrl = "http://grafana.org/assets/img/blog/mixed_styles.png"
5555

5656
ctx.IsTestRun = true
57-
ctx.Firing = state == m.AlertStateAlerting
57+
ctx.Firing = true
5858
ctx.Error = nil
59-
ctx.EvalMatches = evalMatchesBasedOnState(state)
59+
ctx.EvalMatches = evalMatchesBasedOnState()
6060

6161
return ctx
6262
}
6363

64-
func evalMatchesBasedOnState(state m.AlertStateType) []*EvalMatch {
64+
func evalMatchesBasedOnState() []*EvalMatch {
6565
matches := make([]*EvalMatch, 0)
66-
if state == m.AlertStateOK {
67-
return matches
68-
}
69-
7066
matches = append(matches, &EvalMatch{
7167
Metric: "High value",
7268
Value: 100,

public/app/features/alerting/notification_edit_ctrl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export class AlertNotificationEditCtrl {
6262
name: this.model.name,
6363
type: this.model.type,
6464
settings: this.model.settings,
65-
severity: this.testSeverity
6665
};
6766

6867
this.backendSrv.post(`/api/alert-notifications/test`, payload)

public/app/features/alerting/partials/notification_edit.html

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ <h1>Alert notification</h1>
2525
</select>
2626
</div>
2727
</div>
28-
<div class="gf-form">
29-
<span class="gf-form-label width-12">Severity filter</span>
30-
<div class="gf-form-select-wrapper width-15">
31-
<select class="gf-form-input"
32-
ng-model="ctrl.model.settings.severityFilter"
33-
ng-options="t for t in ['none', 'critical', 'warning']">
34-
</select>
35-
</div>
36-
</div>
3728
<div class="gf-form">
3829
<gf-form-switch
3930
class="gf-form"
@@ -86,16 +77,7 @@ <h3 class="page-heading">Email addresses</h3>
8677
<div class="gf-form width-8">
8778
<button ng-click="ctrl.toggleTest()" class="btn btn-secondary">Test</button>
8879
</div>
89-
9080
<div class="gf-form width-20" ng-show="ctrl.showTest">
91-
<span class="gf-form-label width-13">Severity for test notification</span>
92-
<div class="gf-form-select-wrapper width-7">
93-
<select class="gf-form-input"
94-
ng-model="ctrl.testSeverity"
95-
ng-options="t for t in ['critical', 'warning', 'ok']">
96-
</select>
97-
</div>
98-
</div>
9981
<div class="gf-form" ng-show="ctrl.showTest">
10082
<button ng-click="ctrl.testNotification()" class="btn btn-secondary">Send</button>
10183
</div>

0 commit comments

Comments
 (0)