2018-12-04 16:53:10 +00:00
|
|
|
Ext.define('PBS.Application', {
|
|
|
|
extend: 'Ext.app.Application',
|
|
|
|
|
|
|
|
name: 'PBS',
|
|
|
|
appProperty: 'app',
|
|
|
|
|
|
|
|
stores: [
|
2020-09-25 16:36:58 +00:00
|
|
|
'NavigationStore',
|
2018-12-04 16:53:10 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
layout: 'fit',
|
|
|
|
|
|
|
|
realignWindows: function() {
|
|
|
|
var modalwindows = Ext.ComponentQuery.query('window[modal]');
|
|
|
|
Ext.Array.forEach(modalwindows, function(item) {
|
|
|
|
item.center();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
logout: function() {
|
|
|
|
var me = this;
|
2019-01-30 14:14:20 +00:00
|
|
|
Proxmox.Utils.authClear();
|
|
|
|
me.changeView('loginview', true);
|
2018-12-04 16:53:10 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
changeView: function(view, skipCheck) {
|
|
|
|
var me = this;
|
2019-01-30 14:14:20 +00:00
|
|
|
PBS.view = view;
|
|
|
|
me.view = view;
|
|
|
|
|
2020-09-25 16:36:58 +00:00
|
|
|
if (me.currentView !== undefined) {
|
2019-01-30 14:14:20 +00:00
|
|
|
me.currentView.destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
me.currentView = Ext.create({
|
|
|
|
xtype: view,
|
|
|
|
});
|
|
|
|
if (skipCheck !== true) {
|
2020-11-10 12:38:30 +00:00
|
|
|
Proxmox.Utils.checked_command(Ext.emptyFn);
|
2019-01-30 14:14:20 +00:00
|
|
|
}
|
2018-12-04 16:53:10 +00:00
|
|
|
},
|
|
|
|
|
2019-01-30 14:14:20 +00:00
|
|
|
view: 'loginview',
|
|
|
|
|
2018-12-04 16:53:10 +00:00
|
|
|
launch: function() {
|
|
|
|
var me = this;
|
|
|
|
Ext.on('resize', me.realignWindows);
|
|
|
|
|
|
|
|
var provider = new Ext.state.LocalStorageProvider({ prefix: 'ext-pbs-' });
|
|
|
|
Ext.state.Manager.setProvider(provider);
|
|
|
|
|
2021-07-03 21:12:03 +00:00
|
|
|
let isOpenIDLogin = Proxmox.Utils.getOpenIDRedirectionAuthorization() !== undefined;
|
|
|
|
let alreadyLoggedIn = Proxmox.Utils.authOK();
|
2021-06-14 09:58:52 +00:00
|
|
|
|
2021-07-03 21:12:03 +00:00
|
|
|
if (isOpenIDLogin || !alreadyLoggedIn) {
|
|
|
|
me.changeView('loginview', true); // show login window if not loggedin
|
2019-01-30 14:14:20 +00:00
|
|
|
} else {
|
|
|
|
me.changeView('mainview', true);
|
|
|
|
}
|
2020-09-25 16:36:58 +00:00
|
|
|
},
|
2018-12-04 16:53:10 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
Ext.application('PBS.Application');
|