proxmox-backup/www/Application.js

63 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-12-04 16:53:10 +00:00
Ext.define('PBS.Application', {
extend: 'Ext.app.Application',
name: 'PBS',
appProperty: 'app',
stores: [
'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;
if (me.currentView !== undefined) {
2019-01-30 14:14:20 +00:00
me.currentView.destroy();
}
me.currentView = Ext.create({
xtype: view,
});
if (skipCheck !== true) {
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);
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);
}
},
2018-12-04 16:53:10 +00:00
});
Ext.application('PBS.Application');