[pve-devel] r5575 - pve-manager/pve2/www/manager

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Feb 22 06:05:38 CET 2011


Author: dietmar
Date: 2011-02-22 06:05:36 +0100 (Tue, 22 Feb 2011)
New Revision: 5575

Modified:
   pve-manager/pve2/www/manager/ClusterConfig.js
Log:
mplement group view


Modified: pve-manager/pve2/www/manager/ClusterConfig.js
===================================================================
--- pve-manager/pve2/www/manager/ClusterConfig.js	2011-02-21 13:01:35 UTC (rev 5574)
+++ pve-manager/pve2/www/manager/ClusterConfig.js	2011-02-22 05:05:36 UTC (rev 5575)
@@ -11,7 +11,7 @@
 	    root: 'data',
 	    restful: true, // use GET, not POST
 	    fields: [ 
-		'id', 'domid', 'groups', 'name', 'comment',
+		'id', 'domid', 'name', 'comment',
 		{ type: 'boolean', name: 'enabled' }, 
 		{ type: 'date', dateFormat: 'timestamp', name: 'expire' },
 	    ],
@@ -19,17 +19,6 @@
 	    sortInfo: { field: 'id', order: 'DESC' }
 	});
 
-	var render_groups = function(value) {
-
-	    if (!value)
-		return '-';
-
-	    // allow word wrap
-	    return '<div style="white-space:normal;">' 
-		+ value.replace(/\,/g, ' ') + "</div>";
-
-	};
-
 	var render_expire = function(date) {
 	    if (!date)
 		return 'never';
@@ -92,7 +81,63 @@
 });
 Ext.reg('pveUserView', PVE.UserView);
 
+PVE.GroupView = Ext.extend(PVE.grid.StdGrid, {
 
+    initComponent : function() {
+	var self = this;
+
+	var store = new Ext.data.JsonStore({
+	    url: "/api2/json/access/groups",
+	    autoDestory: true,
+	    root: 'data',
+	    restful: true, // use GET, not POST
+	    fields: [ 'id', 'users' ],
+	    idProperty: 'id',
+	    sortInfo: { field: 'id', order: 'DESC' }
+	});
+
+	var render_users = function(value) {
+
+	    if (!value)
+		return '-';
+
+	    // allow word wrap
+	    return '<div style="white-space:normal;">' + 
+		value.join(' ') + "</div>";
+	};
+
+	Ext.apply(self, {
+	    store: store,
+	    autoExpandColumn: 'users',
+	    stateful: false,
+	    columns: [
+		{
+		    header: 'ID',
+		    width: 200,
+		    sortable: true,
+		    dataIndex: 'id'
+		},
+		{
+		    id: 'users',
+		    header: 'Users',
+		    sortable: true,
+		    renderer: render_users, 
+		    dataIndex: 'users'
+		}
+	    ],
+	    listeners: {
+		show: function() {
+		    store.load();
+		}
+	    }
+	});
+
+	PVE.GroupView.superclass.initComponent.call(self);
+    }
+});
+Ext.reg('pveGroupView', PVE.GroupView);
+
+
 PVE.RoleView = Ext.extend(PVE.grid.StdGrid, {
 
     initComponent : function() {
@@ -233,9 +278,9 @@
 		    id: 'users'
 		},
 		{
+		    xtype: 'pveGroupView',
 		    title: 'Groups',
-		    id: 'groups',
-		    html: 'groups ' + clusterid
+		    id: 'groups'
 		},
 		{
 		    title: 'Permissions',



More information about the pve-devel mailing list