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) {
|
|
|
|
// fixme:
|
|
|
|
// Proxmox.Utils.checked_command(function() {}); // display subscription status
|
|
|
|
}
|
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);
|
|
|
|
|
2019-01-30 14:14:20 +00:00
|
|
|
// show login window if not loggedin
|
|
|
|
var loggedin = Proxmox.Utils.authOK();
|
|
|
|
if (!loggedin) {
|
|
|
|
me.changeView('loginview', true);
|
|
|
|
} 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');
|