]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Ensure warning status timeouts are honored
authorSamuel Mannehed <samuel@cendio.se>
Mon, 25 Nov 2019 15:38:03 +0000 (16:38 +0100)
committerSamuel Mannehed <samuel@cendio.se>
Mon, 25 Nov 2019 15:38:03 +0000 (16:38 +0100)
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.

app/ui.js

index 48e4d136293924c7432e83b0e4d9d8d22cd423fd..0eca9a4bdfa4ec04eb67929743ad99820e53a079 100644 (file)
--- a/app/ui.js
+++ b/app/ui.js
@@ -447,8 +447,6 @@ const UI = {
     showStatus(text, status_type, time) {
         const statusElem = document.getElementById('noVNC_status');
 
-        clearTimeout(UI.statusTimeout);
-
         if (typeof status_type === 'undefined') {
             status_type = 'normal';
         }
@@ -470,6 +468,8 @@ const UI = {
             return;
         }
 
+        clearTimeout(UI.statusTimeout);
+
         switch (status_type) {
             case 'error':
                 statusElem.classList.remove("noVNC_status_warn");