[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract information from RFB to the UI #950

Merged
merged 9 commits into from
Nov 17, 2017
Prev Previous commit
Next Next commit
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.
  • Loading branch information
samhed committed Nov 14, 2017
commit d623a029d6bc2347781d85a40b67645eec2b8300
33 changes: 27 additions & 6 deletions app/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,21 +479,40 @@ var UI = {
status_type = 'normal';
}

statusElem.classList.remove("noVNC_status_normal");
statusElem.classList.remove("noVNC_status_warn");
statusElem.classList.remove("noVNC_status_error");
// Don't overwrite more severe visible statuses and never
// errors. Only shows the first 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) {
case 'error':
statusElem.classList.remove("noVNC_status_warn");
statusElem.classList.remove("noVNC_status_normal");
statusElem.classList.add("noVNC_status_error");
break;
case 'warning':
case 'warn':
statusElem.classList.remove("noVNC_status_error");
statusElem.classList.remove("noVNC_status_normal");
statusElem.classList.add("noVNC_status_warn");
break;
case 'error':
statusElem.classList.add("noVNC_status_error");
break;
case 'normal':
case 'info':
default:
statusElem.classList.remove("noVNC_status_error");
statusElem.classList.remove("noVNC_status_warn");
statusElem.classList.add("noVNC_status_normal");
break;
}
Expand Down Expand Up @@ -993,6 +1012,8 @@ var UI = {
password = undefined;
}

UI.hideStatus();

if (!host) {
Log.Error("Can't connect when host is: " + host);
UI.showStatus(_("Must set host"), 'error');
Expand Down