]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager6/Workspace.js
ui: eslint: fix various spacing related issues
[pve-manager.git] / www / manager6 / Workspace.js
index ff08018e396a99c3613ef500fe9c06b3f95ff7e1..c9c4808dbf2e281cc2bdbd0c4352c58ce1007ce9 100644 (file)
@@ -23,6 +23,7 @@ Ext.define('PVE.Workspace', {
 
        var rt = me.down('pveResourceTree');
        rt.setDatacenterText(loginData.clustername);
+       PVE.ClusterName = loginData.clustername;
 
        if (loginData.cap) {
            Ext.state.Manager.set('GuiCap', loginData.cap);
@@ -37,6 +38,7 @@ Ext.define('PVE.Workspace', {
        var me = this;
 
        Proxmox.Utils.authClear();
+       Ext.state.Manager.clear('GuiCap');
        Proxmox.UserName = null;
        me.loginData = null;
 
@@ -46,14 +48,14 @@ Ext.define('PVE.Workspace', {
                    me.login = null;
                    me.updateLoginData(data);
                    Proxmox.Utils.checked_command(function() {}); // display subscription status
-               }
+               },
            });
        }
        me.onLogin(null);
         me.login.show();
     },
 
-    initComponent : function() {
+    initComponent: function() {
        var me = this;
 
        Ext.tip.QuickTipManager.init();
@@ -74,7 +76,7 @@ Ext.define('PVE.Workspace', {
 
         if (!Proxmox.Utils.authOK()) {
            me.showLogin();
-       } else { 
+       } else {
            if (me.loginData) {
                me.onLogin(me.loginData);
            }
@@ -88,22 +90,21 @@ Ext.define('PVE.Workspace', {
                }
 
                Ext.Ajax.request({
-                   params: { 
+                   params: {
                        username: Proxmox.UserName,
-                       password: ticket
+                       password: ticket,
                    },
                    url: '/api2/json/access/ticket',
                    method: 'POST',
                    success: function(response, opts) {
                        var obj = Ext.decode(response.responseText);
                        me.updateLoginData(obj.data);
-                   }
+                   },
                });
            },
-           interval: 15*60*1000
+           interval: 15*60*1000,
        });
-
-    }
+    },
 });
 
 Ext.define('PVE.StdWorkspace', {
@@ -114,7 +115,7 @@ Ext.define('PVE.StdWorkspace', {
     // private
     setContent: function(comp) {
        var me = this;
-       
+
        var cont = me.child('#content');
 
        var lay = cont.getLayout();
@@ -127,13 +128,12 @@ Ext.define('PVE.StdWorkspace', {
            cont.add(comp);
            if (cur !== null && lay.getNext()) {
                lay.next();
-               var task = Ext.create('Ext.util.DelayedTask', function(){
+               var task = Ext.create('Ext.util.DelayedTask', function() {
                    cont.remove(cur);
                });
                task.delay(10);
            }
-       }
-       else {
+       } else {
            // helper for cleaning the content when logging out
            cont.removeAll();
        }
@@ -159,7 +159,7 @@ Ext.define('PVE.StdWorkspace', {
                success: function(response) {
                    PVE.VersionInfo = response.result.data;
                    me.updateVersionInfo();
-               }
+               },
            });
 
            Proxmox.Utils.API2Request({
@@ -182,7 +182,7 @@ Ext.define('PVE.StdWorkspace', {
     updateUserInfo: function() {
        var me = this;
        var ui = me.query('#userinfo')[0];
-       ui.setText(Proxmox.UserName || '');
+       ui.setText(Ext.String.htmlEncode(Proxmox.UserName || ''));
        ui.updateLayout();
     },
 
@@ -200,7 +200,7 @@ Ext.define('PVE.StdWorkspace', {
        ui.updateLayout();
     },
 
-    initComponent : function() {
+    initComponent: function() {
        var me = this;
 
        Ext.History.init();
@@ -226,26 +226,26 @@ Ext.define('PVE.StdWorkspace', {
                                lxc: 'PVE.lxc.Config',
                                storage: 'PVE.storage.Browser',
                                sdn: 'PVE.sdn.Browser',
-                               pool: 'pvePoolConfig'
+                               pool: 'pvePoolConfig',
                            };
                            var comp = {
-                               xtype: tlckup[n.data.type || 'root'] || 
+                               xtype: tlckup[n.data.type || 'root'] ||
                                    'pvePanelConfig',
                                showSearch: (n.data.id === 'root') ||
                                    Ext.isDefined(n.data.groupbyid),
                                pveSelNode: n,
                                workspace: me,
-                               viewFilter: selview.getViewFilter()
+                               viewFilter: selview.getViewFilter(),
                            };
                            PVE.curSelectedNode = n;
                            me.setContent(comp);
                        }
-                   }
-               }
-           }
+                   },
+               },
+           },
        });
 
-       selview.on('select', function(combo, records) { 
+       selview.on('select', function(combo, records) {
            if (records) {
                var view = combo.getViewFilter();
                rtree.setViewFilter(view);
@@ -264,7 +264,7 @@ Ext.define('PVE.StdWorkspace', {
            handler: function() {
                var wiz = Ext.create('PVE.qemu.CreateWizard', {});
                wiz.show();
-           } 
+           },
        });
 
        var createCT = Ext.createWidget('button', {
@@ -277,7 +277,7 @@ Ext.define('PVE.StdWorkspace', {
            handler: function() {
                var wiz = Ext.create('PVE.lxc.CreateWizard', {});
                wiz.show();
-           } 
+           },
        });
 
        sprovider.on('statechange', function(sp, key, value) {
@@ -294,32 +294,31 @@ Ext.define('PVE.StdWorkspace', {
            items: [
                {
                    region: 'north',
-                   layout: { 
+                   layout: {
                        type: 'hbox',
-                       align: 'middle'
+                       align: 'middle',
                    },
-                   baseCls: 'x-plain',         
+                   baseCls: 'x-plain',
                    defaults: {
-                       baseCls: 'x-plain'                      
+                       baseCls: 'x-plain',
                    },
                    border: false,
                    margin: '2 0 2 5',
                    items: [
                        {
-                           html: '<a class="x-unselectable" target=_blank href="https://www.proxmox.com">' +
-                               '<img style="padding-top:4px;padding-right:5px" src="/pve2/images/proxmox_logo.png"/></a>'
+                           xtype: 'proxmoxlogo',
                        },
                        {
                            minWidth: 150,
                            id: 'versioninfo',
-                           html: 'Virtual Environment'
+                           html: 'Virtual Environment',
                        },
                        {
                            xtype: 'pveGlobalSearchField',
-                           tree: rtree
+                           tree: rtree,
                        },
                        {
-                           flex: 1
+                           flex: 1,
                        },
                        {
                            xtype: 'proxmoxHelpButton',
@@ -329,9 +328,9 @@ Ext.define('PVE.StdWorkspace', {
                            listenToGlobalEvent: false,
                            onlineHelp: 'pve_documentation_index',
                            text: gettext('Documentation'),
-                           margin: '0 5 0 0'
+                           margin: '0 5 0 0',
                        },
-                       createVM, 
+                       createVM,
                        createCT,
                        {
                            pack: 'end',
@@ -342,7 +341,7 @@ Ext.define('PVE.StdWorkspace', {
                            style: {
                                // proxmox dark grey p light grey as border
                                backgroundColor: '#464d4d',
-                               borderColor: '#ABBABA'
+                               borderColor: '#ABBABA',
                            },
                            iconCls: 'fa fa-user',
                            menu: [
@@ -352,37 +351,35 @@ Ext.define('PVE.StdWorkspace', {
                                    handler: function() {
                                        var win = Ext.create('PVE.window.Settings');
                                        win.show();
-                                   }
+                                   },
                                },
                                {
                                    text: gettext('Password'),
                                    iconCls: 'fa fa-fw fa-key',
                                    handler: function() {
                                        var win = Ext.create('Proxmox.window.PasswordEdit', {
-                                           userid: Proxmox.UserName
+                                           userid: Proxmox.UserName,
                                        });
                                        win.show();
-                                   }
+                                   },
                                },
                                {
                                    text: 'TFA',
                                    iconCls: 'fa fa-fw fa-lock',
                                    handler: function(btn, event, rec) {
-                                       var win = Ext.create('PVE.window.TFAEdit',{
-                                           userid: Proxmox.UserName
+                                       var win = Ext.create('PVE.window.TFAEdit', {
+                                           userid: Proxmox.UserName,
                                        });
                                        win.show();
-                                   }
+                                   },
                                },
                                {
-                                   text: gettext('API Tokens'),
-                                   iconCls: 'fa fa-fw fa-user-o',
-                                   handler: function(btn, event, rec) {
-                                       var win = Ext.create('PVE.window.TokenView',{
-                                           userid: Proxmox.UserName
-                                       });
-                                       win.show();
-                                   }
+                                   iconCls: 'fa fa-language',
+                                   text: gettext('Language'),
+                                   handler: function() {
+                                       Ext.create('Proxmox.window.LanguageEditWindow')
+                                           .show();
+                                   },
                                },
                                '-',
                                {
@@ -403,11 +400,11 @@ Ext.define('PVE.StdWorkspace', {
                                                comp.getStore().loadData([], false);
                                            }
                                        });
-                                   }
-                               }
-                           ]
-                       }
-                   ]
+                                   },
+                               },
+                           ],
+                       },
+                   ],
                },
                {
                    region: 'center',
@@ -420,7 +417,7 @@ Ext.define('PVE.StdWorkspace', {
                    layout: { type: 'card' },
                    border: false,
                    margin: '0 5 0 0',
-                   items: []
+                   items: [],
                },
                {
                    region: 'west',
@@ -433,15 +430,15 @@ Ext.define('PVE.StdWorkspace', {
                    margin: '0 0 0 5',
                    split: true,
                    width: 200,
-                   items: [ selview, rtree ],
+                   items: [selview, rtree],
                    listeners: {
                        resize: function(panel, width, height) {
                            var viewWidth = me.getSize().width;
                            if (width > viewWidth - 100) {
                                panel.setWidth(viewWidth - 100);
                            }
-                       }
-                   }
+                       },
+                   },
                },
                {
                    xtype: 'pveStatusPanel',
@@ -449,22 +446,22 @@ Ext.define('PVE.StdWorkspace', {
                    stateId: 'pvesouth',
                    itemId: 'south',
                    region: 'south',
-                   margin:'0 5 5 5',
+                   margin: '0 5 5 5',
                    title: gettext('Logs'),
                    collapsible: true,
                    header: false,
                    height: 200,
-                   split:true,
+                   split: true,
                    listeners: {
                        resize: function(panel, width, height) {
                            var viewHeight = me.getSize().height;
                            if (height > (viewHeight - 150)) {
                                panel.setHeight(viewHeight - 150);
                            }
-                       }
-                   }
-               }
-           ]
+                       },
+                   },
+               },
+           ],
        });
 
        me.callParent();
@@ -472,14 +469,14 @@ Ext.define('PVE.StdWorkspace', {
        me.updateUserInfo();
 
        // on resize, center all modal windows
-       Ext.on('resize', function(){
+       Ext.on('resize', function() {
            var wins = Ext.ComponentQuery.query('window[modal]');
            if (wins.length > 0) {
-               wins.forEach(function(win){
+               wins.forEach(function(win) {
                    win.alignTo(me, 'c-c');
                });
            }
        });
-    }
+    },
 });