ui: improve console fallback logic if default is not available

instead of instantly defaulting to novnc when the chosen
default is not available, try the other (better variant)
before falling back to novnc

e.g. having no default set is equivalent to having it set
to xtermjs, and having a vm with spice then previously
defaulted to novnc, now to spice (the reverse is also true)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2019-07-12 13:33:07 +02:00 committed by Thomas Lamprecht
parent 54453c3873
commit f932cffa89

View File

@ -946,8 +946,10 @@ Ext.define('PVE.Utils', { utilities: {
allowXtermjs = !!consoles.xtermjs;
}
var dv = PVE.VersionInfo.console || 'xtermjs';
if ((dv === 'vv' && !allowSpice) || (dv === 'xtermjs' && !allowXtermjs)) {
dv = 'html5';
if (dv === 'vv' && !allowSpice) {
dv = (allowXtermjs) ? 'xtermjs' : 'html5';
} else if (dv === 'xtermjs' && !allowXtermjs) {
dv = (allowSpice) ? 'vv' : 'html5';
}
return dv;