[pve-devel] r5799 - in pve-manager/pve2/www/new: . form tree

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Apr 7 12:01:23 CEST 2011


Author: dietmar
Date: 2011-04-07 12:01:23 +0200 (Thu, 07 Apr 2011)
New Revision: 5799

Modified:
   pve-manager/pve2/www/new/StateProvider.js
   pve-manager/pve2/www/new/Workspace.js
   pve-manager/pve2/www/new/form/RealmComboBox.js
   pve-manager/pve2/www/new/form/ViewSelector.js
   pve-manager/pve2/www/new/index.pl
   pve-manager/pve2/www/new/tree/ResourceTree.js
Log:
fixes for extjs beta2


Modified: pve-manager/pve2/www/new/StateProvider.js
===================================================================
--- pve-manager/pve2/www/new/StateProvider.js	2011-04-07 06:18:50 UTC (rev 5798)
+++ pve-manager/pve2/www/new/StateProvider.js	2011-04-07 10:01:23 UTC (rev 5799)
@@ -25,9 +25,9 @@
 	    var value = Ext.decode(text);
 	    self.UIState[name] = value ? value.value : null;
 	});
-	console.dir(self.UIState);
 
 	Ext.History.on('change', function(token) {
+	    //console.log("HC " + token);
 	    if (!token) {
 		alert("no more history entries");
 		return;
@@ -43,6 +43,7 @@
 		if (newtext != oldtext) {
  		    window.localStorage.setItem(name, newtext);
 		    self.UIState[name] = newstate[name];
+		    //console.log("changed " + name + " " + newtext);
 		    self.fireEvent("statechange", self, name, newvalue);
 		}
 	    });
@@ -71,6 +72,7 @@
     set: function(name, value){
         var self = this;
 
+	//console.log("SET " + name + " " + Ext.encode(value));
 	if (typeof self.UIState[name] != "undefined") {
 	    var cstate = Ext.clone(self.UIState);
 	    cstate[name] = value ? value.value : null;

Modified: pve-manager/pve2/www/new/Workspace.js
===================================================================
--- pve-manager/pve2/www/new/Workspace.js	2011-04-07 06:18:50 UTC (rev 5798)
+++ pve-manager/pve2/www/new/Workspace.js	2011-04-07 10:01:23 UTC (rev 5799)
@@ -99,7 +99,8 @@
 			{
 			    pack: 'end',
 			    margins: '8 10 0 10',
-			    id: 'userinfo'
+			    id: 'userinfo',
+			    stateful: false,
 			},
 			{
 			    pack: 'end',
@@ -116,6 +117,7 @@
 		{
 		    region: 'center',
 		    id: 'content',
+		    stateful: false,
 		    margins:'0 5 0 0',
 		    items: self.defaultView
 		},

Modified: pve-manager/pve2/www/new/form/RealmComboBox.js
===================================================================
--- pve-manager/pve2/www/new/form/RealmComboBox.js	2011-04-07 06:18:50 UTC (rev 5798)
+++ pve-manager/pve2/www/new/form/RealmComboBox.js	2011-04-07 10:01:23 UTC (rev 5799)
@@ -6,6 +6,8 @@
     initComponent: function() {
 	var self = this;
 
+	var stateid = 'pveloginrealm';
+
 	var realmstore = Ext.create('Ext.data.Store', {
 	    model: 'PVERealm',
 	    autoDestory: true
@@ -18,30 +20,31 @@
 	    queryMode: 'local',
 	    allowBlank: false,
 	    forceSelection: true,
-		autoSelect: false,
-		triggerAction: 'all',
-		valueField: 'realm',
-		displayField: 'comment',
-		getState: function() {
-		    return { value: this.getValue() };
-		},
-		applyState : function(state) {
-		    if (state && state.value) {
-			this.setValue(state.value);
-		    }
-		},
+	    autoSelect: false,
+	    triggerAction: 'all',
+	    valueField: 'realm',
+	    displayField: 'comment',
+	    getState: function() {
+		return { value: this.getValue() };
+	    },
+	    applyState : function(state) {
+		if (state && state.value) {
+		    this.setValue(state.value);
+		}
+	    },
 	    stateEvents: [ 'select' ],
 	    stateful: true,
-	    stateId: 'pveloginrealm'        
+	    id: stateid, // fixme: remove (Stateful does not work without)  
+	    stateID: stateid
 	});
 
-	PVE.form.RealmComboBox.superclass.initComponent.call(self);
+        self.callParent();
 
 	realmstore.load({
 	    callback: function(r, o, success) {
 		if (success) {
 		    var def = self.getValue();
-		    if (!def) {
+		    if (!def || !realmstore.findRecord('realm', def)) {
 			if (r[0] && r[0].data)
 			    def = r[0].data.realm;
 			Ext.each(r, function(record) {

Modified: pve-manager/pve2/www/new/form/ViewSelector.js
===================================================================
--- pve-manager/pve2/www/new/form/ViewSelector.js	2011-04-07 06:18:50 UTC (rev 5798)
+++ pve-manager/pve2/www/new/form/ViewSelector.js	2011-04-07 10:01:23 UTC (rev 5799)
@@ -6,6 +6,8 @@
     initComponent: function() {
 	var self = this;
 
+	var stateid = 'view';
+
 	var default_views = {
 	    server: {
 		text: 'Server View',
@@ -72,13 +74,15 @@
 	    },
 	    stateEvents: [ 'select' ],
 	    stateful: true,
-	    stateId: 'view'        
+  	    id: stateid, // fixme: remove (Stateful does not work without)  
+	    stateID: stateid
 	});
 
-	self.callParent([]);
+	
+	self.callParent([self]);
 
 	var statechange = function(sp, key, value) {
-	    if (key === self.stateId) {
+	    if (key === stateid) {
 		self.applyState(value, true);
 	    }
 	};

Modified: pve-manager/pve2/www/new/index.pl
===================================================================
--- pve-manager/pve2/www/new/index.pl	2011-04-07 06:18:50 UTC (rev 5798)
+++ pve-manager/pve2/www/new/index.pl	2011-04-07 10:01:23 UTC (rev 5799)
@@ -85,7 +85,6 @@
     <link rel="stylesheet" type="text/css" href="/ext/ext-all-debug.css" />
     <link rel="stylesheet" type="text/css" href="/css/ext-pve.css" />
  
-    <script type="text/javascript" src="/ext/ext-core-debug.js"></script>
     <script type="text/javascript" src="/ext/ext-all-debug.js"></script>
     <script type="text/javascript" src="/ext/pvemanagerlib.js"></script>
     

Modified: pve-manager/pve2/www/new/tree/ResourceTree.js
===================================================================
--- pve-manager/pve2/www/new/tree/ResourceTree.js	2011-04-07 06:18:50 UTC (rev 5798)
+++ pve-manager/pve2/www/new/tree/ResourceTree.js	2011-04-07 10:01:23 UTC (rev 5799)
@@ -182,9 +182,11 @@
 	    }
 	});
 
+	var stateid = 'rid';
+
 	var updateTree = function() {
 
-	    var rootnode = self.store.node;
+	    var rootnode = self.store.getRootNode();
 
 	    var index = pdata.dataIndex;
 
@@ -241,6 +243,7 @@
 		console.log("ADD UID: " + item.data.id);
 
 		var info = Ext.apply({ leaf: true }, item.data);
+
 		var child = self.groupChild(rootnode, info, groups, 0);
 		if (child)
 		    index[item.data.id] = child;
@@ -249,7 +252,7 @@
 	    if (!pdata.updateCount) {
 		rootnode.collapse();
 		rootnode.expand();
-		self.applyState(sp.get(self.stateId));
+		self.applyState(sp.get(stateid));
 	    }
 
 	    pdata.updateCount++;
@@ -269,7 +272,7 @@
 	pdata.view = selview.getViewSettings();
 
 	var statechange = function(sp, key, value) {
-	    if (key === self.stateId) {
+	    if (key === stateid) {
 		self.applyState(value);
 	    }
 	};
@@ -296,7 +299,7 @@
 		pdata.view = view;
 
 		pdata.updateCount = 0;
-		var rootnode = self.store.node;
+		var rootnode = self.store.getRootNode();
 		rootnode.collapse();
 		rootnode.removeAll(true);
 		pdata.dataIndex = {};
@@ -304,7 +307,7 @@
 	    },
 	    applyState : function(state) {
 		if (state && state.value) {
-		    var rootnode = self.store.node;
+		    var rootnode = self.store.getRootNode();
 		    var node = rootnode.findChild('id', state.value, true);
 		    if (node) {
 			var sm = self.getSelectionModel();
@@ -318,16 +321,14 @@
 			}
 		    }
 		}
-	    },
-	    stateful: false, // we impl. our own state load/save
-	    stateId: 'rid'
+	    }
 	});
 
 	self.callParent();
 
 	var sm = self.getSelectionModel();
 	sm.on('select', function(sm, n) {		    
-	    sp.set(self.stateId, { value: n.data.id});
+	    sp.set(stateid, { value: n.data.id});
 	});
 
 	rstore.on("load", updateTree);




More information about the pve-devel mailing list