[pve-devel] r6048 - in pve-manager/pve2/www/new: . dc

svn-commits at proxmox.com svn-commits at proxmox.com
Mon May 30 14:58:06 CEST 2011


Author: dietmar
Date: 2011-05-30 14:58:06 +0200 (Mon, 30 May 2011)
New Revision: 6048

Added:
   pve-manager/pve2/www/new/dc/GroupView.js
   pve-manager/pve2/www/new/dc/RoleView.js
Modified:
   pve-manager/pve2/www/new/Makefile.am
   pve-manager/pve2/www/new/dc/Config.js
Log:
impl. RoleView


Modified: pve-manager/pve2/www/new/Makefile.am
===================================================================
--- pve-manager/pve2/www/new/Makefile.am	2011-05-30 11:54:59 UTC (rev 6047)
+++ pve-manager/pve2/www/new/Makefile.am	2011-05-30 12:58:06 UTC (rev 6048)
@@ -57,6 +57,8 @@
 	openvz/CreateWizard.js				\
 	storage/Browser.js				\
 	dc/UserView.js					\
+	dc/GroupView.js					\
+	dc/RoleView.js					\
 	dc/Config.js					\
 	Workspace.js
 

Modified: pve-manager/pve2/www/new/dc/Config.js
===================================================================
--- pve-manager/pve2/www/new/dc/Config.js	2011-05-30 11:54:59 UTC (rev 6047)
+++ pve-manager/pve2/www/new/dc/Config.js	2011-05-30 12:58:06 UTC (rev 6048)
@@ -25,7 +25,7 @@
 		    itemId: 'users'
 		},
 		{
-		    //xtype: 'pveGroupView',
+		    xtype: 'pveGroupView',
 		    title: 'Groups',
 		    itemId: 'groups'
 		},
@@ -35,7 +35,7 @@
 		    itemId: 'permissions'
 		},
 		{
-		    //xtype: 'pveRoleView',
+		    xtype: 'pveRoleView',
 		    title: 'Roles',
 		    itemId: 'roles'
 		},

Added: pve-manager/pve2/www/new/dc/GroupView.js
===================================================================
--- pve-manager/pve2/www/new/dc/GroupView.js	                        (rev 0)
+++ pve-manager/pve2/www/new/dc/GroupView.js	2011-05-30 12:58:06 UTC (rev 6048)
@@ -0,0 +1,58 @@
+Ext.define('PVE.dc.GroupView', {
+    extend: 'Ext.grid.GridPanel',
+
+    alias: ['widget.pveGroupView'],
+
+    initComponent : function() {
+	var me = this;
+
+	var store = new Ext.data.Store({
+	    model: Ext.define('pve-groups', {
+		extend: 'Ext.data.Model',
+		fields: [ 'groupid', 'comment' ],
+		idProperty: 'groupid'
+	    }),
+	    proxy: {
+                type: 'pve',
+		url: "/api2/json/access/groups"
+	    },
+	    sorters: { 
+		property: 'groupid', 
+		order: 'DESC' 
+	    }
+	});
+
+
+	Ext.apply(me, {
+	    store: store,
+	    stateful: false,
+
+	    viewConfig: {
+		trackOver: false
+	    },
+
+	    columns: [
+		{
+		    header: 'Group name',
+		    width: 200,
+		    sortable: true,
+		    dataIndex: 'groupid'
+		},
+		{
+		    id: 'comment',
+		    header: 'Comment',
+		    sortable: false,
+		    dataIndex: 'comment',
+		    flex: 1
+		}
+	    ],
+	    listeners: {
+		show: function() {
+		    store.load();
+		}
+	    }
+	});
+
+	me.callParent();
+    }
+});
\ No newline at end of file

Added: pve-manager/pve2/www/new/dc/RoleView.js
===================================================================
--- pve-manager/pve2/www/new/dc/RoleView.js	                        (rev 0)
+++ pve-manager/pve2/www/new/dc/RoleView.js	2011-05-30 12:58:06 UTC (rev 6048)
@@ -0,0 +1,68 @@
+Ext.define('PVE.dc.RoleView', {
+    extend: 'Ext.grid.GridPanel',
+
+    alias: ['widget.pveRoleView'],
+
+    initComponent : function() {
+	var me = this;
+
+	var store = new Ext.data.Store({
+	    model: Ext.define('pve-roles', {
+		extend: 'Ext.data.Model',
+		fields: [ 'roleid', 'privs' ],
+		idProperty: 'roleid'
+	    }),
+	    proxy: {
+                type: 'pve',
+		url: "/api2/json/access/roles"
+	    },
+	    sorters: { 
+		property: 'roleid', 
+		order: 'DESC' 
+	    }
+	});
+
+	var render_privs = function(value, metaData) {
+
+	    if (!value)
+		return '-';
+
+	    // allow word wrap
+	    metaData.style = 'white-space:normal;'
+
+	    return value.replace(/\,/g, ' ');
+	};
+
+	Ext.apply(me, {
+	    store: store,
+	    stateful: false,
+
+	    viewConfig: {
+		trackOver: false
+	    },
+	    columns: [
+		{
+		    header: 'Role name',
+		    width: 150,
+		    sortable: true,
+		    dataIndex: 'roleid'
+		},
+		{
+		    id: 'privs',
+		    header: 'Privileges',
+		    sortable: false,
+		    renderer: render_privs,
+		    dataIndex: 'privs',
+		    flex: 1
+		}
+	    ],
+	    listeners: {
+		show: function() {
+		    store.load();
+		}
+	    }
+	});
+
+	me.callParent();
+    }
+});
\ No newline at end of file




More information about the pve-devel mailing list