]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager6/Utils.js
bump version to 4.2-8
[pve-manager.git] / www / manager6 / Utils.js
index 71c1654461c91d63db4285011d0f8a59dd5de3c0..992ae85e4becc03cf97f59afc88770244a65bb7f 100644 (file)
@@ -1,13 +1,20 @@
 Ext.ns('PVE');
 
+// avoid errors related to Accessible Rich Internet Applications
+// (access for people with disabilities)
+// TODO reenable after all components are upgraded
+Ext.enableAria = false;
+Ext.enableAriaButtons = false;
+Ext.enableAriaPanels = false;
+
 // avoid errors when running without development tools
-if (!Ext.isDefined(Ext.global.console)) {   
-    var console = { 
-       dir: function() {}, 
-       log: function() {} 
+if (!Ext.isDefined(Ext.global.console)) {
+    var console = {
+       dir: function() {},
+       log: function() {}
     };
 }
-console.log("Starting PVE Manager"); 
+console.log("Starting PVE Manager");
 
 Ext.Ajax.defaultHeaders = {
     'Accept': 'application/json'
@@ -15,7 +22,7 @@ Ext.Ajax.defaultHeaders = {
 
 Ext.Ajax.on('beforerequest', function(conn, options) {
     if (PVE.CSRFPreventionToken) {
-       if (!options.headers) { 
+       if (!options.headers) {
            options.headers = {};
        }
        options.headers.CSRFPreventionToken = PVE.CSRFPreventionToken;
@@ -29,7 +36,7 @@ var IPV6_LS32 = "(?:(?:" + IPV6_H16 + ":" + IPV6_H16 + ")|" + IPV4_REGEXP + ")";
 
 
 var IP4_match = new RegExp("^(?:" + IPV4_REGEXP + ")$");
-var IP4_cidr_match = new RegExp("^(?:" + IPV4_REGEXP + ")\/[1-3][0-9]?$");
+var IP4_cidr_match = new RegExp("^(?:" + IPV4_REGEXP + ")\/([0-9]{1,2})$");
 
 var IPV6_REGEXP = "(?:" +
     "(?:(?:"                                                  + "(?:" + IPV6_H16 + ":){6})" + IPV6_LS32 + ")|" +
@@ -44,7 +51,7 @@ var IPV6_REGEXP = "(?:" +
     ")";
 
 var IP6_match = new RegExp("^(?:" + IPV6_REGEXP + ")$");
-var IP6_cidr_match = new RegExp("^(?:" + IPV6_REGEXP + ")\/[0-9]{1,3}?$");
+var IP6_cidr_match = new RegExp("^(?:" + IPV6_REGEXP + ")\/([0-9]{1,3})$");
 var IP6_bracket_match = new RegExp("^\\[(" + IPV6_REGEXP + ")\\]");
 
 var IP64_match = new RegExp("^(?:" + IPV6_REGEXP + "|" + IPV4_REGEXP + ")$");
@@ -53,7 +60,7 @@ Ext.define('PVE.Utils', { statics: {
 
     // this class only contains static functions
 
-    toolkit: undefined, // (extjs|touch), set inside Toolkit.js 
+    toolkit: undefined, // (extjs|touch), set inside Toolkit.js
 
     log_severity_hash: {
        0: "panic",
@@ -81,9 +88,9 @@ Ext.define('PVE.Utils', { statics: {
        w2k: 'Microsoft Windows 2000',
        w2k8: 'Microsoft Windows Vista/2008',
        win7: 'Microsoft Windows 7/2008r2',
-       win8: 'Microsoft Windows 8/2012',
+       win8: 'Microsoft Windows 8.x/10/2012/r2',
        l24: 'Linux 2.4 Kernel',
-       l26: 'Linux 3.X/2.6 Kernel',
+       l26: 'Linux 4.X/3.X/2.6 Kernel',
        solaris: 'Solaris Kernel'
     },
 
@@ -93,18 +100,22 @@ Ext.define('PVE.Utils', { statics: {
        }
        var text = PVE.Utils.kvm_ostypes[value];
        if (text) {
-           return text + ' (' + value + ')';
+           return text;
        }
        return value;
     },
 
     render_hotplug_features: function (value) {
-       var fa = [];
+       var fa = [];
 
        if (!value || (value === '0')) {
            return gettext('disabled');
        }
 
+       if (value === '1') {
+           value = 'disk,network,usb';
+       }
+
        Ext.each(value.split(','), function(el) {
            if (el === 'disk') {
                fa.push(gettext('Disk'));
@@ -135,10 +146,22 @@ Ext.define('PVE.Utils', { statics: {
     },
 
     render_network_iface_type: function(value) {
-       return PVE.Utils.network_iface_types[value] || 
+       return PVE.Utils.network_iface_types[value] ||
            PVE.Utils.unknownText;
     },
 
+    render_qemu_bios: function(value) {
+       if (!value) {
+           return PVE.Utils.defaultText + ' (SeaBIOS)';
+       } else if (value === 'seabios') {
+           return "SeaBIOS";
+       } else if (value === 'ovmf') {
+           return "OVMF (UEFI)";
+       } else {
+           return value;
+       }
+    },
+
     render_scsihw: function(value) {
        if (!value) {
            return PVE.Utils.defaultText + ' (LSI 53C895A)';
@@ -162,29 +185,29 @@ Ext.define('PVE.Utils', { statics: {
     kvm_keymaps: {
        //ar: 'Arabic',
        da: 'Danish',
-       de: 'German', 
-       'de-ch': 'German (Swiss)', 
-       'en-gb': 'English (UK)', 
+       de: 'German',
+       'de-ch': 'German (Swiss)',
+       'en-gb': 'English (UK)',
        'en-us': 'English (USA)',
        es: 'Spanish',
        //et: 'Estonia',
        fi: 'Finnish',
-       //fo: 'Faroe Islands', 
-       fr: 'French', 
-       'fr-be': 'French (Belgium)', 
+       //fo: 'Faroe Islands',
+       fr: 'French',
+       'fr-be': 'French (Belgium)',
        'fr-ca': 'French (Canada)',
        'fr-ch': 'French (Swiss)',
        //hr: 'Croatia',
        hu: 'Hungarian',
        is: 'Icelandic',
-       it: 'Italian', 
+       it: 'Italian',
        ja: 'Japanese',
        lt: 'Lithuanian',
        //lv: 'Latvian',
-       mk: 'Macedonian', 
+       mk: 'Macedonian',
        nl: 'Dutch',
        //'nl-be': 'Dutch (Belgium)',
-       no: 'Norwegian', 
+       no: 'Norwegian',
        pl: 'Polish',
        pt: 'Portuguese',
        'pt-br': 'Portuguese (Brazil)',
@@ -221,7 +244,7 @@ Ext.define('PVE.Utils', { statics: {
     },
 
     kvm_keymap_array: function() {
-       var data = [['', PVE.Utils.render_kvm_language('')]];
+       var data = [['__default__', PVE.Utils.render_kvm_language('')]];
        Ext.Object.each(PVE.Utils.kvm_keymaps, function(key, value) {
            data.push([key, PVE.Utils.render_kvm_language(value)]);
        });
@@ -230,10 +253,8 @@ Ext.define('PVE.Utils', { statics: {
     },
 
     render_console_viewer: function(value) {
-       if (!value) {
+       if (!value || value === '__default__') {
            return PVE.Utils.defaultText + ' (HTML5)';
-       } else if (value === 'applet') {
-           return 'Java VNC Applet';
        } else if (value === 'vv') {
            return  'SPICE (remote-viewer)';
        } else if (value === 'html5') {
@@ -277,7 +298,7 @@ Ext.define('PVE.Utils', { statics: {
     },
 
     language_array: function() {
-       var data = [['', PVE.Utils.render_language('')]];
+       var data = [['__default__', PVE.Utils.render_language('')]];
        Ext.Object.each(PVE.Utils.language_map, function(key, value) {
            data.push([key, PVE.Utils.render_language(value)]);
        });
@@ -290,14 +311,14 @@ Ext.define('PVE.Utils', { statics: {
            return PVE.Utils.defaultText;
        }
        var text = PVE.Utils.kvm_vga_drivers[value];
-       if (text) { 
+       if (text) {
            return text + ' (' + value + ')';
        }
        return value;
     },
 
     kvm_vga_driver_array: function() {
-       var data = [['', PVE.Utils.render_kvm_vga_driver('')]];
+       var data = [['__default__', PVE.Utils.render_kvm_vga_driver('')]];
        Ext.Object.each(PVE.Utils.kvm_vga_drivers, function(key, value) {
            data.push([key, PVE.Utils.render_kvm_vga_driver(value)]);
        });
@@ -335,7 +356,7 @@ Ext.define('PVE.Utils', { statics: {
     // fixme: remove - not needed?
     gridLineHeigh: function() {
        return 21;
-       
+
        //if (Ext.isGecko)
        //return 23;
        //return 21;
@@ -355,10 +376,10 @@ Ext.define('PVE.Utils', { statics: {
            if (verbose && Ext.isObject(result.errors)) {
                msg += "<br>";
                Ext.Object.each(result.errors, function(prop, desc) {
-                   msg += "<br><b>" + Ext.htmlEncode(prop) + "</b>: " + 
+                   msg += "<br><b>" + Ext.htmlEncode(prop) + "</b>: " +
                        Ext.htmlEncode(desc);
                });
-           }   
+           }
        }
 
        return msg;
@@ -532,10 +553,15 @@ Ext.define('PVE.Utils', { statics: {
        qmsuspend: [ 'VM', gettext('Suspend') ],
        qmresume: [ 'VM', gettext('Resume') ],
        qmconfig: [ 'VM', gettext('Configure') ],
+       vzsnapshot: [ 'CT', gettext('Snapshot') ],
+       vzrollback: [ 'CT', gettext('Rollback') ],
+       vzdelsnapshot: [ 'CT', gettext('Delete Snapshot') ],
        vzcreate: ['CT', gettext('Create') ],
        vzrestore: ['CT', gettext('Restore') ],
        vzdestroy: ['CT', gettext('Destroy') ],
        vzmigrate: [ 'CT', gettext('Migrate') ],
+       vzclone: [ 'CT', gettext('Clone') ],
+       vztemplate: [ 'CT', gettext('Convert to template') ],
        vzstart: ['CT', gettext('Start') ],
        vzstop: ['CT', gettext('Stop') ],
        vzmount: ['CT', gettext('Mount') ],
@@ -564,7 +590,7 @@ Ext.define('PVE.Utils', { statics: {
        migrateall: [ '', gettext('Migrate all VMs and Containers') ]
     },
 
-    format_task_description: function(type, id) {      
+    format_task_description: function(type, id) {
        var farray = PVE.Utils.task_desc_table[type];
        if (!farray) {
            return type;
@@ -572,7 +598,7 @@ Ext.define('PVE.Utils', { statics: {
        var prefix = farray[0];
        var text = farray[1];
        if (prefix) {
-           return prefix + ' ' + id + ' - ' + text; 
+           return prefix + ' ' + id + ' - ' + text;
        }
        return text;
     },
@@ -600,32 +626,14 @@ Ext.define('PVE.Utils', { statics: {
     format_size: function(size) {
        /*jslint confusion: true */
 
-       if (size < 1024) {
-           return size;
-       }
-
-       var kb = size / 1024;
+       var units = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'];
+       var num = 0;
 
-       if (kb < 1024) {
-           return kb.toFixed(0) + "KB";
+       while (size >= 1024 && ((num++)+1) < units.length) {
+           size = size / 1024;
        }
 
-       var mb = size / (1024*1024);
-
-       if (mb < 1024) {
-           return mb.toFixed(0) + "MB";
-       }
-
-       var gb = mb / 1024;
-
-       if (gb < 1024) {
-           return gb.toFixed(2) + "GB";
-       }
-
-       var tb =  gb / 1024;
-
-       return tb.toFixed(2) + "TB";
-
+       return size.toFixed((num > 0)?2:0) + " " + units[num] + "B";
     },
 
     format_html_bar: function(per, text) {
@@ -633,7 +641,7 @@ Ext.define('PVE.Utils', { statics: {
        return "<div class='pve-bar-wrap'>" + text + "<div class='pve-bar-border'>" +
            "<div class='pve-bar-inner' style='width:" + per + "%;'></div>" +
            "</div></div>";
-       
+
     },
 
     format_cpu_bar: function(per1, per2, text) {
@@ -641,7 +649,7 @@ Ext.define('PVE.Utils', { statics: {
        return "<div class='pve-bar-border'>" +
            "<div class='pve-bar-inner' style='width:" + per1 + "%;'></div>" +
            "<div class='pve-bar-inner2' style='width:" + per2 + "%;'></div>" +
-           "<div class='pve-bar-text'>" + text + "</div>" + 
+           "<div class='pve-bar-text'>" + text + "</div>" +
            "</div>";
     },
 
@@ -653,7 +661,7 @@ Ext.define('PVE.Utils', { statics: {
 
        return "<div class='pve-largebar-border'>" +
            "<div class='pve-largebar-inner' style='width:" + per + "%;'></div>" +
-           "<div class='pve-largebar-text'>" + text + "</div>" + 
+           "<div class='pve-largebar-text'>" + text + "</div>" +
            "</div>";
     },
 
@@ -675,7 +683,7 @@ Ext.define('PVE.Utils', { statics: {
 
        if (days) {
            var ds = days > 1 ? PVE.Utils.daysText : PVE.Utils.dayText;
-           return days.toString() + ' ' + ds + ' ' + 
+           return days.toString() + ' ' + ds + ' ' +
                hours_str + ':' + mins_str + ':' + ut_str;
        } else {
            return hours_str + ':' + mins_str + ':' + ut_str;
@@ -683,7 +691,7 @@ Ext.define('PVE.Utils', { statics: {
     },
 
     format_duration_short: function(ut) {
-       
+
        if (ut < 60) {
            return ut.toString() + 's';
        }
@@ -699,7 +707,7 @@ Ext.define('PVE.Utils', { statics: {
        }
 
        var days = ut / 86400;
-       return days.toFixed(0) + 'd';   
+       return days.toFixed(0) + 'd';
     },
 
     yesText: gettext('Yes'),
@@ -721,6 +729,8 @@ Ext.define('PVE.Utils', { statics: {
     vztmplText: gettext('Container template'),
     isoImageText: gettext('ISO image'),
     containersText: gettext('Container'),
+    stateText: gettext('State'),
+    groupText: gettext('Group'),
 
     format_expire: function(date) {
        if (!date) {
@@ -738,6 +748,8 @@ Ext.define('PVE.Utils', { statics: {
            return 'GlusterFS';
        } else if (value === 'lvm') {
            return 'LVM';
+       } else if (value === 'lvmthin') {
+           return 'LVM-Thin';
        } else if (value === 'iscsi') {
            return 'iSCSI';
        } else if (value === 'rbd') {
@@ -750,13 +762,15 @@ Ext.define('PVE.Utils', { statics: {
            return 'ZFS';
        } else if (value === 'iscsidirect') {
            return 'iSCSIDirect';
+       } else if (value === 'drbd') {
+           return 'DRBD';
        } else {
            return PVE.Utils.unknownText;
        }
     },
 
     format_boolean_with_default: function(value) {
-       if (Ext.isDefined(value) && value !== '') {
+       if (Ext.isDefined(value) && value !== '__default__') {
            return value ? PVE.Utils.yesText : PVE.Utils.noText;
        }
        return PVE.Utils.defaultText;
@@ -770,6 +784,20 @@ Ext.define('PVE.Utils', { statics: {
        return !value ? PVE.Utils.yesText : PVE.Utils.noText;
     },
 
+    format_ha: function(value) {
+       var text = PVE.Utils.format_boolean(value.managed);
+
+       if (value.managed) {
+           text += ', ' + PVE.Utils.stateText + ': ';
+           text += value.state || PVE.Utils.noneText;
+
+           text += ', ' +  PVE.Utils.groupText + ': ';
+           text += value.group || PVE.Utils.noneText;
+       }
+
+       return text;
+    },
+
     format_content_types: function(value) {
        var cta = [];
 
@@ -795,8 +823,8 @@ Ext.define('PVE.Utils', { statics: {
        if (Ext.isNumber(data.channel) &&
            Ext.isNumber(data.id) &&
            Ext.isNumber(data.lun)) {
-           return "CH " + 
-               Ext.String.leftPad(data.channel,2, '0') + 
+           return "CH " +
+               Ext.String.leftPad(data.channel,2, '0') +
                " ID " + data.id + " LUN " + data.lun;
        }
        return data.volid.replace(/^.*:(.*\/)?/,'');
@@ -817,7 +845,7 @@ Ext.define('PVE.Utils', { statics: {
        if (!Ext.isNumeric(maxcpu) && (maxcpu >= 1)) {
            return '';
        }
-       
+
        var per = value * 100;
 
        return per.toFixed(1) + '% of ' + maxcpu.toString() + (maxcpu > 1 ? 'CPUs' : 'CPU');
@@ -838,11 +866,40 @@ Ext.define('PVE.Utils', { statics: {
        return Ext.Date.format(servertime, 'Y-m-d H:i:s');
     },
 
+    calculate_mem_usage: function(data) {
+       if (!Ext.isNumeric(data.mem) ||
+           data.maxmem === 0 ||
+           data.uptime < 1) {
+           return -1;
+       }
+
+       return (data.mem / data.maxmem);
+    },
+
+    render_mem_usage_percent: function(value, metaData, record, rowIndex, colIndex, store) {
+       if (!Ext.isNumeric(value) || value === -1) {
+           return '';
+       }
+       if (value > 1 ) {
+           // we got no percentage but bytes
+           var mem = value;
+           var maxmem = record.data.maxmem;
+           if (!record.data.uptime ||
+               maxmem === 0 ||
+               !Ext.isNumeric(mem)) {
+               return '';
+           }
+
+           return ((mem*100)/maxmem).toFixed(1) + " %";
+       }
+       return (value*100).toFixed(1) + " %";
+    },
+
     render_mem_usage: function(value, metaData, record, rowIndex, colIndex, store) {
 
        var mem = value;
        var maxmem = record.data.maxmem;
-       
+
        if (!record.data.uptime) {
            return '';
        }
@@ -851,38 +908,83 @@ Ext.define('PVE.Utils', { statics: {
            return '';
        }
 
-       var per = (mem * 100) / maxmem;
+       return PVE.Utils.render_size(value);
+    },
 
-       return per.toFixed(1) + '%';
+    calculate_disk_usage: function(data) {
+
+       if (!Ext.isNumeric(data.disk) ||
+           data.type === 'qemu' ||
+           (data.type === 'lxc' && data.uptime === 0) ||
+           data.maxdisk === 0) {
+           return -1;
+       }
+
+       return (data.disk / data.maxdisk);
+    },
+
+    render_disk_usage_percent: function(value, metaData, record, rowIndex, colIndex, store) {
+       if (!Ext.isNumeric(value) || value === -1) {
+           return '';
+       }
+
+       return (value * 100).toFixed(1) + " %";
     },
 
     render_disk_usage: function(value, metaData, record, rowIndex, colIndex, store) {
 
        var disk = value;
        var maxdisk = record.data.maxdisk;
+       var type = record.data.type;
 
-       if (!(Ext.isNumeric(disk) && maxdisk)) {
+       if (!Ext.isNumeric(disk) ||
+           type === 'qemu' ||
+           maxdisk === 0 ||
+           (type === 'lxc' && record.data.uptime === 0)) {
            return '';
        }
 
-       var per = (disk * 100) / maxdisk;
-
-       return per.toFixed(1) + '%';
+       return PVE.Utils.render_size(value);
     },
 
     render_resource_type: function(value, metaData, record, rowIndex, colIndex, store) {
 
-       var cls = 'pve-itype-icon-' + value;
+       var icon = '';
+       var gridcls = '';
+
+       switch (value) {
+           case 'lxc': icon = 'cube';
+                       gridcls = '-stopped';
+                       break;
+           case 'qemu': icon = 'desktop';
+                        gridcls = '-stopped';
+                        break;
+           case 'node': icon = 'building';
+                        gridcls = '-offline';
+                        break;
+           case 'storage': icon = 'database'; break;
+           case 'pool': icon = 'tags'; break;
+           default: icon = 'file';
+       }
 
-       if (record.data.running) {
-           metaData.tdCls = cls + "-running";
-       } else if (record.data.template) {
-           metaData.tdCls = cls + "-template";     
-       } else {
-           metaData.tdCls = cls;
+       if (value === 'lxc' || value === 'qemu') {
+           if (record.data.running && record.data.status !== 'paused') {
+               gridcls = '-running';
+           } else if (record.data.running) {
+               gridcls = '-paused';
+           }
+           if (record.data.template) {
+               icon = 'file-o';
+               gridcls = '-template-' + value;
+           }
+       } else if (value === 'node') {
+           if (record.data.running) {
+               gridcls = '-online';
+           }
        }
 
-       return value;
+       var fa = '<i class="fa fa-fw x-fa-grid' + gridcls  +  ' fa-' + icon  + '"></i> ';
+       return fa + value;
     },
 
     render_uptime: function(value, metaData, record, rowIndex, colIndex, store) {
@@ -892,7 +994,7 @@ Ext.define('PVE.Utils', { statics: {
        if (uptime === undefined) {
            return '';
        }
-       
+
        if (uptime <= 0) {
            return '-';
        }
@@ -904,7 +1006,7 @@ Ext.define('PVE.Utils', { statics: {
        return PVE.Utils.support_level_hash[value] || '-';
     },
 
-    render_upid: function(value, metaData, record) { 
+    render_upid: function(value, metaData, record) {
        var type = record.data.type;
        var id = record.data.id;
 
@@ -927,7 +1029,7 @@ Ext.define('PVE.Utils', { statics: {
        return window.location.hostname.replace(IP6_bracket_match,
             function(m, addr, offset, original) { return addr; });
     },
+
     openDefaultConsoleWindow: function(allowSpice, vmtype, vmid, nodename, vmname) {
        var dv = PVE.Utils.defaultViewer(allowSpice);
        PVE.Utils.openConsoleWindow(dv, vmtype, vmid, nodename, vmname);
@@ -944,8 +1046,8 @@ Ext.define('PVE.Utils', { statics: {
            throw "no nodename specified";
        }
 
-       if (viewer === 'applet' || viewer === 'html5') {
-           PVE.Utils.openVNCViewer(vmtype, vmid, nodename, vmname, viewer === 'html5');
+       if (viewer === 'html5') {
+           PVE.Utils.openVNCViewer(vmtype, vmid, nodename, vmname);
        } else if (viewer === 'vv') {
            var url;
            var params = { proxy: PVE.Utils.windowHostname() };
@@ -978,10 +1080,10 @@ Ext.define('PVE.Utils', { statics: {
        return dv;
     },
 
-    openVNCViewer: function(vmtype, vmid, nodename, vmname, novnc) {
+    openVNCViewer: function(vmtype, vmid, nodename, vmname) {
        var url = Ext.urlEncode({
            console: vmtype, // kvm, lxc, upgrade or shell
-           novnc: novnc ? 1 : 0,
+           novnc: 1,
            vmid: vmid,
            vmname: vmname,
            node: nodename
@@ -1030,13 +1132,13 @@ Ext.define('PVE.Utils', { statics: {
                });
                var url = 'data:application/x-virt-viewer;charset=UTF-8,' +
                    encodeURIComponent(raw);
-                   
+
                downloadWithName(url, "pve-spice.vv");
            }
        });
     },
 
-    // comp.setLoading() is buggy in ExtJS 4.0.7, so we 
+    // comp.setLoading() is buggy in ExtJS 4.0.7, so we
     // use el.mask() instead
     setErrorMask: function(comp, msg) {
        var el = comp.el;
@@ -1072,7 +1174,8 @@ Ext.define('PVE.Utils', { statics: {
            }
 
            var msg;
-           var operation = request.operation;
+           /*jslint nomen: true */
+           var operation = request._operation;
            var error = operation.getError();
            if (error.statusText) {
                msg = error.statusText + ' (' + error.status + ')';
@@ -1081,7 +1184,37 @@ Ext.define('PVE.Utils', { statics: {
            }
            PVE.Utils.setErrorMask(me, msg);
        });
-    }
+    },
+
+    createCmdMenu: function(v, record, item, index, event) {
+       event.stopEvent();
+       v.select(record);
+       var menu;
 
+       if (record.data.type === 'qemu' && !record.data.template) {
+           menu = Ext.create('PVE.qemu.CmdMenu', {
+               pveSelNode: record
+           });
+       } else if (record.data.type === 'qemu' && record.data.template) {
+           menu = Ext.create('PVE.qemu.TemplateMenu', {
+               pveSelNode: record
+           });
+       } else if (record.data.type === 'lxc' && !record.data.template) {
+           menu = Ext.create('PVE.lxc.CmdMenu', {
+               pveSelNode: record
+           });
+       } else if (record.data.type === 'lxc' && record.data.template) {
+           /* since clone does not work reliably, disable for now
+           menu = Ext.create('PVE.lxc.TemplateMenu', {
+               pveSelNode: record
+           });
+           */
+           return;
+       } else {
+           return;
+       }
+
+       menu.showAt(event.getXY());
+    }
 }});