color message popup

This commit is contained in:
Christian Herzog
2019-10-05 10:44:59 +02:00
parent 2f8d5759f4
commit ed18b4a8ce

View File

@@ -188,7 +188,7 @@ $(document).ready(function(){
error: function (xhr, ajaxOptions, thrownError) { error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status); console.log(xhr.status);
console.log(thrownError); console.log(thrownError);
if (thrownError != '') showMessage(thrownError); if (thrownError != '') showMessage(thrownError, 'ERROR');
} }
}); });
console.log('sent config JSON with headers:', autoexec); console.log('sent config JSON with headers:', autoexec);
@@ -202,7 +202,7 @@ $(document).ready(function(){
error: function (xhr, ajaxOptions, thrownError) { error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status); console.log(xhr.status);
console.log(thrownError); console.log(thrownError);
if (thrownError != '') showMessage(thrownError); if (thrownError != '') showMessage(thrownError, 'ERROR');
} }
}); });
}); });
@@ -222,7 +222,7 @@ $(document).ready(function(){
error: function (xhr, ajaxOptions, thrownError) { error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status); console.log(xhr.status);
console.log(thrownError); console.log(thrownError);
if (thrownError != '') showMessage(thrownError); if (thrownError != '') showMessage(thrownError, 'ERROR');
} }
}); });
console.log('sent config JSON with headers:', autoexec1); console.log('sent config JSON with headers:', autoexec1);
@@ -249,7 +249,7 @@ $(document).ready(function(){
error: function (xhr, ajaxOptions, thrownError) { error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status); console.log(xhr.status);
console.log(thrownError); console.log(thrownError);
if (thrownError != '') showMessage(thrownError); if (thrownError != '') showMessage(thrownError, 'ERROR');
} }
}); });
console.log('sent config JSON with headers:', JSON.stringify(headers)); console.log('sent config JSON with headers:', JSON.stringify(headers));
@@ -282,7 +282,7 @@ $(document).ready(function(){
error: function (xhr, ajaxOptions, thrownError) { error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status); console.log(xhr.status);
console.log(thrownError); console.log(thrownError);
if (thrownError != '') showMessage(thrownError); if (thrownError != '') showMessage(thrownError, 'ERROR');
} }
}); });
console.log('sent config JSON with headers:', JSON.stringify(headers)); console.log('sent config JSON with headers:', JSON.stringify(headers));
@@ -304,7 +304,7 @@ $(document).ready(function(){
error: function (xhr, ajaxOptions, thrownError) { error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status); console.log(xhr.status);
console.log(thrownError); console.log(thrownError);
if (thrownError != '') showMessage(thrownError); if (thrownError != '') showMessage(thrownError, 'ERROR');
} }
}); });
enableStatusTimer = true; enableStatusTimer = true;
@@ -467,7 +467,7 @@ function performConnect(conntype){
error: function (xhr, ajaxOptions, thrownError) { error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status); console.log(xhr.status);
console.log(thrownError); console.log(thrownError);
if (thrownError != '') showMessage(thrownError); if (thrownError != '') showMessage(thrownError, 'ERROR');
} }
}); });
@@ -643,9 +643,10 @@ function checkStatus(){
$("span#flash-status").html(''); $("span#flash-status").html('');
} }
if (data.hasOwnProperty('message') && data['message'] != ''){ if (data.hasOwnProperty('message') && data['message'] != ''){
var msg = data['message']; var msg = data['message'].text;
var severity = data['message'].severity;
if (msg != lastMsg) { if (msg != lastMsg) {
showMessage(msg); showMessage(msg, severity);
lastMsg = msg; lastMsg = msg;
} }
} }
@@ -697,7 +698,14 @@ function getConfig() {
}); });
} }
function showMessage(message) { function showMessage(message, severity) {
if (severity == 'INFO') {
$('#message').css('background', '#6af');
} else if (severity == 'WARNING') {
$('#message').css('background', '#ff0');
} else {
$('#message').css('background', '#f00');
}
$('#message').html(message); $('#message').html(message);
$("#content").fadeTo("slow", 0.3, function() { $("#content").fadeTo("slow", 0.3, function() {
$("#message").show(500).delay(5000).hide(500, function() { $("#message").show(500).delay(5000).hide(500, function() {