Ensure warning status timeouts are honored

When showing a new status popup we want to set a timer for how long to
show it. In cases where we show many statuses in a fast succession we
need to remove any running timeouts when showing a new one.

There are exceptions when new statuses won't be shown, and thats if a
more severe status is already showing, i.e and error or a warning.

Warnings can still have timeouts. There was a bug that occured when we
tried to show a normal status while a warning was showing. The bug
caused the warning status timeout to be removed even if the normal
status was never shown. We should only remove running timeouts if we're
actually going to show a new status.
This commit is contained in:
Samuel Mannehed 2019-11-25 16:38:03 +01:00 committed by Lauri Kasanen
parent 29db8997ec
commit 0bf9403a36

View File

@ -517,8 +517,6 @@ const UI = {
showStatus(text, status_type, time) { showStatus(text, status_type, time) {
const statusElem = document.getElementById('noVNC_status'); const statusElem = document.getElementById('noVNC_status');
clearTimeout(UI.statusTimeout);
if (typeof status_type === 'undefined') { if (typeof status_type === 'undefined') {
status_type = 'normal'; status_type = 'normal';
} }
@ -540,6 +538,8 @@ const UI = {
return; return;
} }
clearTimeout(UI.statusTimeout);
switch (status_type) { switch (status_type) {
case 'error': case 'error':
statusElem.classList.remove("noVNC_status_warn"); statusElem.classList.remove("noVNC_status_warn");