cloudstack UI - user page - update user, change password, generate key, disable user, enable user, delete user - encode data passed to API call.

This commit is contained in:
Jessica Wang 2012-10-30 15:45:59 -07:00
parent 8692f68603
commit 703c5b44f2

View File

@ -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();
}