Updated Branches: refs/heads/master 8692f6860 -> 703c5b44f
cloudstack UI - user page - update user, change password, generate key, disable user, enable user, delete user - encode data passed to API call. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/703c5b44 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/703c5b44 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/703c5b44 Branch: refs/heads/master Commit: 703c5b44f21128df4b3990c9fdfa2e9bb0d06f93 Parents: 8692f68 Author: Jessica Wang <[email protected]> Authored: Tue Oct 30 15:45:59 2012 -0700 Committer: Jessica Wang <[email protected]> Committed: Wed Oct 31 15:25:32 2012 -0700 ---------------------------------------------------------------------- ui/scripts/accounts.js | 62 ++++++++++++++++++++++++++---------------- 1 files changed, 38 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/703c5b44/ui/scripts/accounts.js ---------------------------------------------------------------------- diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index 9075462..324c5f5 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -947,15 +947,17 @@ edit: { label: 'label.edit', action: function(args) { - var array1 = []; - array1.push("&username=" + todb(args.data.username)); - array1.push("&email=" + todb(args.data.email)); - array1.push("&firstname=" + todb(args.data.firstname)); - array1.push("&lastname=" + todb(args.data.lastname)); - array1.push("&timezone=" + todb(args.data.timezone)); + var data = { + id: args.context.users[0].id, + username: args.data.username, + email: args.data.email, + firstname: args.data.firstname, + lastname: args.data.lastname, + timezone: args.data.timezone + }; $.ajax({ - url: createURL("updateUser&id=" + args.context.users[0].id + array1.join("")), - dataType: "json", + url: createURL('updateUser'), + data: data, success: function(json) { var item = json.updateuserresponse.user; args.response.success({data:item}); @@ -998,11 +1000,15 @@ var password = args.data.newPassword; if (md5Hashed) password = $.md5(password); - else - password = todb(password); + + var data = { + id: args.context.users[0].id, + password: password + }; + $.ajax({ - url: createURL("updateUser&id=" + args.context.users[0].id + "&password=" + password), - dataType: "json", + url: createURL('updateUser'), + data: data, async: true, success: function(json) { args.response.success({data: json.updateuserresponse.user}); @@ -1027,10 +1033,12 @@ } }, action: function(args) { + var data = { + id: args.context.users[0].id + }; $.ajax({ - url: createURL("registerUserKeys&id=" + args.context.users[0].id), - dataType: "json", - async: true, + url: createURL('registerUserKeys'), + data: data, success: function(json) { args.response.success({data: json.registeruserkeysresponse.userkeys}); } @@ -1054,10 +1062,12 @@ } }, action: function(args) { + var data = { + id: args.context.users[0].id + }; $.ajax({ - url: createURL("disableUser&id=" + args.context.users[0].id), - dataType: "json", - async: true, + url: createURL('disableUser'), + data: data, success: function(json) { var jid = json.disableuserresponse.jobid; args.response.success( @@ -1091,10 +1101,12 @@ } }, action: function(args) { + var data = { + id: args.context.users[0].id + }; $.ajax({ - url: createURL("enableUser&id=" + args.context.users[0].id), - dataType: "json", - async: true, + url: createURL('enableUser'), + data: data, success: function(json) { args.response.success({data: json.enableuserresponse.user}); }, @@ -1121,10 +1133,12 @@ } }, action: function(args) { + var data = { + id: args.context.users[0].id + }; $.ajax({ - url: createURL("deleteUser&id=" + args.context.users[0].id), - dataType: "json", - async: true, + url: createURL('deleteUser'), + data: data, success: function(json) { args.response.success(); }
