fix(notifications): added form validation and restored Send Test button which was always hidden, #6159

This commit is contained in:
Torkel Ödegaard
2016-10-01 17:14:45 +02:00
parent c6cf6d4655
commit 4ec2377e09
3 changed files with 73 additions and 69 deletions

View File

@@ -7,6 +7,7 @@ import config from 'app/core/config';
export class AlertNotificationEditCtrl {
model: any;
theForm: any;
testSeverity: string = "critical";
/** @ngInject */
@@ -35,6 +36,10 @@ export class AlertNotificationEditCtrl {
}
save() {
if (!this.theForm.$valid) {
return;
}
if (this.model.id) {
this.backendSrv.put(`/api/alert-notifications/${this.model.id}`, this.model).then(res => {
this.model = res;
@@ -53,6 +58,10 @@ export class AlertNotificationEditCtrl {
}
testNotification() {
if (!this.theForm.$valid) {
return;
}
var payload = {
name: this.model.name,
type: this.model.type,