[pve-devel] r5955 - in pve-manager/pve2/www/new: . grid tree

svn-commits at proxmox.com svn-commits at proxmox.com
Tue May 10 10:16:19 CEST 2011


Author: dietmar
Date: 2011-05-10 10:16:18 +0200 (Tue, 10 May 2011)
New Revision: 5955

Modified:
   pve-manager/pve2/www/new/Workspace.js
   pve-manager/pve2/www/new/grid/ResourceGrid.js
   pve-manager/pve2/www/new/tree/ResourceTree.js
Log:
enable dblclick navigation


Modified: pve-manager/pve2/www/new/Workspace.js
===================================================================
--- pve-manager/pve2/www/new/Workspace.js	2011-05-10 07:31:57 UTC (rev 5954)
+++ pve-manager/pve2/www/new/Workspace.js	2011-05-10 08:16:18 UTC (rev 5955)
@@ -8,6 +8,7 @@
 	'PVE.data.ResourceStore',
 	'PVE.tree.ResourceTree'
     ],
+    alias: ['widget.pveWorkspace'],
 
     // private
     defaultContent: {
@@ -27,6 +28,12 @@
 	cont.doLayout();
     },
 
+    selectById: function(nodeid) {
+	var me = this;
+	var tree = me.down('pveResourceTree');
+	tree.selectById(nodeid);
+    },
+
     showLogin: function() {
 	var me = this;
 

Modified: pve-manager/pve2/www/new/grid/ResourceGrid.js
===================================================================
--- pve-manager/pve2/www/new/grid/ResourceGrid.js	2011-05-10 07:31:57 UTC (rev 5954)
+++ pve-manager/pve2/www/new/grid/ResourceGrid.js	2011-05-10 08:16:18 UTC (rev 5955)
@@ -163,9 +163,6 @@
 	    title: 'Search',
 	    store: store,
 	    tbar: [
-		{
-		    text: "Create VM"
-		},
 		'->', 
 		'Search:', ' ',
 		{
@@ -187,6 +184,10 @@
 		trackOver: false
             },
 	    listeners: {
+		itemdblclick: function(v, record) {
+		    var ws = me.up('pveWorkspace');
+		    ws.selectById(record.data.id);
+		},
 		destroy: function() {
 		    rstore.un("load", load_cb)
 		}

Modified: pve-manager/pve2/www/new/tree/ResourceTree.js
===================================================================
--- pve-manager/pve2/www/new/tree/ResourceTree.js	2011-05-10 07:31:57 UTC (rev 5954)
+++ pve-manager/pve2/www/new/tree/ResourceTree.js	2011-05-10 08:16:18 UTC (rev 5955)
@@ -282,27 +282,30 @@
 		pdata.dataIndex = {};
 		me.getSelectionModel().deselectAll();
 	    },
+	    selectById: function(nodeid) {
+		var rootnode = me.store.getRootNode();
+		var sm = me.getSelectionModel();
+		var node;
+		if (nodeid === 'root')
+		    node = rootnode;
+		else
+		    node = rootnode.findChild('id', nodeid, true);
+		if (node) {
+		    if (!sm.isSelected(node)) {
+			sm.select(node);
+			var cn = node;
+			while ((cn = cn.parentNode)) {
+			    if (!cn.isExpanded())
+				cn.expand();
+			}
+		    }
+		}
+	    },
 	    applyState : function(state) {
 		var sm = me.getSelectionModel();
 		if (state && state.value) {
-		    var rootnode = me.store.getRootNode();
-		    var node;
-		    if (state.value === 'root')
-			node = rootnode;
-		    else
-			node = rootnode.findChild('id', state.value, true);
-
-		    if (node) {
-			if (!sm.isSelected(node)) {
-			    sm.select(node);
-			    var cn = node;
-			    while ((cn = cn.parentNode)) {
-				if (!cn.isExpanded())
-				    cn.expand();
-			    }
-			}
-		    }
-		} else {
+		    me.selectById(state.value);
+ 		} else {
 		    sm.deselectAll();
 		}
 	    }




More information about the pve-devel mailing list