]> git.proxmox.com Git - proxmox-backup.git/blobdiff - www/MainView.js
api: disks: cleanup use statement
[proxmox-backup.git] / www / MainView.js
index bb15e9a8fc1f1abc539fafb30a836d020ad0486b..cfd190585115af542a29c9e11dca700a0e743571 100644 (file)
@@ -10,11 +10,11 @@ Ext.define('PBS.MainView', {
            ':path:subpath': {
                action: 'changePath',
                before: 'beforeChangePath',
-                conditions : {
-                   ':path'    : '(?:([%a-zA-Z0-9\\-\\_\\s,]+))',
-                   ':subpath' : '(?:(?::)([%a-zA-Z0-9\\-\\_\\s,]+))?'
-               }
-           }
+                conditions: {
+                   ':path': '(?:([%a-zA-Z0-9\\-\\_\\s,.]+))',
+                   ':subpath': '(?:(?::)([%a-zA-Z0-9\\-\\_\\s,]+))?',
+               },
+           },
        },
 
        beforeChangePath: function(path, subpath, action) {
@@ -72,10 +72,15 @@ Ext.define('PBS.MainView', {
                let datastore = PBS.Utils.getDataStoreFromPath(path);
                obj = contentpanel.add({
                    xtype: 'pbsDataStorePanel',
+                   nodename: 'localhost',
                    datastore,
                });
            } else {
-               obj = contentpanel.add({ xtype: path, border: false });
+               obj = contentpanel.add({
+                   xtype: path,
+                   nodename: 'localhost',
+                   border: false,
+               });
            }
 
            var treelist = me.lookupReference('navtree');
@@ -108,7 +113,6 @@ Ext.define('PBS.MainView', {
            if (lastpanel) {
                contentpanel.remove(lastpanel, { destroy: true });
            }
-
        },
 
        logout: function() {
@@ -120,20 +124,21 @@ Ext.define('PBS.MainView', {
        },
 
        control: {
-           'button[reference=logoutButton]': {
-               click: 'logout'
-           }
+           '[reference=logoutButton]': {
+               click: 'logout',
+           },
        },
 
        init: function(view) {
            var me = this;
 
-           me.lookupReference('usernameinfo').update({username:Proxmox.UserName});
+           PBS.data.RunningTasksStore.startUpdate();
+           me.lookupReference('usernameinfo').setText(Proxmox.UserName);
 
            // show login on requestexception
            // fixme: what about other errors
            Ext.Ajax.on('requestexception', function(conn, response, options) {
-               if (response.status == 401) { // auth failure
+               if (response.status === 401 || response.status === '401') { // auth failure
                    me.logout();
                }
            });
@@ -149,7 +154,7 @@ Ext.define('PBS.MainView', {
                    Ext.Ajax.request({
                        params: {
                            username: Proxmox.UserName,
-                           password: ticket
+                           password: ticket,
                        },
                        url: '/api2/json/access/ticket',
                        method: 'POST',
@@ -159,17 +164,17 @@ Ext.define('PBS.MainView', {
                        success: function(response, opts) {
                            var obj = Ext.decode(response.responseText);
                            PBS.Utils.updateLoginData(obj.data);
-                       }
+                       },
                    });
                },
-               interval: 15*60*1000
+               interval: 15*60*1000,
            });
 
 
            // select treeitem and load page from url fragment, if set
            let token = Ext.util.History.getToken() || 'pbsDashboard';
            this.redirectTo(token, true);
-       }
+       },
     },
 
     plugins: 'viewport',
@@ -182,9 +187,9 @@ Ext.define('PBS.MainView', {
            xtype: 'container',
            layout: {
                type: 'hbox',
-               align: 'middle'
+               align: 'middle',
            },
-           margin: '2 5 2 5',
+           margin: '2 0 2 5',
            height: 38,
            items: [
                {
@@ -192,16 +197,17 @@ Ext.define('PBS.MainView', {
                    prefix: '',
                },
                {
-                   xtype: 'versioninfo'
+                   padding: '0 0 0 5',
+                   xtype: 'versioninfo',
                },
                {
-                   flex: 1
+                   padding: 5,
+                   html: '<a href="https://bugzilla.proxmox.com" target="_blank">BETA</a>',
+                   baseCls: 'x-plain',
                },
                {
+                   flex: 1,
                    baseCls: 'x-plain',
-                   reference: 'usernameinfo',
-                   padding: '0 5',
-                   tpl: Ext.String.format(gettext("You are logged in as {0}"), "'{username}'")
                },
                {
                    xtype: 'button',
@@ -213,12 +219,28 @@ Ext.define('PBS.MainView', {
                    margin: '0 5 0 0',
                },
                {
-                   reference: 'logoutButton',
+                   xtype: 'pbsTaskButton',
+                   margin: '0 5 0 0',
+               },
+               {
                    xtype: 'button',
-                   iconCls: 'fa fa-sign-out',
-                   text: gettext('Logout')
-               }
-           ]
+                   reference: 'usernameinfo',
+                   style: {
+                       // proxmox dark grey p light grey as border
+                       backgroundColor: '#464d4d',
+                       borderColor: '#ABBABA',
+                   },
+                   margin: '0 5 0 0',
+                   iconCls: 'fa fa-user',
+                   menu: [
+                       {
+                           reference: 'logoutButton',
+                           iconCls: 'fa fa-sign-out',
+                           text: gettext('Logout'),
+                       },
+                   ],
+               },
+           ],
        },
        {
            xtype: 'panel',
@@ -227,7 +249,7 @@ Ext.define('PBS.MainView', {
            region: 'west',
            layout: {
                type: 'vbox',
-               align: 'stretch'
+               align: 'stretch',
            },
            items: [{
                xtype: 'navigationtree',
@@ -237,20 +259,20 @@ Ext.define('PBS.MainView', {
                // because of a bug where a viewcontroller does not detect
                // the selectionchange event of a treelist
                listeners: {
-                   selectionchange: 'navigate'
-               }
+                   selectionchange: 'navigate',
+               },
            }, {
                xtype: 'box',
                cls: 'x-treelist-nav',
-               flex: 1
-           }]
+               flex: 1,
+           }],
        },
        {
            xtype: 'panel',
            layout: { type: 'card' },
            region: 'center',
            border: false,
-           reference: 'contentpanel'
-       }
-    ]
+           reference: 'contentpanel',
+       },
+    ],
 });