mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
alert notifiers: better error messages.
This commit is contained in:
parent
651103bdda
commit
3ddfd8bd09
@ -58,15 +58,29 @@ export class AlertNotificationEditCtrl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.model.id) {
|
if (this.model.id) {
|
||||||
this.backendSrv.put(`/api/alert-notifications/${this.model.id}`, this.model).then(res => {
|
this.backendSrv
|
||||||
this.model = res;
|
.put(`/api/alert-notifications/${this.model.id}`, this.model)
|
||||||
appEvents.emit('alert-success', ['Notification updated', '']);
|
.then(res => {
|
||||||
});
|
this.model = res;
|
||||||
|
appEvents.emit('alert-success', ['Notification updated', '']);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
if (err.data && err.data.error) {
|
||||||
|
appEvents.emit('alert-error', [err.data.error]);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this.backendSrv.post(`/api/alert-notifications`, this.model).then(res => {
|
this.backendSrv
|
||||||
appEvents.emit('alert-success', ['Notification created', '']);
|
.post(`/api/alert-notifications`, this.model)
|
||||||
this.$location.path('alerting/notifications');
|
.then(res => {
|
||||||
});
|
appEvents.emit('alert-success', ['Notification created', '']);
|
||||||
|
this.$location.path('alerting/notifications');
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
if (err.data && err.data.error) {
|
||||||
|
appEvents.emit('alert-error', [err.data.error]);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user