]> git.proxmox.com Git - proxmox-widget-toolkit.git/blobdiff - Utils.js
MacPrefix: prevent multicast MacPrefixes
[proxmox-widget-toolkit.git] / Utils.js
index ac243ce6f3c0eef782c5184038361b7c2d044125..ef4aa5ece3474cf9da699d9c9bd5aa5b1feba828 100644 (file)
--- a/Utils.js
+++ b/Utils.js
@@ -1,10 +1,6 @@
 Ext.ns('Proxmox');
 Ext.ns('Proxmox.Setup');
 
-if (!Ext.isFunction(gettext)) {
-    function gettext(buf) { return buf; }
-}
-
 if (!Ext.isDefined(Proxmox.Setup.auth_cookie_name)) {
     throw "Proxmox library not initialized";
 }
@@ -61,7 +57,8 @@ Ext.define('Proxmox.Utils', { utilities: {
     groupText: gettext('Group'),
 
     language_map: {
-       zh_CN: 'Chinese',
+       zh_CN: 'Chinese (Simplified)',
+       zh_TW: 'Chinese (Traditional)',
        ca: 'Catalan',
        da: 'Danish',
        en: 'English',
@@ -283,7 +280,11 @@ Ext.define('Proxmox.Utils', { utilities: {
            Ext.apply(newopts, {
                success: function(response, options) {
                    if (options.waitMsgTarget) {
-                       options.waitMsgTarget.setLoading(false);
+                       if (Proxmox.Utils.toolkit === 'touch') {
+                           options.waitMsgTarget.setMasked(false);
+                       } else {
+                           options.waitMsgTarget.setLoading(false);
+                       }
                    }
                    var result = Ext.decode(response.responseText);
                    response.result = result;
@@ -298,7 +299,11 @@ Ext.define('Proxmox.Utils', { utilities: {
                },
                failure: function(response, options) {
                    if (options.waitMsgTarget) {
-                       options.waitMsgTarget.setLoading(false);
+                       if (Proxmox.Utils.toolkit === 'touch') {
+                           options.waitMsgTarget.setMasked(false);
+                       } else {
+                           options.waitMsgTarget.setLoading(false);
+                       }
                    }
                    response.result = {};
                    try {
@@ -323,8 +328,12 @@ Ext.define('Proxmox.Utils', { utilities: {
 
        var target = newopts.waitMsgTarget;
        if (target) {
-           // Note: ExtJS bug - this does not work when component is not rendered
-           target.setLoading(newopts.waitMsg);
+           if (Proxmox.Utils.toolkit === 'touch') {
+               target.setMasked({ xtype: 'loadmask', message: newopts.waitMsg} );
+           } else {
+               // Note: ExtJS bug - this does not work when component is not rendered
+               target.setLoading(newopts.waitMsg);
+           }
        }
        Ext.Ajax.request(newopts);
     },
@@ -396,6 +405,7 @@ Ext.define('Proxmox.Utils', { utilities: {
        eth: gettext("Network Device"),
        bridge: 'Linux Bridge',
        bond: 'Linux Bond',
+       vlan: 'Linux VLAN',
        OVSBridge: 'OVS Bridge',
        OVSBond: 'OVS Bond',
        OVSPort: 'OVS Port',
@@ -408,6 +418,16 @@ Ext.define('Proxmox.Utils', { utilities: {
     },
 
     task_desc_table: {
+       acmenewcert: [ 'SRV', gettext('Order Certificate') ],
+       acmeregister: [ 'ACME Account', gettext('Register') ],
+       acmedeactivate: [ 'ACME Account', gettext('Deactivate') ],
+       acmeupdate: [ 'ACME Account', gettext('Update') ],
+       acmerefresh: [ 'ACME Account', gettext('Refresh') ],
+       acmerenew: [ 'SRV', gettext('Renew Certificate') ],
+       acmerevoke: [ 'SRV', gettext('Revoke Certificate') ],
+       'move_volume': [ 'CT', gettext('Move Volume') ],
+       clustercreate: [ '', gettext('Create Cluster') ],
+       clusterjoin: [ '', gettext('Join Cluster') ],
        diskinit: [ 'Disk', gettext('Initialize Disk with GPT') ],
        vncproxy: [ 'VM/CT', gettext('Console') ],
        spiceproxy: [ 'VM/CT', gettext('Console') + ' (Spice)' ],
@@ -453,33 +473,44 @@ Ext.define('Proxmox.Utils', { utilities: {
        srvstop: ['SRV', gettext('Stop') ],
        srvrestart: ['SRV', gettext('Restart') ],
        srvreload: ['SRV', gettext('Reload') ],
+       cephcreatemgr: ['Ceph Manager', gettext('Create') ],
+       cephdestroymgr: ['Ceph Manager', gettext('Destroy') ],
        cephcreatemon: ['Ceph Monitor', gettext('Create') ],
        cephdestroymon: ['Ceph Monitor', gettext('Destroy') ],
        cephcreateosd: ['Ceph OSD', gettext('Create') ],
        cephdestroyosd: ['Ceph OSD', gettext('Destroy') ],
        cephcreatepool: ['Ceph Pool', gettext('Create') ],
        cephdestroypool: ['Ceph Pool', gettext('Destroy') ],
+       cephfscreate: ['CephFS', gettext('Create') ],
+       cephcreatemds: ['Ceph Metadata Server', gettext('Create') ],
+       cephdestroymds: ['Ceph Metadata Server', gettext('Destroy') ],
        imgcopy: ['', gettext('Copy data') ],
        imgdel: ['', gettext('Erase data') ],
+       unknownimgdel: ['', gettext('Destroy image from unknown guest') ],
        download: ['', gettext('Download') ],
-       vzdump: ['', gettext('Backup') ],
+       vzdump: ['VM/CT', gettext('Backup') ],
        aptupdate: ['', gettext('Update package database') ],
        startall: [ '', gettext('Start all VMs and Containers') ],
        stopall: [ '', gettext('Stop all VMs and Containers') ],
-       migrateall: [ '', gettext('Migrate all VMs and Containers') ]
+       migrateall: [ '', gettext('Migrate all VMs and Containers') ],
+       dircreate: [ gettext('Directory Storage'), gettext('Create') ],
+       lvmcreate: [ gettext('LVM Storage'), gettext('Create') ],
+       lvmthincreate: [ gettext('LVM-Thin Storage'), gettext('Create') ],
+       zfscreate: [ gettext('ZFS Storage'), gettext('Create') ]
     },
 
     format_task_description: function(type, id) {
        var farray = Proxmox.Utils.task_desc_table[type];
+       var text;
        if (!farray) {
-           var text = type;
+           text = type;
            if (id) {
                type += ' ' + id;
            }
            return text;
        }
        var prefix = farray[0];
-       var text = farray[1];
+       text = farray[1];
        if (prefix) {
            return prefix + ' ' + id + ' - ' + text;
        }
@@ -546,16 +577,20 @@ Ext.define('Proxmox.Utils', { utilities: {
        return Ext.Date.format(servertime, 'Y-m-d H:i:s');
     },
 
-    openXtermJsViewer: function(vmtype, vmid, nodename, vmname) {
-       var url = Ext.urlEncode({
+    openXtermJsViewer: function(vmtype, vmid, nodename, vmname, cmd) {
+       var url = Ext.Object.toQueryString({
            console: vmtype, // kvm, lxc, upgrade or shell
            xtermjs: 1,
            vmid: vmid,
            vmname: vmname,
-           node: nodename
+           node: nodename,
+           cmd: cmd,
+
        });
        var nw = window.open("?" + url, '_blank', 'toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=800,height=420');
-       nw.focus();
+       if (nw) {
+           nw.focus();
+       }
     }
 
 },