'p': gettext('Premium')
},
- noSubKeyHtml: 'You do not have a valid subscription for this server. Please visit <a target="_blank" href="http://www.proxmox.com/products/proxmox-ve/subscription-service-plans">www.proxmox.com</a> to get a list of available options.',
+ noSubKeyHtml: 'You do not have a valid subscription for this server. Please visit <a target="_blank" href="https://www.proxmox.com/products/proxmox-ve/subscription-service-plans">www.proxmox.com</a> to get a list of available options.',
kvm_ostypes: {
'Linux': [
- { desc: '4.X/3.X/2.6 Kernel', val: 'l26' },
+ { desc: '5.x - 2.6 Kernel', val: 'l26' },
{ desc: '2.4 Kernel', val: 'l24' }
],
'Microsoft Windows': [
case 'good':
icon = 'good fa-check';
break;
+ case 'old':
+ icon = 'warning fa-refresh';
+ break;
case 'warning':
icon = 'warning fa-exclamation';
break;
return icon;
},
+ parse_ceph_version: function(service) {
+ if (service.ceph_version_short) {
+ return service.ceph_version_short;
+ }
+
+ if (service.ceph_version) {
+ var match = service.ceph_version.match(/version (\d+(\.\d+)*)/);
+ if (match) {
+ return match[1];
+ }
+ }
+
+ return undefined;
+ },
+
+ compare_ceph_versions: function(a, b) {
+ if (a === b) {
+ return 0;
+ }
+ let avers = a.toString().split('.');
+ let bvers = b.toString().split('.');
+
+ while (true) {
+ let av = avers.shift();
+ let bv = bvers.shift();
+
+ if (av === undefined && bv === undefined) {
+ return 0;
+ } else if (av === undefined) {
+ return -1;
+ } else if (bv === undefined) {
+ return 1;
+ } else {
+ let diff = parseInt(av, 10) - parseInt(bv, 10);
+ if (diff != 0) return diff;
+ // else we need to look at the next parts
+ }
+ }
+
+ },
+
+ get_ceph_icon_html: function(health, fw) {
+ var state = PVE.Utils.map_ceph_health[health];
+ var cls = PVE.Utils.get_health_icon(state);
+ if (fw) {
+ cls += ' fa-fw';
+ }
+ return "<i class='fa " + cls + "'></i> ";
+ },
+
map_ceph_health: {
'HEALTH_OK':'good',
+ 'HEALTH_OLD':'old',
'HEALTH_WARN':'warning',
'HEALTH_ERR':'critical'
},
return agentstring;
},
+ render_qemu_machine: function(value) {
+ return value || (Proxmox.Utils.defaultText + ' (i440fx)');
+ },
+
render_qemu_bios: function(value) {
if (!value) {
return Proxmox.Utils.defaultText + ' (SeaBIOS)';
}
},
+ render_dc_ha_opts: function(value) {
+ if (!value) {
+ return Proxmox.Utils.defaultText;
+ } else {
+ return PVE.Parser.printPropertyString(value);
+ }
+ },
+ render_as_property_string: function(value) {
+ return (!value) ? Proxmox.Utils.defaultText
+ : PVE.Parser.printPropertyString(value);
+ },
+
render_scsihw: function(value) {
if (!value) {
return Proxmox.Utils.defaultText + ' (LSI 53C895A)';
},
console_map: {
- '__default__': Proxmox.Utils.defaultText + ' (HTML5)',
+ '__default__': Proxmox.Utils.defaultText + ' (xterm.js)',
'vv': 'SPICE (remote-viewer)',
'html5': 'HTML5 (noVNC)',
'xtermjs': 'xterm.js'
'backup': gettext('VZDump backup file'),
'vztmpl': gettext('Container template'),
'iso': gettext('ISO image'),
- 'rootdir': gettext('Container')
+ 'rootdir': gettext('Container'),
+ 'snippets': gettext('Snippets')
},
storageSchema: {
ipanel: 'IScsiInputPanel',
faIcon: 'building'
},
- sheepdog: {
- name: 'Sheepdog',
- ipanel: 'SheepdogInputPanel',
- hideAdd: true,
- faIcon: 'building'
- },
cephfs: {
name: 'CephFS',
ipanel: 'CephFSInputPanel',
status = record.status + ' ha-' + record.hastate;
}
+ if (record.lock) {
+ status += ' locked lock-' + record.lock;
+ }
+
var defaults = PVE.tree.ResourceTree.typeDefaults[objType];
if (defaults && defaults.iconCls) {
var retVal = defaults.iconCls + ' ' + status;
return Ext.htmlEncode(first + " " + last);
},
+ render_u2f_error: function(error) {
+ var ErrorNames = {
+ '1': gettext('Other Error'),
+ '2': gettext('Bad Request'),
+ '3': gettext('Configuration Unsupported'),
+ '4': gettext('Device Ineligible'),
+ '5': gettext('Timeout')
+ };
+ return "U2F Error: " + ErrorNames[error] || Proxmox.Utils.unknownText;
+ },
+
windowHostname: function() {
return window.location.hostname.replace(Proxmox.Utils.IP6_bracket_match,
function(m, addr, offset, original) { return addr; });
},
- openDefaultConsoleWindow: function(consoles, vmtype, vmid, nodename, vmname) {
+ openDefaultConsoleWindow: function(consoles, vmtype, vmid, nodename, vmname, cmd) {
var dv = PVE.Utils.defaultViewer(consoles);
- PVE.Utils.openConsoleWindow(dv, vmtype, vmid, nodename, vmname);
+ PVE.Utils.openConsoleWindow(dv, vmtype, vmid, nodename, vmname, cmd);
},
- openConsoleWindow: function(viewer, vmtype, vmid, nodename, vmname) {
+ openConsoleWindow: function(viewer, vmtype, vmid, nodename, vmname, cmd) {
// kvm, lxc, shell, upgrade
if (vmid == undefined && (vmtype === 'kvm' || vmtype === 'lxc')) {
}
if (viewer === 'html5') {
- PVE.Utils.openVNCViewer(vmtype, vmid, nodename, vmname);
+ PVE.Utils.openVNCViewer(vmtype, vmid, nodename, vmname, cmd);
} else if (viewer === 'xtermjs') {
- Proxmox.Utils.openXtermJsViewer(vmtype, vmid, nodename, vmname);
+ Proxmox.Utils.openXtermJsViewer(vmtype, vmid, nodename, vmname, cmd);
} else if (viewer === 'vv') {
var url;
var params = { proxy: PVE.Utils.windowHostname() };
url = '/nodes/' + nodename + '/spiceshell';
params.upgrade = 1;
PVE.Utils.openSpiceViewer(url, params);
+ } else if (vmtype === 'cmd') {
+ url = '/nodes/' + nodename + '/spiceshell';
+ params.cmd = cmd;
+ PVE.Utils.openSpiceViewer(url, params);
}
} else {
throw "unknown viewer type";
allowSpice = consoles.spice;
allowXtermjs = !!consoles.xtermjs;
}
- var vncdefault = 'html5';
- var dv = PVE.VersionInfo.console || vncdefault;
+ var dv = PVE.VersionInfo.console || 'xtermjs';
if ((dv === 'vv' && !allowSpice) || (dv === 'xtermjs' && !allowXtermjs)) {
- dv = vncdefault;
+ dv = 'html5';
}
return dv;
},
- openVNCViewer: function(vmtype, vmid, nodename, vmname) {
- var url = Ext.urlEncode({
+ openVNCViewer: function(vmtype, vmid, nodename, vmname, cmd) {
+ var url = Ext.Object.toQueryString({
console: vmtype, // kvm, lxc, upgrade or shell
novnc: 1,
vmid: vmid,
vmname: vmname,
node: nodename,
- resize: 'off'
+ resize: 'off',
+ cmd: cmd
});
var nw = window.open("?" + url, '_blank', "innerWidth=745,innerheight=427");
- nw.focus();
+ if (nw) {
+ nw.focus();
+ }
},
openSpiceViewer: function(url, params){
Ext.Msg.alert('Error', response.htmlStatus);
},
success: function(response, opts) {
- var allowSpice = !!response.result.data.spice;
- PVE.Utils.openDefaultConsoleWindow(allowSpice, 'kvm', vmid, nodename, vmname);
+ var consoles = {
+ spice: !!response.result.data.spice,
+ xtermjs: !!response.result.data.serial,
+ };
+ PVE.Utils.openDefaultConsoleWindow(consoles, 'kvm', vmid, nodename, vmname);
}
});
} else if (record.data.type === 'lxc' && !record.data.template) {
return;
}
}
+ },
+
+ cleanEmptyObjectKeys: function (obj) {
+ var propName;
+ for (propName in obj) {
+ if (obj.hasOwnProperty(propName)) {
+ if (obj[propName] === null || obj[propName] === undefined) {
+ delete obj[propName];
+ }
+ }
+ }
+ },
+
+ handleStoreErrorOrMask: function(me, store, regex, callback) {
+
+ me.mon(store, 'load', function (proxy, response, success, operation) {
+
+ if (success) {
+ Proxmox.Utils.setErrorMask(me, false);
+ return;
+ }
+ var msg;
+
+ if (operation.error.statusText) {
+ if (operation.error.statusText.match(regex)) {
+ callback(me, operation.error);
+ return;
+ } else {
+ msg = operation.error.statusText + ' (' + operation.error.status + ')';
+ }
+ } else {
+ msg = gettext('Connection error');
+ }
+ Proxmox.Utils.setErrorMask(me, msg);
+ });
+ },
+
+ showCephInstallOrMask: function(container, msg, nodename, callback){
+ var regex = new RegExp("not (installed|initialized)", "i");
+ if (msg.match(regex)) {
+ if (Proxmox.UserName === 'root@pam') {
+ container.el.mask();
+ if (!container.down('pveCephInstallWindow')){
+ var isInstalled = msg.match(/not initialized/i) ? true : false;
+ var win = Ext.create('PVE.ceph.Install', {
+ nodename: nodename
+ });
+ win.getViewModel().set('isInstalled', isInstalled);
+ container.add(win);
+ win.show();
+ callback(win);
+ }
+ } else {
+ container.mask(Ext.String.format(gettext('{0} not installed.') +
+ ' ' + gettext('Log in as root to install.'), 'Ceph'), ['pve-static-mask']);
+ }
+ return true;
+ } else {
+ return false;
+ }
}
},