Dont overwrite more severe visible statuses
And only show the first error. This means that if UI.showStatus() is called for a new error while one error is already showing, the new error will not be shown. However, if a warning was showing and a new error comes up, the warning will be overwritten.
This commit is contained in:
parent
d472f3f19e
commit
d623a029d6
33
app/ui.js
33
app/ui.js
|
@ -479,21 +479,40 @@ var UI = {
|
||||||
status_type = 'normal';
|
status_type = 'normal';
|
||||||
}
|
}
|
||||||
|
|
||||||
statusElem.classList.remove("noVNC_status_normal");
|
// Don't overwrite more severe visible statuses and never
|
||||||
statusElem.classList.remove("noVNC_status_warn");
|
// errors. Only shows the first error.
|
||||||
statusElem.classList.remove("noVNC_status_error");
|
let visible_status_type = 'none';
|
||||||
|
if (statusElem.classList.contains("noVNC_open")) {
|
||||||
|
if (statusElem.classList.contains("noVNC_status_error")) {
|
||||||
|
visible_status_type = 'error';
|
||||||
|
} else if (statusElem.classList.contains("noVNC_status_warn")) {
|
||||||
|
visible_status_type = 'warn';
|
||||||
|
} else {
|
||||||
|
visible_status_type = 'normal';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (visible_status_type === 'error' ||
|
||||||
|
(visible_status_type === 'warn' && status_type === 'normal')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (status_type) {
|
switch (status_type) {
|
||||||
|
case 'error':
|
||||||
|
statusElem.classList.remove("noVNC_status_warn");
|
||||||
|
statusElem.classList.remove("noVNC_status_normal");
|
||||||
|
statusElem.classList.add("noVNC_status_error");
|
||||||
|
break;
|
||||||
case 'warning':
|
case 'warning':
|
||||||
case 'warn':
|
case 'warn':
|
||||||
|
statusElem.classList.remove("noVNC_status_error");
|
||||||
|
statusElem.classList.remove("noVNC_status_normal");
|
||||||
statusElem.classList.add("noVNC_status_warn");
|
statusElem.classList.add("noVNC_status_warn");
|
||||||
break;
|
break;
|
||||||
case 'error':
|
|
||||||
statusElem.classList.add("noVNC_status_error");
|
|
||||||
break;
|
|
||||||
case 'normal':
|
case 'normal':
|
||||||
case 'info':
|
case 'info':
|
||||||
default:
|
default:
|
||||||
|
statusElem.classList.remove("noVNC_status_error");
|
||||||
|
statusElem.classList.remove("noVNC_status_warn");
|
||||||
statusElem.classList.add("noVNC_status_normal");
|
statusElem.classList.add("noVNC_status_normal");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -993,6 +1012,8 @@ var UI = {
|
||||||
password = undefined;
|
password = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UI.hideStatus();
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
Log.Error("Can't connect when host is: " + host);
|
Log.Error("Can't connect when host is: " + host);
|
||||||
UI.showStatus(_("Must set host"), 'error');
|
UI.showStatus(_("Must set host"), 'error');
|
||||||
|
|
Loading…
Reference in New Issue