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

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Feb 21 08:05:54 CET 2011


Author: dietmar
Date: 2011-02-21 08:05:54 +0100 (Mon, 21 Feb 2011)
New Revision: 5571

Modified:
   pve-manager/pve2/www/manager/ClusterConfig.js
Log:
add Role and Auth view


Modified: pve-manager/pve2/www/manager/ClusterConfig.js
===================================================================
--- pve-manager/pve2/www/manager/ClusterConfig.js	2011-02-21 06:53:10 UTC (rev 5570)
+++ pve-manager/pve2/www/manager/ClusterConfig.js	2011-02-21 07:05:54 UTC (rev 5571)
@@ -1,5 +1,113 @@
 Ext.ns("PVE");
 
+PVE.ClusterRoleView = 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',
+	    restful: true, // use GET, not POST
+	    fields: [ 'id', 'privs' ],
+	    idProperty: 'id',
+	    sortInfo: { field: 'id', order: 'DESC' }
+	});
+
+	var render_privs = function(value) {
+
+	    if (!value)
+		return '-';
+
+	    // allow word wrap
+	    return '<div style="white-space:normal !important;">' 
+		+ value.replace(/\,/g, ' ') + "</div>";
+
+	};
+
+	Ext.apply(self, {
+	    store: store,
+	    autoExpandColumn: 'privs',
+	    stateful: false,
+	    columns: [
+		{
+		    header: 'ID',
+		    width: 150,
+		    sortable: true,
+		    dataIndex: 'id'
+		},
+		{
+		    id: 'privs',
+		    header: 'Privileges',
+		    sortable: false,
+		    renderer: render_privs,
+		    dataIndex: 'privs'
+		}
+	    ],
+	    listeners: {
+		show: function() {
+		    store.load();
+		}
+	    }
+	});
+
+	PVE.ClusterRoleView.superclass.initComponent.call(self);
+    }
+});
+Ext.reg('pveClusterRoleView', PVE.ClusterRoleView);
+
+PVE.ClusterAuthView = Ext.extend(PVE.grid.StdGrid, {
+
+    initComponent : function() {
+	var self = this;
+
+	var store = new Ext.data.JsonStore({
+	    url: "/api2/json/access/domains",
+	    autoDestory: true,
+	    root: 'data',
+	    restful: true, // use GET, not POST
+	    fields: [ 'id', 'type', 'comment' ],
+	    idProperty: 'id',
+	    sortInfo: { field: 'id', order: 'DESC' }
+	});
+
+	Ext.apply(self, {
+	    store: store,
+	    autoExpandColumn: 'comment',
+	    stateful: false,
+	    columns: [
+		{
+		    header: 'ID',
+		    width: 100,
+		    sortable: true,
+		    dataIndex: 'id'
+		},
+		{
+		    header: 'Type',
+		    width: 100,
+		    sortable: true,
+		    dataIndex: 'type'
+		},
+		{
+		    id: 'comment',
+		    header: 'Comment',
+		    sortable: false,
+		    dataIndex: 'comment'
+		}
+	    ],
+	    listeners: {
+		show: function() {
+		    store.load();
+		}
+	    }
+	});
+
+	PVE.ClusterAuthView.superclass.initComponent.call(self);
+    }
+});
+Ext.reg('pveClusterAuthView', PVE.ClusterAuthView);
+
 PVE.ClusterConfig = Ext.extend(PVE.ConfigPanel, {
 
     initComponent : function() {
@@ -42,14 +150,14 @@
 		    html: 'permissions ' + clusterid
 		},
 		{
+		    xtype: 'pveClusterRoleView',
 		    title: 'Roles',
-		    id: 'roles',
-		    html: 'roles ' + clusterid
+		    id: 'roles'
 		},
 		{
+		    xtype: 'pveClusterAuthView',
 		    title: 'Authentication',
-		    id: 'domains',
-		    html: 'domains ' + clusterid
+		    id: 'domains'
 		},
 	    ]
 	});



More information about the pve-devel mailing list