From 232860c562533e3aa156989fbb623bb2683d0d9a Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 6 Dec 2010 14:21:04 -0800 Subject: [PATCH] account page - user tab - implement "Register Keys" action. --- ui/jsp/account.jsp | 20 ++++++++++++++++++ ui/scripts/cloud.core.account.js | 35 ++++++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/ui/jsp/account.jsp b/ui/jsp/account.jsp index 4ad4311ee0c..422bbc67c32 100644 --- a/ui/jsp/account.jsp +++ b/ui/jsp/account.jsp @@ -207,6 +207,26 @@
+ +
+
+
+ API Key:
+
+
+
+
+
+
+
+
+
+ Secret Key:
+
+
+
+
+
diff --git a/ui/scripts/cloud.core.account.js b/ui/scripts/cloud.core.account.js index 2c5b7c995f4..365bddc3271 100644 --- a/ui/scripts/cloud.core.account.js +++ b/ui/scripts/cloud.core.account.js @@ -451,10 +451,11 @@ function accountUserJSONToTemplate(jsonObj, $template) { $template.attr("id", "account_user_"+fromdb(jsonObj.id)).data("accountUserId", fromdb(jsonObj.id)); $template.find("#grid_header_title").text(fromdb(jsonObj.username)); $template.find("#id").text(fromdb(jsonObj.id)); - $template.find("#username").text(fromdb(jsonObj.username)); + $template.find("#username").text(fromdb(jsonObj.username)); + $template.find("#apikey").text(fromdb(jsonObj.apikey)); + $template.find("#secretkey").text(fromdb(jsonObj.secretkey)); $template.find("#account").text(fromdb(jsonObj.account)); - $template.find("#role").text(toRole(fromdb(jsonObj.accounttype))); - + $template.find("#role").text(toRole(fromdb(jsonObj.accounttype))); $template.find("#domain").text(fromdb(jsonObj.domain)); $template.find("#email").text(fromdb(jsonObj.email)); $template.find("#firstname").text(fromdb(jsonObj.firstname)); @@ -471,15 +472,18 @@ function accountUserJSONToTemplate(jsonObj, $template) { $(this).find("#user_action_menu").hide(); return false; }); - - /* + var $actionMenu = $actionLink.find("#user_action_menu"); $actionMenu.find("#action_list").empty(); - buildActionLinkForSubgridItem("xxxxxxx", accountUserActionMap, $actionMenu, $template); - if(jsonObj.id==systemUserId || jsonObj.id==adminUserId) - template.find("#delete_link").hide(); - */ + if(isAdmin()) { + buildActionLinkForSubgridItem("Generate Keys", accountUserActionMap, $actionMenu, $template); + + /* + if(jsonObj.id==systemUserId || jsonObj.id==adminUserId) + buildActionLinkForSubgridItem("Delete User", accountUserActionMap, $actionMenu, $template); + */ + } } var accountActionMap = { @@ -522,6 +526,19 @@ var accountActionMap = { } }; +var accountUserActionMap = { + "Generate Keys": { + api: "registerUserKeys", + isAsyncJob: false, + inProcessText: "Generate Keys....", + afterActionSeccessFn: function(json, id, $subgridItem) { + var jsonObj = json.registeruserkeysresponse.userkeys; + $subgridItem.find("#apikey").text(fromdb(jsonObj.apikey)); + $subgridItem.find("#secretkey").text(fromdb(jsonObj.secretkey)); + } + } +} + function updateResourceLimitForAccount(domainId, account, type, max) { $.ajax({ data: createURL("command=updateResourceLimit&domainid="+domainId+"&account="+account+"&resourceType="+type+"&max="+max),