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

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Jul 7 06:36:04 CEST 2011


Author: dietmar
Date: 2011-07-07 06:36:04 +0200 (Thu, 07 Jul 2011)
New Revision: 6250

Added:
   pve-manager/pve2/www/manager/dc/GroupEdit.js
Modified:
   pve-manager/pve2/ChangeLog
   pve-manager/pve2/www/manager/Makefile.am
   pve-manager/pve2/www/manager/dc/GroupView.js
   pve-manager/pve2/www/manager/dc/UserEdit.js
Log:
2011-07-06  Seth Lauzon  <seth.lauzon at gmail.com>

	* www/manager/Makefile.am: add GroupEdit.js

	* www/manager/dc/GroupEdit.js: create and delete group functionality

	* www/manager/dc/GroupView.js: add create and delete group



Modified: pve-manager/pve2/ChangeLog
===================================================================
--- pve-manager/pve2/ChangeLog	2011-07-07 04:33:09 UTC (rev 6249)
+++ pve-manager/pve2/ChangeLog	2011-07-07 04:36:04 UTC (rev 6250)
@@ -1,3 +1,11 @@
+2011-07-06  Seth Lauzon  <seth.lauzon at gmail.com>
+
+	* www/manager/Makefile.am: add GroupEdit.js
+
+	* www/manager/dc/GroupEdit.js: create and delete group functionality
+
+	* www/manager/dc/GroupView.js: add create and delete group
+
 2011-07-06  Proxmox Support Team  <support at proxmox.com>
 
 	* www/manager/qemu/HardwareView.js: impl. PVE.qemu.NetworkEdit

Modified: pve-manager/pve2/www/manager/Makefile.am
===================================================================
--- pve-manager/pve2/www/manager/Makefile.am	2011-07-07 04:33:09 UTC (rev 6249)
+++ pve-manager/pve2/www/manager/Makefile.am	2011-07-07 04:36:04 UTC (rev 6250)
@@ -71,6 +71,7 @@
 	dc/UserEdit.js					\
 	dc/UserView.js					\
 	dc/GroupView.js					\
+	dc/GroupEdit.js					\
 	dc/RoleView.js					\
 	dc/ACLView.js					\
 	dc/AuthView.js					\

Added: pve-manager/pve2/www/manager/dc/GroupEdit.js
===================================================================
--- pve-manager/pve2/www/manager/dc/GroupEdit.js	                        (rev 0)
+++ pve-manager/pve2/www/manager/dc/GroupEdit.js	2011-07-07 04:36:04 UTC (rev 6250)
@@ -0,0 +1,66 @@
+Ext.define('PVE.dc.GroupEdit', {
+    extend: 'PVE.window.Edit',
+    alias: ['widget.pveDcGroupEdit'],
+
+    initComponent : function() {
+        var me = this;
+
+        var create = !me.groupid;
+
+        if (create) {
+            title = "Create Group";
+        } else {
+            title = "Edit Group '" + me.groupid + "'";
+        }
+
+        var url;
+        var method;
+
+        if (create) {
+            url = '/api2/extjs/access/groups';
+            method = 'POST';
+        } else {
+            url = '/api2/extjs/access/groups/' + me.groupid;
+            method = 'PUT';
+        }
+
+        Ext.applyIf(me, {
+            title: title,
+            url: url,
+            method: method,
+            items: [
+                {
+		    xtype: 'pvetextfield',
+		    fieldLabel: 'GroupID',
+		    name: 'groupid',
+		    value: me.groupid,
+		    allowBlank: false
+		},
+                {
+		    xtype: 'pvetextfield',
+		    fieldLabel: 'Comment',
+		    name: 'comment',
+		    value: me.groupid,
+		    allowBlank: false
+		}
+            ]
+        });
+
+        me.callParent();
+
+        if (!create) {
+            me.load({
+                success: function(form, action) {
+//                    if (action.result.data.type !== me.groupid) {
+//                        var msg = "Got unexpected groupid";
+//                        Ext.Msg.alert("Load failed", msg, function() {
+//                            me.close();
+//                        });
+//                        return;
+//                    }
+                }
+            });
+        }
+    }
+});
+

Modified: pve-manager/pve2/www/manager/dc/GroupView.js
===================================================================
--- pve-manager/pve2/www/manager/dc/GroupView.js	2011-07-07 04:33:09 UTC (rev 6249)
+++ pve-manager/pve2/www/manager/dc/GroupView.js	2011-07-07 04:36:04 UTC (rev 6250)
@@ -18,10 +18,57 @@
 	    }
 	});
 
+        var reload = function() {
+            store.load();
+        };
 
+        var tbar = [
+            {
+		text: 'Create',
+		handler: function() {
+		    var win = Ext.create('PVE.dc.GroupEdit', {
+		    });
+		    win.on('destroy', reload);
+		    win.show();
+		}
+            },
+            {
+		text: 'Delete',
+		handler: function() {
+		    var sm = me.getSelectionModel();
+		    var rec = sm.getSelection()[0];
+		    if (!rec)
+			return;
+
+		    var groupid = rec.data.groupid;
+
+		    var msg = 'Are you sure you want to permanently delete the group: ' + groupid;
+		    Ext.Msg.confirm('Deletion Confirmation', msg, function(btn) {
+			if (btn !== 'yes')
+			    return;
+
+			me.setLoading(true, true);
+			PVE.Utils.API2Request({
+			    url: '/access/groups/' + groupid,
+			    method: 'DELETE',
+			    callback: function() {
+				me.setLoading(false);
+				reload();
+			    },
+			    failure: function (response, opts) {
+				Ext.Msg.alert('Error',response.htmlStatus);
+			    }
+			});
+		    });
+		}
+            }
+        ];
+
+
 	Ext.apply(me, {
 	    store: store,
 	    stateful: false,
+	    tbar: tbar,
 
 	    viewConfig: {
 		trackOver: false
@@ -57,4 +104,4 @@
 	idProperty: 'groupid'
     });
 
-});
\ No newline at end of file
+});

Modified: pve-manager/pve2/www/manager/dc/UserEdit.js
===================================================================
--- pve-manager/pve2/www/manager/dc/UserEdit.js	2011-07-07 04:33:09 UTC (rev 6249)
+++ pve-manager/pve2/www/manager/dc/UserEdit.js	2011-07-07 04:36:04 UTC (rev 6250)
@@ -60,8 +60,8 @@
         if (!create) {
             me.column1.push({
                 xtype: 'pvecheckbox',
-                fieldLabel: 'Locked',
-                name: 'lock',
+                fieldLabel: 'Enable',
+                name: 'enable',
                 uncheckedValue: 0
             });
         }




More information about the pve-devel mailing list