]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager6/Utils.js
ui: add PBS edit input panel
[pve-manager.git] / www / manager6 / Utils.js
index c96987e8b7450c91e7c9bc3a5eaeeee0f7de3366..545c7319c2da0fceed90c4334f9d83e0db8e3232 100644 (file)
@@ -19,7 +19,6 @@ Ext.Ajax.defaultHeaders = {
     'Accept': 'application/json'
 };
 
-/*jslint confusion: true */
 Ext.define('PVE.Utils', { utilities: {
 
     // this singleton contains miscellaneous utilities
@@ -46,15 +45,15 @@ Ext.define('PVE.Utils', { utilities: {
        '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': [
-           { desc: '10/2016', val: 'win10' },
+           { desc: '10/2016/2019', val: 'win10' },
            { desc: '8.x/2012/2012r2', val: 'win8' },
            { desc: '7/2008r2', val: 'win7' },
            { desc: 'Vista/2008', val: 'w2k8' },
@@ -83,6 +82,12 @@ Ext.define('PVE.Utils', { utilities: {
            case 'good':
                icon = 'good fa-check';
                break;
+           case 'upgrade':
+               icon = 'warning fa-upload';
+               break;
+           case 'old':
+               icon = 'warning fa-refresh';
+               break;
            case 'warning':
                icon = 'warning fa-exclamation';
                break;
@@ -99,8 +104,73 @@ Ext.define('PVE.Utils', { utilities: {
        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) {
+       let avers = [];
+       let bvers = [];
+
+       if (a === b) {
+           return 0;
+       }
+
+       if (Ext.isArray(a)) {
+           avers = a.slice(); // copy array
+       } else {
+           avers = a.toString().split('.');
+       }
+
+       if (Ext.isArray(b)) {
+           bvers = b.slice(); // copy array
+       } else {
+           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_UPGRADE':'upgrade',
+       'HEALTH_OLD':'old',
        'HEALTH_WARN':'warning',
        'HEALTH_ERR':'critical'
     },
@@ -202,6 +272,13 @@ Ext.define('PVE.Utils', { utilities: {
        return fa.join(', ');
     },
 
+    render_localtime: function(value) {
+       if (value === '__default__') {
+           return Proxmox.Utils.defaultText + ' (' + gettext('Enabled for Windows') + ')';
+       }
+       return Proxmox.Utils.format_boolean(value);
+    },
+
     render_qga_features: function(value) {
        if (!value) {
            return Proxmox.Utils.defaultText + ' (' + Proxmox.Utils.disabledText  + ')';
@@ -218,16 +295,28 @@ Ext.define('PVE.Utils', { utilities: {
            var keystring = '' ;
            agentstring += ', ' + key + ': ';
 
-           if (PVE.Parser.parseBoolean(value)) {
-               agentstring += Proxmox.Utils.enabledText;
+           if (key === 'type') {
+               let map = {
+                   isa: "ISA",
+                   virtio: "VirtIO",
+               };
+               agentstring += map[value] || Proxmox.Utils.unknownText;
            } else {
-               agentstring += Proxmox.Utils.disabledText;
+               if (PVE.Parser.parseBoolean(value)) {
+                   agentstring += Proxmox.Utils.enabledText;
+               } else {
+                   agentstring += Proxmox.Utils.disabledText;
+               }
            }
        });
 
        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)';
@@ -240,6 +329,18 @@ Ext.define('PVE.Utils', { utilities: {
        }
     },
 
+    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)';
@@ -260,6 +361,22 @@ Ext.define('PVE.Utils', { utilities: {
        }
     },
 
+    render_spice_enhancements: function(values) {
+       let props = PVE.Parser.parsePropertyString(values);
+       if (Ext.Object.isEmpty(props)) {
+           return Proxmox.Utils.noneText;
+       }
+
+       let output = [];
+       if (PVE.Parser.parseBoolean(props.foldersharing)) {
+           output.push('Folder Sharing: ' + gettext('Enabled'));
+       }
+       if (props.videostreaming === 'all' || props.videostreaming === 'filter') {
+           output.push('Video Streaming: ' + props.videostreaming);
+       }
+       return output.join(', ');
+    },
+
     // fixme: auto-generate this
     // for now, please keep in sync with PVE::Tools::kvmkeymaps
     kvm_keymaps: {
@@ -334,7 +451,7 @@ Ext.define('PVE.Utils', { utilities: {
     },
 
     console_map: {
-       '__default__': Proxmox.Utils.defaultText + ' (HTML5)',
+       '__default__': Proxmox.Utils.defaultText + ' (xterm.js)',
        'vv': 'SPICE (remote-viewer)',
        'html5': 'HTML5 (noVNC)',
        'xtermjs': 'xterm.js'
@@ -418,26 +535,6 @@ Ext.define('PVE.Utils', { utilities: {
        return msg;
     },
 
-    format_duration_short: function(ut) {
-
-       if (ut < 60) {
-           return ut.toFixed(1) + 's';
-       }
-
-       if (ut < 3600) {
-           var mins = ut / 60;
-           return mins.toFixed(1) + 'm';
-       }
-
-       if (ut < 86400) {
-           var hours = ut / 3600;
-           return hours.toFixed(1) + 'h';
-       }
-
-       var days = ut / 86400;
-       return days.toFixed(1) + 'd';
-    },
-
     contentTypes: {
        'images': gettext('Disk image'),
        'backup': gettext('VZDump backup file'),
@@ -447,6 +544,39 @@ Ext.define('PVE.Utils', { utilities: {
        'snippets': gettext('Snippets')
     },
 
+    volume_is_qemu_backup: function(volid, format) {
+       return format === 'pbs-vm' || volid.match(':backup/vzdump-qemu-');
+    },
+
+    volume_is_lxc_backup: function(volid, format) {
+       return format === 'pbs-ct' || volid.match(':backup/vzdump-(lxc|openvz)-');
+    },
+
+    authSchema: {
+       ad: {
+           name: gettext('Active Directory Server'),
+           ipanel: 'pveAuthADPanel',
+           syncipanel: 'pveAuthLDAPSyncPanel',
+           add: true,
+       },
+       ldap: {
+           name: gettext('LDAP Server'),
+           ipanel: 'pveAuthLDAPPanel',
+           syncipanel: 'pveAuthLDAPSyncPanel',
+           add: true,
+       },
+       pam: {
+           name: 'Linux PAM',
+           ipanel: 'pveAuthBasePanel',
+           add: false,
+       },
+       pve: {
+           name: 'Proxmox VE authentication server',
+           ipanel: 'pveAuthBasePanel',
+           add: false,
+       },
+    },
+
     storageSchema: {
        dir: {
            name: Proxmox.Utils.directoryText,
@@ -483,12 +613,6 @@ Ext.define('PVE.Utils', { utilities: {
            ipanel: 'IScsiInputPanel',
            faIcon: 'building'
        },
-       sheepdog: {
-           name: 'Sheepdog',
-           ipanel: 'SheepdogInputPanel',
-           hideAdd: true,
-           faIcon: 'building'
-       },
        cephfs: {
            name: 'CephFS',
            ipanel: 'CephFSInputPanel',
@@ -521,10 +645,85 @@ Ext.define('PVE.Utils', { utilities: {
            ipanel: 'ZFSPoolInputPanel',
            faIcon: 'folder'
        },
+       pbs: {
+           name: 'Proxmox Backup Server',
+           ipanel: 'PBSInputPanel',
+           faIcon: 'floppy-o',
+       },
        drbd: {
            name: 'DRBD',
-           hideAdd: true
+           hideAdd: true,
+       },
+    },
+
+    sdnvnetSchema: {
+       vnet: {
+           name: 'vnet',
+           faIcon: 'folder'
+       },
+    },
+
+    sdnzoneSchema: {
+       zone: {
+            name: 'zone',
+            hideAdd: true
+       },
+       vlan: {
+           name: 'VLAN',
+           ipanel: 'VlanInputPanel',
+           faIcon: 'th'
+       },
+       qinq: {
+           name: 'QinQ',
+           ipanel: 'QinQInputPanel',
+           faIcon: 'th'
+       },
+       vxlan: {
+           name: 'VXLAN',
+           ipanel: 'VxlanInputPanel',
+           faIcon: 'th'
+       },
+       evpn: {
+           name: 'EVPN',
+           ipanel: 'EvpnInputPanel',
+           faIcon: 'th'
+       },
+    },
+
+    sdncontrollerSchema: {
+       controller: {
+            name: 'controller',
+            hideAdd: true
+       },
+       evpn: {
+           name: 'evpn',
+           ipanel: 'EvpnInputPanel',
+           faIcon: 'crosshairs'
+       },
+    },
+
+    format_sdnvnet_type: function(value, md, record) {
+       var schema = PVE.Utils.sdnvnetSchema[value];
+       if (schema) {
+           return schema.name;
        }
+       return Proxmox.Utils.unknownText;
+    },
+
+    format_sdnzone_type: function(value, md, record) {
+       var schema = PVE.Utils.sdnzoneSchema[value];
+       if (schema) {
+           return schema.name;
+       }
+       return Proxmox.Utils.unknownText;
+    },
+
+    format_sdncontroller_type: function(value, md, record) {
+       var schema = PVE.Utils.sdncontrollerSchema[value];
+       if (schema) {
+           return schema.name;
+       }
+       return Proxmox.Utils.unknownText;
     },
 
     format_storage_type: function(value, md, record) {
@@ -569,7 +768,7 @@ Ext.define('PVE.Utils', { utilities: {
                Ext.String.leftPad(data.channel,2, '0') +
                " ID " + data.id + " LUN " + data.lun;
        }
-       return data.volid.replace(/^.*:(.*\/)?/,'');
+       return data.volid.replace(/^.*?:(.*?\/)?/,'');
     },
 
     render_serverity: function (value) {
@@ -594,7 +793,6 @@ Ext.define('PVE.Utils', { utilities: {
     },
 
     render_size: function(value, metaData, record, rowIndex, colIndex, store) {
-       /*jslint confusion: true */
 
        if (!Ext.isNumeric(value)) {
            return '';
@@ -615,13 +813,6 @@ Ext.define('PVE.Utils', { utilities: {
        return Ext.Date.format(new Date(value * 1000), 'l d F Y H:i:s');
     },
 
-    render_duration: function(value) {
-       if (value === undefined) {
-           return '-';
-       }
-       return PVE.Utils.format_duration_short(value);
-    },
-
     calculate_mem_usage: function(data) {
        if (!Ext.isNumeric(data.mem) ||
            data.maxmem === 0 ||
@@ -719,6 +910,10 @@ Ext.define('PVE.Utils', { utilities: {
            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;
@@ -804,50 +999,58 @@ Ext.define('PVE.Utils', { utilities: {
        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, consoleType, vmid, nodename, vmname, cmd) {
        var dv = PVE.Utils.defaultViewer(consoles);
-       PVE.Utils.openConsoleWindow(dv, vmtype, vmid, nodename, vmname);
+       PVE.Utils.openConsoleWindow(dv, consoleType, vmid, nodename, vmname, cmd);
     },
 
-    openConsoleWindow: function(viewer, vmtype, vmid, nodename, vmname) {
-       // kvm, lxc, shell, upgrade
-
-       if (vmid == undefined && (vmtype === 'kvm' || vmtype === 'lxc')) {
+    openConsoleWindow: function(viewer, consoleType, vmid, nodename, vmname, cmd) {
+       if (vmid == undefined && (consoleType === 'kvm' || consoleType === 'lxc')) {
            throw "missing vmid";
        }
-
        if (!nodename) {
            throw "no nodename specified";
        }
 
        if (viewer === 'html5') {
-           PVE.Utils.openVNCViewer(vmtype, vmid, nodename, vmname);
+           PVE.Utils.openVNCViewer(consoleType, vmid, nodename, vmname, cmd);
        } else if (viewer === 'xtermjs') {
-           Proxmox.Utils.openXtermJsViewer(vmtype, vmid, nodename, vmname);
+           Proxmox.Utils.openXtermJsViewer(consoleType, vmid, nodename, vmname, cmd);
        } else if (viewer === 'vv') {
-           var url;
-           var params = { proxy: PVE.Utils.windowHostname() };
-           if (vmtype === 'kvm') {
+           let url = '/nodes/' + nodename + '/spiceshell';
+           let params = {
+               proxy: PVE.Utils.windowHostname(),
+           };
+           if (consoleType === 'kvm') {
                url = '/nodes/' + nodename + '/qemu/' + vmid.toString() + '/spiceproxy';
-               PVE.Utils.openSpiceViewer(url, params);
-           } else if (vmtype === 'lxc') {
+           } else if (consoleType === 'lxc') {
                url = '/nodes/' + nodename + '/lxc/' + vmid.toString() + '/spiceproxy';
-               PVE.Utils.openSpiceViewer(url, params);
-           } else if (vmtype === 'shell') {
-               url = '/nodes/' + nodename + '/spiceshell';
-               PVE.Utils.openSpiceViewer(url, params);
-           } else if (vmtype === 'upgrade') {
-               url = '/nodes/' + nodename + '/spiceshell';
-               params.upgrade = 1;
-               PVE.Utils.openSpiceViewer(url, params);
+           } else if (consoleType === 'upgrade') {
+               params.cmd = 'upgrade';
+           } else if (consoleType === 'cmd') {
+               params.cmd = cmd;
+           } else if (consoleType !== 'shell') {
+               throw `unknown spice viewer type '${consoleType}'`;
            }
+           PVE.Utils.openSpiceViewer(url, params);
        } else {
-           throw "unknown viewer type";
+           throw `unknown viewer type '${viewer}'`;
        }
     },
 
@@ -862,26 +1065,35 @@ Ext.define('PVE.Utils', { utilities: {
            allowSpice = consoles.spice;
            allowXtermjs = !!consoles.xtermjs;
        }
-       var vncdefault = 'html5';
-       var dv = PVE.VersionInfo.console || vncdefault;
-       if ((dv === 'vv' && !allowSpice) || (dv === 'xtermjs' && !allowXtermjs)) {
-           dv = vncdefault;
+       var dv = PVE.VersionInfo.console || 'xtermjs';
+       if (dv === 'vv' && !allowSpice) {
+           dv = (allowXtermjs) ? 'xtermjs' : 'html5';
+       } else if (dv === 'xtermjs' && !allowXtermjs) {
+           dv = (allowSpice) ? 'vv' : 'html5';
        }
 
        return dv;
     },
 
-    openVNCViewer: function(vmtype, vmid, nodename, vmname) {
-       var url = Ext.urlEncode({
+    openVNCViewer: function(vmtype, vmid, nodename, vmname, cmd) {
+       let scaling = 'off';
+       if (Proxmox.Utils.toolkit !== 'touch') {
+           var sp = Ext.state.Manager.getProvider();
+           scaling = sp.get('novnc-scaling', 'off');
+       }
+       var url = Ext.Object.toQueryString({
            console: vmtype, // kvm, lxc, upgrade or shell
            novnc: 1,
            vmid: vmid,
            vmname: vmname,
            node: nodename,
-           resize: 'off'
+           resize: scaling,
+           cmd: cmd
        });
        var nw = window.open("?" + url, '_blank', "innerWidth=745,innerheight=427");
-       nw.focus();
+       if (nw) {
+           nw.focus();
+       }
     },
 
     openSpiceViewer: function(url, params){
@@ -904,8 +1116,8 @@ Ext.define('PVE.Utils', { utilities: {
            if (link.fireEvent) {
                link.fireEvent('onclick');
            } else {
-                var evt = document.createEvent("MouseEvents");
-                evt.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
+               let evt = document.createEvent("MouseEvents");
+               evt.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
                link.dispatchEvent(evt);
            }
        };
@@ -942,8 +1154,12 @@ Ext.define('PVE.Utils', { utilities: {
                    Ext.Msg.alert('Error', response.htmlStatus);
                },
                success: function(response, opts) {
-                   var allowSpice = !!response.result.data.spice;
-                   PVE.Utils.openDefaultConsoleWindow(allowSpice, 'kvm', vmid, nodename, vmname);
+                   let conf = response.result.data;
+                   var consoles = {
+                       spice: !!conf.spice,
+                       xtermjs: !!conf.serial,
+                   };
+                   PVE.Utils.openDefaultConsoleWindow(consoles, 'kvm', vmid, nodename, vmname);
                }
            });
        } else if (record.data.type === 'lxc' && !record.data.template) {
@@ -1003,7 +1219,11 @@ Ext.define('PVE.Utils', { utilities: {
        if (values[fieldname] === '' || values[fieldname] === default_val) {
            if (!create) {
                if (values['delete']) {
-                   values['delete'] += ',' + fieldname;
+                   if (Ext.isArray(values['delete'])) {
+                       values['delete'].push(fieldname);
+                   } else {
+                       values['delete'] += ',' + fieldname;
+                   }
                } else {
                    values['delete'] = fieldname;
                }
@@ -1032,11 +1252,16 @@ Ext.define('PVE.Utils', { utilities: {
        reader.readAsText(file);
     },
 
-    bus_counts: { ide: 4, sata: 6, scsi: 16, virtio: 16 },
+    diskControllerMaxIDs: {
+       ide: 4,
+       sata: 6,
+       scsi: 31,
+       virtio: 16,
+    },
 
     // types is either undefined (all busses), an array of busses, or a single bus
     forEachBus: function(types, func) {
-       var busses = Object.keys(PVE.Utils.bus_counts);
+       var busses = Object.keys(PVE.Utils.diskControllerMaxIDs);
        var i, j, count, cont;
 
        if (Ext.isArray(types)) {
@@ -1047,13 +1272,13 @@ Ext.define('PVE.Utils', { utilities: {
 
        // check if we only have valid busses
        for (i = 0; i < busses.length; i++) {
-           if (!PVE.Utils.bus_counts[busses[i]]) {
+           if (!PVE.Utils.diskControllerMaxIDs[busses[i]]) {
                throw "invalid bus: '" + busses[i] + "'";
            }
        }
 
        for (i = 0; i < busses.length; i++) {
-           count = PVE.Utils.bus_counts[busses[i]];
+           count = PVE.Utils.diskControllerMaxIDs[busses[i]];
            for (j = 0; j < count; j++) {
                cont = func(busses[i], j);
                if (!cont && cont !== undefined) {
@@ -1084,7 +1309,158 @@ Ext.define('PVE.Utils', { utilities: {
                return;
            }
        }
-    }
+    },
+
+    hardware_counts: { net: 32, usb: 5, hostpci: 16, audio: 1, efidisk: 1, serial: 4, rng: 1 },
+
+    cleanEmptyObjectKeys: function (obj) {
+       var propName;
+       for (propName in obj) {
+           if (obj.hasOwnProperty(propName)) {
+               if (obj[propName] === null || obj[propName] === undefined) {
+                   delete obj[propName];
+               }
+           }
+       }
+    },
+
+    acmedomain_count: 5,
+
+    add_domain_to_acme: function(acme, domain) {
+       if (acme.domains === undefined) {
+           acme.domains = [domain];
+       } else {
+           acme.domains.push(domain);
+           acme.domains = acme.domains.filter((value, index, self) => {
+               return self.indexOf(value) === index;
+           });
+       }
+       return acme;
+    },
+
+    remove_domain_from_acme: function(acme, domain) {
+       if (acme.domains !== undefined) {
+           acme.domains = acme.domains.filter((value, index, self) => {
+               return self.indexOf(value) === index && value !== domain;
+           });
+       }
+       return acme;
+    },
+
+    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;
+       }
+    },
+
+    propertyStringSet: function(target, source, name, value) {
+       if (source) {
+           if (value === undefined) {
+               target[name] = source;
+           } else {
+               target[name] = value;
+           }
+       } else {
+           delete target[name];
+       }
+    },
+
+    updateColumns: function(container) {
+       let mode = Ext.state.Manager.get('summarycolumns') || 'auto';
+       let factor;
+       if (mode !== 'auto') {
+           factor = parseInt(mode, 10);
+           if (Number.isNaN(factor)) {
+               factor = 1;
+           }
+       } else {
+           factor = container.getSize().width < 1400 ? 1 : 2;
+       }
+
+       if (container.oldFactor === factor) {
+           return;
+       }
+
+       let items = container.query('>'); // direct childs
+       factor = Math.min(factor, items.length);
+       container.oldFactor = factor;
+
+       items.forEach((item) => {
+           item.columnWidth = 1 / factor;
+       });
+
+       // we have to update the layout twice, since the first layout change
+       // can trigger the scrollbar which reduces the amount of space left
+       container.updateLayout();
+       container.updateLayout();
+    },
+
+    forEachCorosyncLink: function(nodeinfo, cb) {
+       let re = /(?:ring|link)(\d+)_addr/;
+       Ext.iterate(nodeinfo, (prop, val) => {
+           let match = re.exec(prop);
+           if (match) {
+               cb(Number(match[1]), val);
+           }
+       });
+    },
+
+    cpu_vendor_map: {
+       'default': 'QEMU',
+       'AuthenticAMD': 'AMD',
+       'GenuineIntel': 'Intel'
+    },
+
+    cpu_vendor_order: {
+       "AMD": 1,
+       "Intel": 2,
+       "QEMU": 3,
+       "Host": 4,
+       "_default_": 5, // includes custom models
+    },
 },
 
     singleton: true,
@@ -1094,4 +1470,3 @@ Ext.define('PVE.Utils', { utilities: {
     }
 
 });
-