ui: make username a menu-button

like we did in PVE and PMG

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-07-09 14:24:33 +02:00
parent c8bed1b4d7
commit f6e964b96e

View File

@ -125,7 +125,7 @@ Ext.define('PBS.MainView', {
}, },
control: { control: {
'button[reference=logoutButton]': { '[reference=logoutButton]': {
click: 'logout' click: 'logout'
} }
}, },
@ -134,7 +134,7 @@ Ext.define('PBS.MainView', {
var me = this; var me = this;
PBS.data.RunningTasksStore.startUpdate(); PBS.data.RunningTasksStore.startUpdate();
me.lookupReference('usernameinfo').update({username:Proxmox.UserName}); me.lookupReference('usernameinfo').setText(Proxmox.UserName);
// show login on requestexception // show login on requestexception
// fixme: what about other errors // fixme: what about other errors
@ -209,12 +209,6 @@ Ext.define('PBS.MainView', {
flex: 1, flex: 1,
baseCls: 'x-plain', baseCls: 'x-plain',
}, },
{
baseCls: 'x-plain',
reference: 'usernameinfo',
padding: '0 5',
tpl: Ext.String.format(gettext("You are logged in as {0}"), "'{username}'")
},
{ {
xtype: 'button', xtype: 'button',
baseCls: 'x-btn', baseCls: 'x-btn',
@ -229,11 +223,23 @@ Ext.define('PBS.MainView', {
margin: '0 5 0 0', margin: '0 5 0 0',
}, },
{ {
reference: 'logoutButton',
xtype: 'button', xtype: 'button',
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', iconCls: 'fa fa-sign-out',
text: gettext('Logout') text: gettext('Logout'),
} },
],
},
] ]
}, },
{ {