]> 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 5c81d7f8d886e0bcfd90b844ecf576403ce3ea60..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
@@ -648,9 +647,8 @@ Ext.define('PVE.Utils', { utilities: {
        },
        pbs: {
            name: 'Proxmox Backup Server',
-           //ipanel: '', // TODO
-           hideAdd: true,
-           faIcon: 'database',
+           ipanel: 'PBSInputPanel',
+           faIcon: 'floppy-o',
        },
        drbd: {
            name: 'DRBD',
@@ -795,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 '';
@@ -1018,49 +1015,42 @@ Ext.define('PVE.Utils', { utilities: {
             function(m, addr, offset, original) { return addr; });
     },
 
-    openDefaultConsoleWindow: function(consoles, vmtype, vmid, nodename, vmname, cmd) {
+    openDefaultConsoleWindow: function(consoles, consoleType, vmid, nodename, vmname, cmd) {
        var dv = PVE.Utils.defaultViewer(consoles);
-       PVE.Utils.openConsoleWindow(dv, vmtype, vmid, nodename, vmname, cmd);
+       PVE.Utils.openConsoleWindow(dv, consoleType, vmid, nodename, vmname, cmd);
     },
 
-    openConsoleWindow: function(viewer, vmtype, vmid, nodename, vmname, cmd) {
-       // 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, cmd);
+           PVE.Utils.openVNCViewer(consoleType, vmid, nodename, vmname, cmd);
        } else if (viewer === 'xtermjs') {
-           Proxmox.Utils.openXtermJsViewer(vmtype, vmid, nodename, vmname, cmd);
+           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 (vmtype === 'cmd') {
-               url = '/nodes/' + nodename + '/spiceshell';
+           } else if (consoleType === 'upgrade') {
+               params.cmd = 'upgrade';
+           } else if (consoleType === 'cmd') {
                params.cmd = cmd;
-               PVE.Utils.openSpiceViewer(url, params);
+           } 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}'`;
        }
     },
 
@@ -1126,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);
            }
        };
@@ -1457,6 +1447,20 @@ Ext.define('PVE.Utils', { utilities: {
            }
        });
     },
+
+    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,