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

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Feb 21 08:59:03 CET 2011


Author: dietmar
Date: 2011-02-21 08:59:03 +0100 (Mon, 21 Feb 2011)
New Revision: 5573

Modified:
   pve-manager/pve2/www/manager/ClusterConfig.js
Log:
implement user view


Modified: pve-manager/pve2/www/manager/ClusterConfig.js
===================================================================
--- pve-manager/pve2/www/manager/ClusterConfig.js	2011-02-21 07:06:41 UTC (rev 5572)
+++ pve-manager/pve2/www/manager/ClusterConfig.js	2011-02-21 07:59:03 UTC (rev 5573)
@@ -1,11 +1,104 @@
 Ext.ns("PVE");
 
-PVE.ClusterRoleView = Ext.extend(PVE.grid.StdGrid, {
+PVE.UserView = Ext.extend(PVE.grid.StdGrid, {
 
     initComponent : function() {
 	var self = this;
 
 	var store = new Ext.data.JsonStore({
+	    url: "/api2/json/access/users",
+	    autoDestory: true,
+	    root: 'data',
+	    restful: true, // use GET, not POST
+	    fields: [ 
+		'id', 'domid', 'groups', 'name', 'comment',
+		{ type: 'boolean', name: 'enabled' }, 
+		{ type: 'date', dateFormat: 'timestamp', name: 'expire' },
+	    ],
+	    idProperty: 'id',
+	    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';
+
+	    return date.format("Y-m-d");
+	};
+
+	Ext.apply(self, {
+	    store: store,
+	    autoExpandColumn: 'comment',
+	    stateful: false,
+	    columns: [
+		{
+		    header: 'ID',
+		    width: 200,
+		    sortable: true,
+		    dataIndex: 'id'
+		},
+		{
+		    header: 'Auth',
+		    width: 100,
+		    sortable: true,
+		    dataIndex: 'domid'
+		},
+		{
+		    header: 'Enabled',
+		    width: 50,
+		    sortable: true,
+		    dataIndex: 'enabled'
+		},
+		{
+		    header: 'Expire',
+		    width: 80,
+		    sortable: true,
+		    renderer: render_expire, 
+		    dataIndex: 'expire'
+		},
+		{
+		    header: 'Name',
+		    width: 150,
+		    sortable: true,
+		    dataIndex: 'name'
+		},
+		{
+		    id: 'comment',
+		    header: 'Comment',
+		    sortable: false,
+		    dataIndex: 'comment'
+		}
+	    ],
+	    listeners: {
+		show: function() {
+		    store.load();
+		}
+	    }
+	});
+
+	PVE.UserView.superclass.initComponent.call(self);
+    }
+});
+Ext.reg('pveUserView', PVE.UserView);
+
+
+PVE.RoleView = Ext.extend(PVE.grid.StdGrid, {
+
+    initComponent : function() {
+	var self = this;
+
+	var store = new Ext.data.JsonStore({
 	    url: "/api2/json/access/roles",
 	    autoDestory: true,
 	    root: 'data',
@@ -21,7 +114,7 @@
 		return '-';
 
 	    // allow word wrap
-	    return '<div style="white-space:normal !important;">' 
+	    return '<div style="white-space:normal;">' 
 		+ value.replace(/\,/g, ' ') + "</div>";
 
 	};
@@ -52,12 +145,12 @@
 	    }
 	});
 
-	PVE.ClusterRoleView.superclass.initComponent.call(self);
+	PVE.RoleView.superclass.initComponent.call(self);
     }
 });
-Ext.reg('pveClusterRoleView', PVE.ClusterRoleView);
+Ext.reg('pveRoleView', PVE.RoleView);
 
-PVE.ClusterAuthView = Ext.extend(PVE.grid.StdGrid, {
+PVE.AuthView = Ext.extend(PVE.grid.StdGrid, {
 
     initComponent : function() {
 	var self = this;
@@ -103,10 +196,10 @@
 	    }
 	});
 
-	PVE.ClusterAuthView.superclass.initComponent.call(self);
+	PVE.AuthView.superclass.initComponent.call(self);
     }
 });
-Ext.reg('pveClusterAuthView', PVE.ClusterAuthView);
+Ext.reg('pveAuthView', PVE.AuthView);
 
 PVE.ClusterConfig = Ext.extend(PVE.ConfigPanel, {
 
@@ -135,9 +228,9 @@
 		    html: 'storage ' + clusterid
 		},
 		{
+		    xtype: 'pveUserView',
 		    title: 'Users',
-		    id: 'users',
-		    html: 'users ' + clusterid
+		    id: 'users'
 		},
 		{
 		    title: 'Groups',
@@ -150,12 +243,12 @@
 		    html: 'permissions ' + clusterid
 		},
 		{
-		    xtype: 'pveClusterRoleView',
+		    xtype: 'pveRoleView',
 		    title: 'Roles',
 		    id: 'roles'
 		},
 		{
-		    xtype: 'pveClusterAuthView',
+		    xtype: 'pveAuthView',
 		    title: 'Authentication',
 		    id: 'domains'
 		},




More information about the pve-devel mailing list