mirror of
https://codeberg.org/prof_x_pvt_ltd/captive.whump.shanti-portal
synced 2024-08-14 22:46:42 +00:00
fixed the error message for promise timeout and failure.
This commit is contained in:
parent
2c58ddf3a9
commit
f4d2f10148
3 changed files with 22 additions and 11 deletions
|
@ -9,10 +9,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.msgbox {
|
.msgbox {
|
||||||
border-radius: 25px;
|
border: 1px solid;
|
||||||
padding: 15px;
|
margin: 10px 0px;
|
||||||
|
padding:15px 10px 15px 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msgbox-error {
|
.msgbox-error {
|
||||||
background: #ff4000;
|
color: #D8000C;
|
||||||
|
background-color: #FFBABA;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ var debug = true;
|
||||||
// all jobs have succeeded in the portal software.
|
// all jobs have succeeded in the portal software.
|
||||||
function do_success() {
|
function do_success() {
|
||||||
console.log('success: '+window.location);
|
console.log('success: '+window.location);
|
||||||
|
|
||||||
// Do something like refresh the window or go to another URL.
|
// Do something like refresh the window or go to another URL.
|
||||||
window.location = window.href;
|
window.location = window.href;
|
||||||
location.reload(true);
|
location.reload(true);
|
||||||
|
@ -16,11 +17,13 @@ function do_success() {
|
||||||
|
|
||||||
// Show an error to the user
|
// Show an error to the user
|
||||||
function do_error(message) {
|
function do_error(message) {
|
||||||
$('#error-row').show();
|
console.log('failure: '+message);
|
||||||
|
|
||||||
|
$('#error-box').show();
|
||||||
$('#form-row').hide();
|
$('#form-row').hide();
|
||||||
$('#error-message').val('Failed. Reload page and try again or contact support. ');
|
$('#error-box').append('<p>Failed. Reload page and try again or contact support.</p> ');
|
||||||
if (message) {
|
if (message) {
|
||||||
$('#error-message').append('System response: '+message);
|
$('#error-box').append('<p>System response: '+message+'</p>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,14 +64,15 @@ function poll_jobs(data) {
|
||||||
console.log('Resolving job: ', job_result.id);
|
console.log('Resolving job: ', job_result.id);
|
||||||
resolve(job_result);
|
resolve(job_result);
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
return;
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(job_result.is_failed) {
|
if(job_result.is_failed) {
|
||||||
console.log('Job failed: ', job_result.id);
|
console.log('Job failed: ', job_result.id);
|
||||||
reject(job_result);
|
reject(job_result);
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
return;
|
return(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ajaxReq.fail(function(XMLHttpRequest, textStatus, errorThrown) {
|
ajaxReq.fail(function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
|
@ -113,6 +117,12 @@ function poll_jobs(data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#error-box').hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Submit the form
|
// Submit the form
|
||||||
$('#approveForm').submit(function (event) {
|
$('#approveForm').submit(function (event) {
|
||||||
var api_url = '/approve';
|
var api_url = '/approve';
|
||||||
|
|
|
@ -38,9 +38,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form id="approveForm" method="post">
|
<form id="approveForm" method="post">
|
||||||
<div id="error-row" class="row" style="visibility:hidden;">
|
<div class="row">
|
||||||
<div class="five columns msgbox msgbox-error">
|
<div id="error-box" class="five columns msgbox msgbox-error">
|
||||||
<p id="error-message"></p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue