return fa.join(', ');
},
+ render_qga_features: function(value) {
+ if (!value) {
+ return Proxmox.Utils.defaultText + ' (' + Proxmox.Utils.disabledText + ')';
+ }
+ var props = PVE.Parser.parsePropertyString(value, 'enabled');
+ if (!PVE.Parser.parseBoolean(props.enabled)) {
+ return Proxmox.Utils.disabledText;
+ }
+
+ delete props.enabled;
+ var agentstring = Proxmox.Utils.enabledText;
+
+ Ext.Object.each(props, function(key, value) {
+ var keystring = '' ;
+ agentstring += ', ' + key + ': ';
+
+ if (PVE.Parser.parseBoolean(value)) {
+ agentstring += Proxmox.Utils.enabledText;
+ } else {
+ agentstring += Proxmox.Utils.disabledText;
+ }
+ });
+
+ return agentstring;
+ },
+
render_qemu_bios: function(value) {
if (!value) {
return Proxmox.Utils.defaultText + ' (SeaBIOS)';
return data;
},
+ console_map: {
+ '__default__': Proxmox.Utils.defaultText + ' (HTML5)',
+ 'vv': 'SPICE (remote-viewer)',
+ 'html5': 'HTML5 (noVNC)',
+ 'xtermjs': 'xterm.js'
+ },
+
render_console_viewer: function(value) {
- if (!value || value === '__default__') {
- return Proxmox.Utils.defaultText + ' (HTML5)';
- } else if (value === 'vv') {
- return 'SPICE (remote-viewer)';
- } else if (value === 'html5') {
- return 'HTML5 (noVNC)';
- } else {
- return value;
+ value = value || '__default__';
+ if (PVE.Utils.console_map[value]) {
+ return PVE.Utils.console_map[value];
}
+ return value;
},
console_viewer_array: function() {
- return Ext.Array.map(['__default__','vv', 'html5'], function(v) {
+ return Ext.Array.map(Object.keys(PVE.Utils.console_map), function(v) {
return [v, PVE.Utils.render_console_viewer(v)];
});
},
rbd: {
name: 'RBD',
ipanel: 'RBDInputPanel',
- hideAdd: true,
- faIcon: 'building'
- },
- rbd_ext: {
- name: 'RBD (external)',
- ipanel: 'RBDInputPanel',
faIcon: 'building'
},
pveceph: {
name: 'RBD (PVE)',
- ipanel: 'PVERBDInputPanel',
+ ipanel: 'RBDInputPanel',
+ hideAdd: true,
faIcon: 'building'
},
zfs: {
format_storage_type: function(value, md, record) {
if (value === 'rbd' && record) {
- value = (record.get('monhost')?'rbd_ext':'pveceph');
+ value = (record.get('monhost') ? 'rbd' : 'pveceph');
}
var schema = PVE.Utils.storageSchema[value];
return PVE.Utils.render_size_usage(record.used, record.total);
},
+ render_optional_url: function(value) {
+ var match;
+ if (value && (match = value.match(/^https?:\/\//)) !== null) {
+ return '<a target="_blank" href="' + value + '">' + value + '</a>';
+ }
+ return value;
+ },
+
+ render_san: function(value) {
+ var names = [];
+ if (Ext.isArray(value)) {
+ value.forEach(function(val) {
+ if (!Ext.isNumber(val)) {
+ names.push(val);
+ }
+ });
+ return names.join('<br>');
+ }
+ return value;
+ },
+
windowHostname: function() {
return window.location.hostname.replace(Proxmox.Utils.IP6_bracket_match,
function(m, addr, offset, original) { return addr; });
},
- openDefaultConsoleWindow: function(allowSpice, vmtype, vmid, nodename, vmname) {
- var dv = PVE.Utils.defaultViewer(allowSpice);
+ openDefaultConsoleWindow: function(consoles, vmtype, vmid, nodename, vmname) {
+ var dv = PVE.Utils.defaultViewer(consoles);
PVE.Utils.openConsoleWindow(dv, vmtype, vmid, nodename, vmname);
},
}
},
- defaultViewer: function(allowSpice) {
+ defaultViewer: function(consoles) {
+
+ var allowSpice, allowXtermjs;
+
+ if (consoles === true) {
+ allowSpice = true;
+ allowXtermjs = true;
+ } else if (typeof consoles === 'object') {
+ allowSpice = consoles.spice;
+ allowXtermjs = !!consoles.xtermjs;
+ }
var vncdefault = 'html5';
var dv = PVE.VersionInfo.console || vncdefault;
- if (dv === 'vv' && !allowSpice) {
+ if ((dv === 'vv' && !allowSpice) || (dv === 'xtermjs' && !allowXtermjs)) {
dv = vncdefault;
}
novnc: 1,
vmid: vmid,
vmname: vmname,
- node: nodename
+ node: nodename,
+ resize: 'off'
});
var nw = window.open("?" + url, '_blank', "innerWidth=745,innerheight=427");
nw.focus();
Ext.Msg.alert('Error', response.htmlStatus);
},
success: function(response, opts) {
- var allowSpice = response.result.data.spice;
+ var allowSpice = !!response.result.data.spice;
PVE.Utils.openDefaultConsoleWindow(allowSpice, 'kvm', vmid, nodename, vmname);
}
});