mirror of
https://github.com/ansible/awx.git
synced 2026-01-28 00:51:27 -03:30
Check status of test notifications.
The response from the PUT call to the notifications_templates/<id>/test endpoint contains an ID to be used to perform a lookup off of the notifications endpoint in order to obtain the status.
This commit is contained in:
parent
4743723ec0
commit
80815305c5
@ -1,4 +1,4 @@
|
||||
/*************************************************
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
@ -150,11 +150,33 @@ export default
|
||||
var name = this.notification_template.name;
|
||||
Rest.setUrl(defaultUrl + this.notification_template.id +'/test/');
|
||||
Rest.post({})
|
||||
.then(function () {
|
||||
ngToast.success({
|
||||
content: `<i class="fa fa-check-circle Toast-successIcon"></i> <b>${name}:</b> Notification Succeeded.`,
|
||||
});
|
||||
.then(function (data) {
|
||||
if(data && data.data && data.data.notification){
|
||||
Wait('start');
|
||||
setTimeout(function(){
|
||||
console.log('in set timeout');
|
||||
var id = data.data.notification,
|
||||
url = GetBasePath('notifications') + id;
|
||||
Rest.setUrl(url);
|
||||
Rest.get()
|
||||
.then(function (res) {
|
||||
Wait('stop');
|
||||
if(res && res.data && res.data.status && res.data.status === "successful"){
|
||||
ngToast.success({
|
||||
content: `<i class="fa fa-check-circle Toast-successIcon"></i> <b>${name}:</b> Notification Succeeded.`,
|
||||
dismissOnTimeout: false
|
||||
});
|
||||
}
|
||||
else if(res && res.data && res.data.status && res.data.status === "failed"){
|
||||
ngToast.danger({
|
||||
content: `<i class="fa fa-check-circle Toast-successIcon"></i> <b>${name}:</b> Notification Failed.`,
|
||||
dismissOnTimeout: false
|
||||
});
|
||||
}
|
||||
});
|
||||
} , 5000);
|
||||
|
||||
}
|
||||
})
|
||||
.catch(function () {
|
||||
ngToast.danger({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user