pmg-gui/js/Application.js
Dominik Csapak 033228c06d let the default token be chosen by the view
instead of the application, since we want a different default
token for the admin view and the quarantine view

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-08-18 16:26:57 +02:00

38 lines
751 B
JavaScript

Ext.define('PMG.Application', {
extend: 'Ext.app.Application',
name: 'PMG',
stores: [
'NavigationStore'
],
layout: 'fit',
realignWindows: function() {
var modalwindows = Ext.ComponentQuery.query('window[modal]');
Ext.Array.forEach(modalwindows, function(item) {
item.center();
});
},
launch: function() {
var me = this;
// show login window if not loggedin
var loggedin = Proxmox.Utils.authOK();
Ext.on('resize', me.realignWindows);
if (loggedin) {
if (location.pathname === "/quarantine") {
Ext.create({ xtype: 'quarantineview' });
} else {
Ext.create({ xtype: 'mainview' });
}
} else {
Ext.create({ xtype: 'loginview' });
}
}
});
Ext.application('PMG.Application');