[pve-devel] r6216 - in pve-manager/pve2: . www/manager www/manager/dc
svn-commits at proxmox.com
svn-commits at proxmox.com
Fri Jul 1 08:40:41 CEST 2011
Author: dietmar
Date: 2011-07-01 08:40:41 +0200 (Fri, 01 Jul 2011)
New Revision: 6216
Added:
pve-manager/pve2/www/manager/dc/UserEdit.js
Modified:
pve-manager/pve2/ChangeLog
pve-manager/pve2/www/manager/Makefile.am
pve-manager/pve2/www/manager/dc/UserView.js
Log:
add file from Seth Lauzon
Modified: pve-manager/pve2/ChangeLog
===================================================================
--- pve-manager/pve2/ChangeLog 2011-07-01 05:47:11 UTC (rev 6215)
+++ pve-manager/pve2/ChangeLog 2011-07-01 06:40:41 UTC (rev 6216)
@@ -1,3 +1,7 @@
+2011-07-01 Proxmox Support Team <support at proxmox.com>
+
+ * www/manager/dc/UserEdit.js: add file from Seth Lauzon, fixed urls
+
2011-06-30 Proxmox Support Team <support at proxmox.com>
* www/manager/form/KVComboBox.js: split out common code
Modified: pve-manager/pve2/www/manager/Makefile.am
===================================================================
--- pve-manager/pve2/www/manager/Makefile.am 2011-07-01 05:47:11 UTC (rev 6215)
+++ pve-manager/pve2/www/manager/Makefile.am 2011-07-01 06:40:41 UTC (rev 6216)
@@ -66,6 +66,7 @@
storage/Summary.js \
storage/Browser.js \
dc/StorageView.js \
+ dc/UserEdit.js \
dc/UserView.js \
dc/GroupView.js \
dc/RoleView.js \
Added: pve-manager/pve2/www/manager/dc/UserEdit.js
===================================================================
--- pve-manager/pve2/www/manager/dc/UserEdit.js (rev 0)
+++ pve-manager/pve2/www/manager/dc/UserEdit.js 2011-07-01 06:40:41 UTC (rev 6216)
@@ -0,0 +1,67 @@
+Ext.define('PVE.dc.UserEdit', {
+ extend: 'PVE.window.Edit',
+ alias: ['widget.pveDcUserEdit'],
+
+ initComponent : function() {
+ var me = this;
+ var create = !me.userid;
+ if (create) {
+ title = "Create User";
+ } else {
+ title = "Edit User'" + userid + "'";
+ }
+
+ var url;
+ var method;
+ var userid;
+
+ if (create) {
+ url = '/api2/extjs/access/users';
+ method = 'POST';
+ } else {
+ url = '/api2/extjs/access/users/' + userid;
+ method = 'PUT';
+ }
+
+ me.column1 = [
+ {
+ xtype: 'pvetextfield',
+ name: 'userid',
+ fieldLabel: 'Userid',
+ },
+ {
+ xtype: 'pvetextfield',
+ name: 'firstname',
+ fieldLabel: 'First Name',
+ },
+ {
+ xtype: 'pvetextfield',
+ name: 'email',
+ fieldLabel: 'Email',
+ }
+ ];
+
+ me.column2 = [
+ {
+ xtype: 'pvetextfield',
+ name: 'domain',
+ fieldLabel: 'Domain',
+ },
+ {
+ xtype: 'pvetextfield',
+ name: 'lastname',
+ fieldLabel: 'Last Name',
+ }
+ ];
+
+ Ext.applyIf(me, {
+ title: title,
+ url: url,
+ method: method,
+ });
+
+ me.callParent();
+
+ }
+});
+
Modified: pve-manager/pve2/www/manager/dc/UserView.js
===================================================================
--- pve-manager/pve2/www/manager/dc/UserView.js 2011-07-01 05:47:11 UTC (rev 6215)
+++ pve-manager/pve2/www/manager/dc/UserView.js 2011-07-01 06:40:41 UTC (rev 6216)
@@ -6,12 +6,31 @@
initComponent : function() {
var me = this;
+ var store = new Ext.data.Store({
+ id: "users",
+ model: 'pve-users',
+ proxy: {
+ type: 'pve',
+ url: "/api2/json/access/users"
+ },
+ sorters: {
+ property: 'userid',
+ order: 'DESC'
+ }
+ });
+
+ var reload = function() {
+ store.load();
+ };
+
var tbar = [
{
- text: 'Add',
+ text: 'Create',
handler: function() {
- var msg = 'This feature is not implemented yet!';
- Ext.Msg.alert('Not Implemented', msg);
+ var win = Ext.create('PVE.dc.UserEdit',{
+ });
+ win.on('destroy', reload);
+ win.show();
}
},
{
@@ -35,24 +54,24 @@
Ext.Msg.confirm('Deletion Confirmation', msg, function(btn) {
if (btn !== 'yes')
return;
- Ext.Msg.alert('Not Implemented', 'This feature is not implemented yet!');
+
+ me.setLoading(true, true);
+ PVE.Utils.API2Request({
+ url: '/access/users/' + userid,
+ method: 'DELETE',
+ callback: function() {
+ me.setLoading(false);
+ reload();
+ },
+ failure: function (response, opts) {
+ Ext.Msg.alert('Error',response.htmlStatus);
+ },
+ });
});
}
}
];
- var store = new Ext.data.Store({
- model: 'pve-users',
- proxy: {
- type: 'pve',
- url: "/api2/json/access/users"
- },
- sorters: {
- property: 'userid',
- order: 'DESC'
- }
- });
-
var render_expire = function(date) {
if (!date)
return 'never';
@@ -128,9 +147,7 @@
}
],
listeners: {
- show: function() {
- store.load();
- }
+ show: reload
}
});
@@ -148,4 +165,4 @@
idProperty: 'userid'
});
-});
\ No newline at end of file
+});
More information about the pve-devel
mailing list