diff options
Diffstat (limited to 'ishtar_common/static/js/ishtar.js')
-rw-r--r-- | ishtar_common/static/js/ishtar.js | 69 |
1 files changed, 61 insertions, 8 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index 483da495c..2750efcc2 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -413,7 +413,23 @@ $(document).on("click", '#progress-content', function(){ $('.modal-progress').hide(); }); -function long_wait(){ + +var closed_wait = true; + +function short_wait(check_wait){ + if (check_wait && closed_wait){ + return + } + closed_wait = false; + $('.modal-progress').modal('show'); + $('.progress-1').show('slow'); +} + +function long_wait(check_wait){ + if (check_wait && closed_wait){ + return + } + closed_wait = false; $('.modal-progress').modal('show'); $('.progress-1').show('slow'); setTimeout(function(){ @@ -430,11 +446,12 @@ function long_wait(){ }, 180000); setTimeout(function(){ $('.progress-4').hide('slow'); - long_wait(); + long_wait(true); }, 240000); } function close_wait(){ + closed_wait = true; $('.modal-progress').modal('hide'); if (current_modal){ $('body').addClass('modal-open'); @@ -771,12 +788,48 @@ var dt_generate_qa_url = function (table, url){ } url += value + "/"; return url; -} +}; var dt_qa_open = function (url){ - long_wait(); - $('#modal-dynamic-form').load(url, function(){ - close_wait(); - $('#modal-dynamic-form').modal("show"); + short_wait(); + $.ajax({ + url: url, + cache: false, + success: function(data, textStatus, jqXHR) { + close_wait(); + var text = jqXHR.responseText; + $('#modal-dynamic-form').html(text); + var response = $(text); + var responseScript = response.find("script"); + $.each(responseScript, function(idx, val){ + eval(val.text); + } + ); + $('#modal-dynamic-form').modal("show"); + }, + error: function() { + close_wait(); + } }); -} +}; + +var ajax_post = function(url, data, target, callback){ + $.ajax({ + url : url, + type : "POST", + data : data, + success : function(data) { + close_wait(); + $(target).html(data); + if(callback) callback(); + }, + error : function(xhr,errmsg,err) { + close_wait(); + $(target).html("<div class='alert-box alert'>Oops! We have encountered an error: " + + errmsg + "</div>"); + console.log(xhr.status + ": " + xhr.responseText); + if(callback) callback(); + } + }); + +}; |