Production bugs

This commit is contained in:
Juan Ferrer Toribio 2018-01-17 14:16:52 +01:00
parent 7d484fcb7e
commit 8739fd4094
3 changed files with 17 additions and 23 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.405.68) stable; urgency=low hedera-web (1.405.69) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -1,6 +1,6 @@
{ {
"name": "hedera-web", "name": "hedera-web",
"version": "1.405.68", "version": "1.405.69",
"description": "Verdnatura web page", "description": "Verdnatura web page",
"license": "GPL-3.0", "license": "GPL-3.0",
"repository": { "repository": {

View File

@ -8,20 +8,18 @@ var requestInterval = INTERVAL;
var failedRequests = 0; var failedRequests = 0;
var timeoutId = null; var timeoutId = null;
var request = null; var request = null;
var lastText; var myText;
var lastStatus; var myStatus;
var lastError; var myError;
function onBodyLoad () function onBodyLoad ()
{ {
setText (); setTimeout (setText, 1000);
} }
function setText () function setText ()
{ {
lastText = null; display (null, null, null);
lastStatus = null;
lastError = null;
updateText (); updateText ();
} }
@ -102,7 +100,7 @@ function onRequestChange (request)
} }
catch (e) catch (e)
{ {
display (null, null, e.message); display (myText, myStatus, e.message);
console.error (e.message); console.error (e.message);
failedRequests++; failedRequests++;
@ -119,20 +117,15 @@ function onRequestChange (request)
function display (text, status, error) function display (text, status, error)
{ {
if (error) if (text === myText && status === myStatus && error === myError)
{
text = lastText;
status = lastStatus;
}
if (text === lastText && status === lastStatus && error === lastError)
return; return;
var bgColor; var bgColor;
$('text').textContent = text; var body = document.body;
if (error) if (error)
{ {
text = text ? text : 'Er';
$('error').textContent = error; $('error').textContent = error;
$('error').style.display = 'block'; $('error').style.display = 'block';
bgColor = 'red'; bgColor = 'red';
@ -144,13 +137,15 @@ function display (text, status, error)
bgColor = 'green'; bgColor = 'green';
} }
var body = document.body; $('text').textContent = text;
body.className = status ? status : '';
body.addEventListener ('transitionend', onTransitionEnd); body.addEventListener ('transitionend', onTransitionEnd);
body.style.backgroundColor = bgColor; body.style.backgroundColor = bgColor;
lastText = text; myText = text;
lastStatus = status; myStatus = status;
lastError = error; myError = error;
} }
function onTransitionEnd () function onTransitionEnd ()
@ -158,7 +153,6 @@ function onTransitionEnd ()
var body = document.body; var body = document.body;
body.removeEventListener ('transitionend', onTransitionEnd); body.removeEventListener ('transitionend', onTransitionEnd);
body.style.backgroundColor = ''; body.style.backgroundColor = '';
body.className = lastStatus ? lastStatus : '';
} }
function $ (elementId) function $ (elementId)