Commit f5809c02 by Torkel Ödegaard

fix(build): trying to fix build

parent 9cd51778
package notifiers
import . "github.com/smartystreets/goconvey/convey"
func TestBaseNotifier( /* t *testing.T */ ) {
// Convey("Parsing base notification state", t, func() {
//
// Convey("matches", func() {
// json := `
// {
// "states": "critical"
// }`
//
// settingsJSON, _ := simplejson.NewJson([]byte(json))
// not := NewNotifierBase("ops", "email", settingsJSON)
// So(not.MatchSeverity(m.AlertSeverityCritical), ShouldBeTrue)
// })
//
// Convey("does not match", func() {
// json := `
// {
// "severityFilter": "critical"
// }`
//
// settingsJSON, _ := simplejson.NewJson([]byte(json))
// not := NewNotifierBase("ops", "email", settingsJSON)
// So(not.MatchSeverity(m.AlertSeverityWarning), ShouldBeFalse)
// })
// })
}
// import . "github.com/smartystreets/goconvey/convey"
//
// func TestBaseNotifier( t *testing.T ) {
// Convey("Parsing base notification state", t, func() {
//
// Convey("matches", func() {
// json := `
// {
// "states": "critical"
// }`
//
// settingsJSON, _ := simplejson.NewJson([]byte(json))
// not := NewNotifierBase("ops", "email", settingsJSON)
// So(not.MatchSeverity(m.AlertSeverityCritical), ShouldBeTrue)
// })
//
// Convey("does not match", func() {
// json := `
// {
// "severityFilter": "critical"
// }`
//
// settingsJSON, _ := simplejson.NewJson([]byte(json))
// not := NewNotifierBase("ops", "email", settingsJSON)
// So(not.MatchSeverity(m.AlertSeverityWarning), ShouldBeFalse)
// })
// })
// }
......@@ -35,38 +35,34 @@ func handleNotificationTestCommand(cmd *NotificationTestCommand) error {
return err
}
notifier.sendNotifications([]Notifier{notifiers}, createTestEvalContext(cmd.State))
notifier.sendNotifications([]Notifier{notifiers}, createTestEvalContext())
return nil
}
func createTestEvalContext(state m.AlertStateType) *EvalContext {
func createTestEvalContext() *EvalContext {
testRule := &Rule{
DashboardId: 1,
PanelId: 1,
Name: "Test notification",
Message: "Someone is testing the alert notification within grafana.",
State: state,
State: m.AlertStateAlerting,
}
ctx := NewEvalContext(testRule)
ctx.ImagePublicUrl = "http://grafana.org/assets/img/blog/mixed_styles.png"
ctx.IsTestRun = true
ctx.Firing = state == m.AlertStateAlerting
ctx.Firing = true
ctx.Error = nil
ctx.EvalMatches = evalMatchesBasedOnState(state)
ctx.EvalMatches = evalMatchesBasedOnState()
return ctx
}
func evalMatchesBasedOnState(state m.AlertStateType) []*EvalMatch {
func evalMatchesBasedOnState() []*EvalMatch {
matches := make([]*EvalMatch, 0)
if state == m.AlertStateOK {
return matches
}
matches = append(matches, &EvalMatch{
Metric: "High value",
Value: 100,
......
......@@ -62,7 +62,6 @@ export class AlertNotificationEditCtrl {
name: this.model.name,
type: this.model.type,
settings: this.model.settings,
severity: this.testSeverity
};
this.backendSrv.post(`/api/alert-notifications/test`, payload)
......
......@@ -26,15 +26,6 @@
</div>
</div>
<div class="gf-form">
<span class="gf-form-label width-12">Severity filter</span>
<div class="gf-form-select-wrapper width-15">
<select class="gf-form-input"
ng-model="ctrl.model.settings.severityFilter"
ng-options="t for t in ['none', 'critical', 'warning']">
</select>
</div>
</div>
<div class="gf-form">
<gf-form-switch
class="gf-form"
label="Send on all alerts"
......@@ -86,16 +77,7 @@
<div class="gf-form width-8">
<button ng-click="ctrl.toggleTest()" class="btn btn-secondary">Test</button>
</div>
<div class="gf-form width-20" ng-show="ctrl.showTest">
<span class="gf-form-label width-13">Severity for test notification</span>
<div class="gf-form-select-wrapper width-7">
<select class="gf-form-input"
ng-model="ctrl.testSeverity"
ng-options="t for t in ['critical', 'warning', 'ok']">
</select>
</div>
</div>
<div class="gf-form" ng-show="ctrl.showTest">
<button ng-click="ctrl.testNotification()" class="btn btn-secondary">Send</button>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment