]> git.proxmox.com Git - proxmox-backup.git/blob - www/Application.js
ui: do *not* close panel when triggering datastore GC
[proxmox-backup.git] / www / Application.js
1 /*global Proxmox*/
2 Ext.define('PBS.Application', {
3 extend: 'Ext.app.Application',
4
5 name: 'PBS',
6 appProperty: 'app',
7
8 stores: [
9 'NavigationStore'
10 ],
11
12 layout: 'fit',
13
14 realignWindows: function() {
15 var modalwindows = Ext.ComponentQuery.query('window[modal]');
16 Ext.Array.forEach(modalwindows, function(item) {
17 item.center();
18 });
19 },
20
21 logout: function() {
22 var me = this;
23 Proxmox.Utils.authClear();
24 me.changeView('loginview', true);
25 },
26
27 changeView: function(view, skipCheck) {
28 var me = this;
29 PBS.view = view;
30 me.view = view;
31
32 if (me.currentView != undefined) {
33 me.currentView.destroy();
34 }
35
36 me.currentView = Ext.create({
37 xtype: view,
38 });
39 if (skipCheck !== true) {
40 // fixme:
41 // Proxmox.Utils.checked_command(function() {}); // display subscription status
42 }
43 },
44
45 view: 'loginview',
46
47 launch: function() {
48 var me = this;
49 Ext.on('resize', me.realignWindows);
50
51 var provider = new Ext.state.LocalStorageProvider({ prefix: 'ext-pbs-' });
52 Ext.state.Manager.setProvider(provider);
53
54 // show login window if not loggedin
55 var loggedin = Proxmox.Utils.authOK();
56 if (!loggedin) {
57 me.changeView('loginview', true);
58 } else {
59 me.changeView('mainview', true);
60 }
61 }
62 });
63
64 Ext.application('PBS.Application');