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

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Apr 5 13:28:39 CEST 2011


Author: dietmar
Date: 2011-04-05 13:28:39 +0200 (Tue, 05 Apr 2011)
New Revision: 5788

Modified:
   pve-manager/pve2/www/new/form/ViewSelector.js
   pve-manager/pve2/www/new/tree/ResourceTree.js
Log:
implement filter


Modified: pve-manager/pve2/www/new/form/ViewSelector.js
===================================================================
--- pve-manager/pve2/www/new/form/ViewSelector.js	2011-04-05 11:19:58 UTC (rev 5787)
+++ pve-manager/pve2/www/new/form/ViewSelector.js	2011-04-05 11:28:39 UTC (rev 5788)
@@ -18,8 +18,8 @@
 	    storage: {
 		text: 'Storage View',
 		groups: ['node'],
-		filterfn: function(n, type) {
-		    return type === 'storage';
+		filterfn: function(node) {
+		    return node.data.type === 'storage';
 		}
 	    }
 	};

Modified: pve-manager/pve2/www/new/tree/ResourceTree.js
===================================================================
--- pve-manager/pve2/www/new/tree/ResourceTree.js	2011-04-05 11:19:58 UTC (rev 5787)
+++ pve-manager/pve2/www/new/tree/ResourceTree.js	2011-04-05 11:28:39 UTC (rev 5788)
@@ -185,7 +185,8 @@
 
 	    var index = pdata.dataIndex;
 
-	    var groups = [].concat(pdata.view.groups);
+	    var groups = pdata.view.groups;
+	    var filterfn = pdata.view.filterfn;
 
 	    // remove vanished or changed items
 	    for (var key in index) {
@@ -231,6 +232,9 @@
 		if (olditem)
 		    return;
 
+		if (filterfn && !filterfn(item))
+		    return;
+
 		console.log("ADD UID: " + item.data.id);
 
 		var info = Ext.apply({ leaf: true }, item.data);




More information about the pve-devel mailing list