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