]> git.proxmox.com Git - proxmox-backup.git/blobdiff - www/Application.js
ui: verify config: eslint fix
[proxmox-backup.git] / www / Application.js
index 8639c515b9d7f9270b4bf78e66d696ea9b0337da..88f7f8ce43278065b4ad622b43d0afe306e2dfa7 100644 (file)
@@ -1,4 +1,3 @@
-/*global Proxmox*/
 Ext.define('PBS.Application', {
     extend: 'Ext.app.Application',
 
@@ -6,7 +5,7 @@ Ext.define('PBS.Application', {
     appProperty: 'app',
 
     stores: [
-       // 'NavigationStore'
+       'NavigationStore',
     ],
 
     layout: 'fit',
@@ -20,15 +19,30 @@ Ext.define('PBS.Application', {
 
     logout: function() {
        var me = this;
-       //Proxmox.Utils.authClear();
-       //me.changeView('loginview', true);
+       Proxmox.Utils.authClear();
+       me.changeView('loginview', true);
     },
 
     changeView: function(view, skipCheck) {
        var me = this;
-       //?
+       PBS.view = view;
+       me.view = view;
+
+       if (me.currentView !== undefined) {
+           me.currentView.destroy();
+       }
+
+       me.currentView = Ext.create({
+           xtype: view,
+       });
+       if (skipCheck !== true) {
+           // fixme:
+           // Proxmox.Utils.checked_command(function() {}); // display subscription status
+       }
     },
 
+    view: 'loginview',
+
     launch: function() {
        var me = this;
        Ext.on('resize', me.realignWindows);
@@ -36,12 +50,14 @@ Ext.define('PBS.Application', {
        var provider = new Ext.state.LocalStorageProvider({ prefix: 'ext-pbs-' });
        Ext.state.Manager.setProvider(provider);
 
-       // fixme: show login window if not loggedin
-
-       me.currentView = Ext.create({
-           xtype: 'mainview'
-       });
-    }
+       // show login window if not loggedin
+       var loggedin = Proxmox.Utils.authOK();
+       if (!loggedin) {
+           me.changeView('loginview', true);
+       } else {
+           me.changeView('mainview', true);
+       }
+    },
 });
 
 Ext.application('PBS.Application');