]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager6/Utils.js
ui: fix wrong defaultConsole fallback in tree
[pve-manager.git] / www / manager6 / Utils.js
index 67e461f5c20821a8419d56d68425bc6ff576d95d..d72ba64f2bc0a1028422694adfa55611356547b6 100644 (file)
@@ -46,11 +46,11 @@ 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': [
@@ -83,6 +83,9 @@ Ext.define('PVE.Utils', { utilities: {
            case 'good':
                icon = 'good fa-check';
                break;
+           case 'old':
+               icon = 'warning fa-refresh';
+               break;
            case 'warning':
                icon = 'warning fa-exclamation';
                break;
@@ -99,8 +102,59 @@ 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) {
+       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'
     },
@@ -350,7 +404,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'
@@ -499,12 +553,6 @@ Ext.define('PVE.Utils', { utilities: {
            ipanel: 'IScsiInputPanel',
            faIcon: 'building'
        },
-       sheepdog: {
-           name: 'Sheepdog',
-           ipanel: 'SheepdogInputPanel',
-           hideAdd: true,
-           faIcon: 'building'
-       },
        cephfs: {
            name: 'CephFS',
            ipanel: 'CephFSInputPanel',
@@ -735,6 +783,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;
@@ -893,10 +945,9 @@ Ext.define('PVE.Utils', { utilities: {
            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;
@@ -976,8 +1027,11 @@ 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);
+                   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) {