]> git.proxmox.com Git - pmg-gui.git/blobdiff - js/MainView.js
d/control: remove unused and unset ${perl:Depends} dependency variable
[pmg-gui.git] / js / MainView.js
index 4b4a22c080564114bc2a26d5b040135fb886d0b5..1bcd83572a039a349da5d7a8d6eca64a5b842741 100644 (file)
@@ -1,3 +1,4 @@
+/*global Proxmox*/
 Ext.define('PMG.MainView', {
     extend: 'Ext.container.Container',
     xtype: 'mainview',
@@ -11,8 +12,8 @@ Ext.define('PMG.MainView', {
                action: 'changePath',
                before: 'beforeChangePath',
                 conditions : {
-                   ':path'    : '(?:([%a-zA-Z0-9\-\_\s,]+))',
-                   ':subpath' : '(?:(?::)([%a-zA-Z0-9\-\_\s,]+))?'
+                   ':path'    : '(?:([%a-zA-Z0-9\\-\\_\\s,]+))',
+                   ':subpath' : '(?:(?::)([%a-zA-Z0-9\\-\\_\\s,]+))?'
                }
            }
        },
@@ -34,12 +35,11 @@ Ext.define('PMG.MainView', {
                subpath = subpath || 0;
                if (lastpanel.getActiveTab) {
                    // we assume lastpanel is a tabpanel
-                   if (lastpanel.getActiveTab().getItemId() === subpath) {
-                       // we are already there
-                   } else {
+                   if (lastpanel.getActiveTab().getItemId() !== subpath) {
                        // set the active tab
                        lastpanel.setActiveTab(subpath);
                    }
+                   // else we are already there
                }
                action.stop();
                return;
@@ -84,10 +84,7 @@ Ext.define('PMG.MainView', {
        },
 
        logout: function() {
-           var me = this;
-           Proxmox.Utils.authClear();
-           me.getView().destroy();
-           Ext.create({ xtype: 'loginview'});
+           PMG.app.logout();
        },
 
        navigate: function(treelist, item) {
@@ -150,7 +147,7 @@ Ext.define('PMG.MainView', {
 
     plugins: 'viewport',
 
-    layout: 'border',
+    layout: { type: 'border' },
 
     items: [
        {
@@ -160,7 +157,8 @@ Ext.define('PMG.MainView', {
                type: 'hbox',
                align: 'middle'
            },
-           margin: '4 5 4 5',
+           margin: '2 5 2 5',
+           height: 38,
            items: [
                {
                    xtype: 'proxmoxlogo'
@@ -175,35 +173,56 @@ Ext.define('PMG.MainView', {
                    baseCls: 'x-plain',
                    reference: 'usernameinfo',
                    padding: '0 5',
-                   tpl: Ext.String.format(gettext("You are logged in as '{0}'"), '{username}')
+                   tpl: Ext.String.format(gettext("You are logged in as {0}"), "'{username}'")
+               },
+               {
+                   xtype: 'proxmoxHelpButton',
+                   hidden: false,
+                   baseCls: 'x-btn',
+                   iconCls: 'fa fa-info-circle x-btn-icon-el-default-toolbar-small ',
+                   margin: '0 5 0 0',
+                   listenToGlobalEvent: false,
+                   onlineHelp: 'pmg_documentation_index'
                },
                {
                    reference: 'logoutButton',
                    xtype: 'button',
                    iconCls: 'fa fa-sign-out',
-                   text: gettext('Logout'),
+                   text: gettext('Logout')
                }
            ]
        },
        {
-           xtype: 'navigationtree',
-           reference: 'navtree',
-           minWidth: 177,
+           xtype: 'panel',
+           scrollable: 'y',
            border: false,
            region: 'west',
-           // we have to define it here until extjs 6.2
-           // because of a bug where a viewcontroller does not detect
-           // the selectionchange event of a treelist
-           listeners: {
-               selectionchange: 'navigate'
-           }
+           layout: {
+               type: 'vbox',
+               align: 'stretch'
+           },
+           items: [{
+               xtype: 'navigationtree',
+               minWidth: 180,
+               reference: 'navtree',
+               // we have to define it here until extjs 6.2
+               // because of a bug where a viewcontroller does not detect
+               // the selectionchange event of a treelist
+               listeners: {
+                   selectionchange: 'navigate'
+               }
+           }, {
+               xtype: 'box',
+               cls: 'x-treelist-nav',
+               flex: 1
+           }]
        },
        {
            xtype: 'panel',
-           layout: 'card',
+           layout: { type: 'card' },
            region: 'center',
            border: false,
-           reference: 'contentpanel',
+           reference: 'contentpanel'
        }
     ]
 });