]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager6/Utils.js
add right-click menu for nodes
[pve-manager.git] / www / manager6 / Utils.js
index f86eea81f0dd69d2680e4c19678e8a9e7562eaaf..d1ada771f02bc37ca56edfe27de190f43ca4ece8 100644 (file)
@@ -63,7 +63,8 @@ Ext.define('PVE.Utils', { utilities: {
        w2k: 'Microsoft Windows 2000',
        w2k8: 'Microsoft Windows Vista/2008',
        win7: 'Microsoft Windows 7/2008r2',
-       win8: 'Microsoft Windows 8.x/10/2012/r2',
+       win8: 'Microsoft Windows 8.x/2012/2012r2',
+       win10: 'Microsoft Windows 10/2016',
        l24: 'Linux 2.4 Kernel',
        l26: 'Linux 4.X/3.X/2.6 Kernel',
        solaris: 'Solaris Kernel'
@@ -99,6 +100,30 @@ Ext.define('PVE.Utils', { utilities: {
        return icon;
     },
 
+    map_ceph_health: {
+       'HEALTH_OK':'good',
+       'HEALTH_WARN':'warning',
+       'HEALTH_ERR':'critical'
+    },
+
+    render_ceph_health: function(record) {
+       var state = {
+           iconCls: PVE.Utils.get_health_icon(),
+           text: ''
+       };
+
+       if (!record || !record.data) {
+           return state;
+       }
+
+       var health = PVE.Utils.map_ceph_health[record.data.health.overall_status];
+
+       state.iconCls = PVE.Utils.get_health_icon(health, true);
+       state.text = record.data.health.overall_status;
+
+       return state;
+    },
+
     render_kvm_ostype: function (value) {
        if (!value) {
            return gettext('Other OS types');
@@ -114,7 +139,7 @@ Ext.define('PVE.Utils', { utilities: {
        var fa = [];
 
        if (!value || (value === '0')) {
-           return gettext('disabled');
+           return gettext('Disabled');
        }
 
        if (value === '1') {
@@ -127,7 +152,7 @@ Ext.define('PVE.Utils', { utilities: {
            } else if (el === 'network') {
                fa.push(gettext('Network'));
            } else if (el === 'usb') {
-               fa.push(gettext('USB'));
+               fa.push('USB');
            } else if (el === 'memory') {
                fa.push(gettext('Memory'));
            } else if (el === 'cpu') {
@@ -539,7 +564,7 @@ Ext.define('PVE.Utils', { utilities: {
     },
 
     task_desc_table: {
-       diskinit: [ 'Disk', gettext('Initialize GPT') ],
+       diskinit: [ 'Disk', gettext('Initialize Disk with GPT') ],
        vncproxy: [ 'VM/CT', gettext('Console') ],
        spiceproxy: [ 'VM/CT', gettext('Console') + ' (Spice)' ],
        vncshell: [ '', gettext('Shell') ],
@@ -720,6 +745,8 @@ Ext.define('PVE.Utils', { utilities: {
 
     yesText: gettext('Yes'),
     noText: gettext('No'),
+    enabledText: gettext('Enabled'),
+    disabledText: gettext('Disabled'),
     noneText: gettext('none'),
     errorText: gettext('Error'),
     unknownText: gettext('Unknown'),
@@ -792,6 +819,10 @@ Ext.define('PVE.Utils', { utilities: {
        return !value ? PVE.Utils.yesText : PVE.Utils.noText;
     },
 
+    format_enabled_toggle: function(value) {
+       return value ? PVE.Utils.enabledText :PVE.Utils.disabledText;
+    },
+
     format_ha: function(value) {
        var text = PVE.Utils.format_boolean(value.managed);
 
@@ -869,11 +900,23 @@ Ext.define('PVE.Utils', { utilities: {
        return PVE.Utils.format_size(value);
     },
 
+    render_bandwidth: function(value) {
+       if (!Ext.isNumeric(value)) {
+           return '';
+       }
+
+       return PVE.Utils.format_size(value) + '/s';
+    },
+
     render_timestamp: function(value, metaData, record, rowIndex, colIndex, store) {
        var servertime = new Date(value * 1000);
        return Ext.Date.format(servertime, 'Y-m-d H:i:s');
     },
 
+    render_timestamp_human_readable: function(value) {
+       return Ext.Date.format(new Date(value * 1000), 'l d F Y H:i:s');
+    },
+
     calculate_mem_usage: function(data) {
        if (!Ext.isNumeric(data.mem) ||
            data.maxmem === 0 ||
@@ -1293,6 +1336,12 @@ Ext.define('PVE.Utils', { utilities: {
            });
            */
            return;
+
+       } else if (record.data.type === 'node' ){
+           menu = Ext.create('PVE.node.CmdMenu', {
+               nodename: record.data.node
+           });
+
        } else {
            return;
        }