[pve-devel] [PATCH 12/18] add application

Dominik Csapak d.csapak at proxmox.com
Tue Apr 4 13:48:52 CEST 2017


this is the main application class, which is responsible for loading
the main/login view

also for recentering modal windows

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 js/Application.js | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 js/Application.js

diff --git a/js/Application.js b/js/Application.js
new file mode 100644
index 0000000..9d36655
--- /dev/null
+++ b/js/Application.js
@@ -0,0 +1,31 @@
+Ext.define('PMG.Application', {
+    extend: 'Ext.app.Application',
+
+    name: 'PMG',
+
+    // default fragment for the router
+    defaultToken: 'pmgDashboard',
+
+    stores: [
+	'NavigationStore'
+    ],
+
+    layout: 'fit',
+
+    realignWindows: function() {
+	var modalwindows = Ext.ComponentQuery.query('window[modal]');
+	Ext.Array.forEach(modalwindows, function(item) {
+	    item.center();
+	});
+    },
+
+    launch: function() {
+	var me = this;
+	// show login window if not loggedin
+	var loggedin = Proxmox.Utils.authOK();
+	Ext.on('resize', me.realignWindows);
+	Ext.create({ xtype: loggedin ? 'mainview' : 'loginview' });
+    }
+});
+
+Ext.application('PMG.Application');
-- 
2.11.0





More information about the pve-devel mailing list