pmg-gui/js/Application.js
Dominik Csapak 9bdd2de318 save info about which view is used
this is later needed for the spamquarantine, to determine
if we are in the admin view or quarantine view

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-08-23 12:37:20 +02:00

40 lines
799 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") {
PMG.view = 'quarantine';
Ext.create({ xtype: 'quarantineview' });
} else {
PMG.view = 'main';
Ext.create({ xtype: 'mainview' });
}
} else {
Ext.create({ xtype: 'loginview' });
}
}
});
Ext.application('PMG.Application');