Sha256: cd8b4ab9234f409cb8890d0395d4b32c62569c06c548eafc0511bdb333ab6d68
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
var mnoHub = {}; mnoHub.check = function() { var xhr = new XMLHttpRequest(); mnoHub.notify("Checking..."); xhr.onreadystatechange = function() { if (xhr.readyState == XMLHttpRequest.DONE ) { console.log (xhr.status); if(xhr.status < 500) { mnoHub.notify("Application is now running! Redirecting...") mnoHub.stopAutoCheck(); return window.setTimeout(function() { return mnoHub.redirect(); }, 4 * 1000); } window.setTimeout(function() { mnoHub.notify(''); }, 1 * 1000); } } xhr.ontimeout = function () { mnoHub.notify(''); } xhr.timeout = 15000; //15 seconds xhr.open("GET", "/mnoe/health_check/full.json", true); xhr.send(); }; mnoHub.redirect = function() { return window.location.href = "/"; }; mnoHub.startAutoCheck = function() { // For 500 error, we should not keep auto refreshing the page till bug // is resolved manually by our team. var page_error_code = document.getElementById('status_code').value; if(parseInt(page_error_code) == 500) { return; } return mnoHub.timerId = window.setInterval(function() { return mnoHub.check(); }, 10 * 1000); }; mnoHub.stopAutoCheck = function() { if (mnoHub.timerId != null) { return window.clearInterval(mnoHub.timerId); } }; mnoHub.notify = function(msg) { var elem = document.getElementById('error-loader'); elem.innerHTML = msg; } mnoHub.startAutoCheck();
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mno-enterprise-api-3.4.0 | app/assets/javascripts/mno_enterprise/error_page.js |
mno-enterprise-api-3.3.3 | app/assets/javascripts/mno_enterprise/error_page.js |