mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Changing wording and styling of notification toaster message
and adding some better error handling for failed notifications.
This commit is contained in:
parent
80815305c5
commit
4d7bc6e101
@ -153,8 +153,10 @@ export default
|
|||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
if(data && data.data && data.data.notification){
|
if(data && data.data && data.data.notification){
|
||||||
Wait('start');
|
Wait('start');
|
||||||
|
// Using a setTimeout here to wait for the
|
||||||
|
// notification to be processed and for a status
|
||||||
|
// to be returned from the API.
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
console.log('in set timeout');
|
|
||||||
var id = data.data.notification,
|
var id = data.data.notification,
|
||||||
url = GetBasePath('notifications') + id;
|
url = GetBasePath('notifications') + id;
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
@ -163,19 +165,24 @@ export default
|
|||||||
Wait('stop');
|
Wait('stop');
|
||||||
if(res && res.data && res.data.status && res.data.status === "successful"){
|
if(res && res.data && res.data.status && res.data.status === "successful"){
|
||||||
ngToast.success({
|
ngToast.success({
|
||||||
content: `<i class="fa fa-check-circle Toast-successIcon"></i> <b>${name}:</b> Notification Succeeded.`,
|
content: `<i class="fa fa-check-circle Toast-successIcon"></i> <b>${name}:</b> Notification sent.`
|
||||||
dismissOnTimeout: false
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if(res && res.data && res.data.status && res.data.status === "failed"){
|
else if(res && res.data && res.data.status && res.data.status === "failed"){
|
||||||
ngToast.danger({
|
ngToast.danger({
|
||||||
content: `<i class="fa fa-check-circle Toast-successIcon"></i> <b>${name}:</b> Notification Failed.`,
|
content: `<i class="fa fa-check-circle Toast-successIcon"></i> <b>${name}:</b> Notification failed.`
|
||||||
dismissOnTimeout: false
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Call to ' + url + ' failed. Notification returned status: ' + status });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} , 5000);
|
} , 5000);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Call to notifcatin templates failed. Notification returned status: ' + status });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function () {
|
.catch(function () {
|
||||||
|
@ -13,6 +13,11 @@
|
|||||||
color: @default-bg;
|
color: @default-bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.alert-danger{
|
||||||
|
background-color: @default-err;
|
||||||
|
color: @default-bg;
|
||||||
|
}
|
||||||
|
|
||||||
.Toast-successIcon{
|
.Toast-successIcon{
|
||||||
font-size: x-large;
|
font-size: x-large;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
Loading…
Reference in New Issue
Block a user