[pve-devel] [PATCH pve-manager 3/3] ext6migrate: move class static properties out of initComponent()

Emmanuel Kasper e.kasper at proxmox.com
Mon Nov 16 14:02:16 CET 2015


This fixes the Auth realm selection while login with ExtJS6
---
 www/manager6/form/RealmComboBox.js | 55 +++++++++++++++++---------------------
 1 file changed, 25 insertions(+), 30 deletions(-)

diff --git a/www/manager6/form/RealmComboBox.js b/www/manager6/form/RealmComboBox.js
index 34b417d..7e6700f 100644
--- a/www/manager6/form/RealmComboBox.js
+++ b/www/manager6/form/RealmComboBox.js
@@ -2,6 +2,28 @@ Ext.define('PVE.form.RealmComboBox', {
     extend: 'Ext.form.field.ComboBox',
     alias: ['widget.pveRealmComboBox'],
 
+    fieldLabel: gettext('Realm'),
+    name: 'realm',
+    queryMode: 'local',
+    allowBlank: false,
+    forceSelection: true,
+    autoSelect: false,
+    triggerAction: 'all',
+    valueField: 'realm',
+    displayField: 'descr',
+    getState: function() {
+	return { value: this.getValue() };
+    },
+    applyState : function(state) {
+	if (state && state.value) {
+	    this.setValue(state.value);
+	}
+    },
+    stateEvents: [ 'select' ],
+    stateful: true,
+    id: 'pveloginrealm', // fixme: remove (Stateful does not work without)
+    stateID: 'pveloginrealm',
+
     needOTP: function(realm) {
 	var me = this;
 
@@ -13,44 +35,17 @@ Ext.define('PVE.form.RealmComboBox', {
     initComponent: function() {
 	var me = this;
 
-	var stateid = 'pveloginrealm';
-
-	var realmstore = Ext.create('Ext.data.Store', {
+	me.store = Ext.create('Ext.data.Store', {
 	    model: 'pve-domains',
 	});
 
-	Ext.apply(me, {
-	    fieldLabel: gettext('Realm'),
-	    name: 'realm',
-	    store: realmstore,
-	    queryMode: 'local',
-	    allowBlank: false,
-	    forceSelection: true,
-	    autoSelect: false,
-	    triggerAction: 'all',
-	    valueField: 'realm',
-	    displayField: 'descr',
-	    getState: function() {
-		return { value: this.getValue() };
-	    },
-	    applyState : function(state) {
-		if (state && state.value) {
-		    this.setValue(state.value);
-		}
-	    },
-	    stateEvents: [ 'select' ],
-	    stateful: true,
-	    id: stateid, // fixme: remove (Stateful does not work without)  
-	    stateID: stateid
-	});
-
         me.callParent();
 
-	realmstore.load({
+	me.store.load({
 	    callback: function(r, o, success) {
 		if (success) {
 		    var def = me.getValue();
-		    if (!def || !realmstore.findRecord('realm', def)) {
+		    if (!def || !me.store.findRecord('realm', def)) {
 			def = 'pam';
 			Ext.each(r, function(record) {
 			    if (record.data && record.data["default"]) { 
-- 
2.1.4





More information about the pve-devel mailing list