From 5d55037310daf958ae476d21d19aa0396446273a Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 7 Nov 2011 16:01:46 -0800 Subject: [PATCH 1/3] cloudStack 3.0 new UI - user page - implement Change Password action. --- ui/scripts/accounts.js | 55 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index 3933bbdd97f..54eee06041f 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -604,7 +604,10 @@ url: createURL("listUsers&domainid=" + fromdb(accountObj.domainid) + "&account=" + todb(fromdb(accountObj.name))), dataType: "json", success: function(json) { - args.response.success({data: json.listusersresponse.user}); + args.response.success({ + actionFilter: userActionfilter, + data: json.listusersresponse.user + }); } }) }, @@ -729,7 +732,51 @@ }); } - } + }, + + //??? + changePassword: { + label: 'Change password', + messages: { + confirm: function(args) { + return 'Are you sure you want to change password?'; + }, + success: function(args) { + return 'Password is being changed.'; + }, + notification: function(args) { + return 'Changing password'; + }, + complete: function(args) { + return 'Password has been changed.'; + } + }, + createForm: { + label: 'Change password', + fields: { + newPassword: { label: 'New password' } + } + }, + action: function(args) { + var password = args.data.newPassword; + if (md5Hashed) + password = $.md5(password); + $.ajax({ + url: createURL("updateUser&id=" + args.context.users[0].id + "&password=" + password), + dataType: "json", + async: true, + success: function(json) { + args.response.success({data: json.updateuserresponse.user}); + } + }); + }, + notification: { + poll: function(args) { + args.complete(); + } + } + } + }, tabs: { details: { @@ -790,7 +837,7 @@ dataProvider: function(args) { args.response.success( { - actionFilter: accountActionfilter, + actionFilter: userActionfilter, data:args.context.users[0] } ); @@ -830,7 +877,7 @@ var userActionfilter = function(args) { var jsonObj = args.context.item; - var allowedActions = []; + var allowedActions = []; if(isAdmin()) { allowedActions.push("edit"); allowedActions.push("changePassword"); From 751685541c3a067eb7784c2ae2b1866c534a703a Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 7 Nov 2011 16:10:30 -0800 Subject: [PATCH 2/3] cloudStack 3.0 new UI - user page - implement Generate Keys action. --- ui/scripts/accounts.js | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index 54eee06041f..f60b3d9ce86 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -733,8 +733,7 @@ } }, - - //??? + changePassword: { label: 'Change password', messages: { @@ -775,8 +774,41 @@ args.complete(); } } + }, + + generateKeys: { + label: 'Generate keys', + messages: { + confirm: function(args) { + return 'Are you sure you want to generate keys?'; + }, + success: function(args) { + return 'Keys are being generated.'; + }, + notification: function(args) { + return 'Generating keys'; + }, + complete: function(args) { + return 'Keys have been generated.'; + } + }, + action: function(args) { + $.ajax({ + url: createURL("registerUserKeys&id=" + args.context.users[0].id), + dataType: "json", + async: true, + success: function(json) { + args.response.success({data: json.registeruserkeysresponse.userkeys}); + } + }); + }, + notification: { + poll: function(args) { + args.complete(); + } + } } - + }, tabs: { details: { From 650acd68450f59eb2f3823c45f5dca520f289ab0 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 7 Nov 2011 16:54:05 -0800 Subject: [PATCH 3/3] cloudStack 3.0 new UI - user page - implement Disable User action. --- ui/scripts/accounts.js | 45 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index f60b3d9ce86..c4642775492 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -807,7 +807,50 @@ args.complete(); } } - } + }, + + disable: { + label: 'Disable user', + messages: { + confirm: function(args) { + return 'Are you sure you want to disable this user?'; + }, + success: function(args) { + return 'User is being disabled.'; + }, + notification: function(args) { + return 'Disabling user'; + }, + complete: function(args) { + return 'User has been disabled.'; + } + }, + action: function(args) { + $.ajax({ + url: createURL("disableUser&id=" + args.context.users[0].id), + dataType: "json", + async: true, + success: function(json) { + var jid = json.disableuserresponse.jobid; + args.response.success( + {_custom: + {jobId: jid, + getUpdatedItem: function(json) { + return json.queryasyncjobresultresponse.jobresult.user; + }, + getActionFilter: function() { + return userActionfilter; + } + } + } + ); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + } }, tabs: {