From e2114b195038131cd8983602790441861033a1cb Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sat, 25 Sep 2010 10:28:46 -0700 Subject: [PATCH] new UI - accounts page - implement Lock Account action. --- ui/new/jsp/account.jsp | 6 ++++- ui/new/scripts/cloud.core2.account.js | 33 ++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/ui/new/jsp/account.jsp b/ui/new/jsp/account.jsp index 9e243e2a4bc..f6ad235af2f 100644 --- a/ui/new/jsp/account.jsp +++ b/ui/new/jsp/account.jsp @@ -45,7 +45,7 @@
-
+
<%=t.t("id")%>:
@@ -180,6 +180,10 @@

Please confirm you want to disable account that will prevent account access to the cloud and shut down all existing virtual instances.

+ + \ No newline at end of file diff --git a/ui/new/scripts/cloud.core2.account.js b/ui/new/scripts/cloud.core2.account.js index 4facf3c11d9..bdc6d726366 100644 --- a/ui/new/scripts/cloud.core2.account.js +++ b/ui/new/scripts/cloud.core2.account.js @@ -12,6 +12,11 @@ function afterLoadAccountJSP() { modal: true, zIndex: 2000 })); + activateDialog($("#dialog_lock_account").dialog({ + autoOpen: false, + modal: true, + zIndex: 2000 + })); activateDialog($("#dialog_enable_account").dialog({ autoOpen: false, modal: true, @@ -62,7 +67,7 @@ function accountJsonToDetailsTab(jsonObj) { if(jsonObj.state == "enabled") { buildActionLinkForDetailsTab("Disable account", accountActionMap, $actionMenu, accountListAPIMap); - //buildActionLinkForDetailsTab("Lock account", accountActionMap, $actionMenu, accountListAPIMap); + buildActionLinkForDetailsTab("Lock account", accountActionMap, $actionMenu, accountListAPIMap); } else if(jsonObj.state == "disabled" || jsonObj.state == "locked") { buildActionLinkForDetailsTab("Enable account", accountActionMap, $actionMenu, accountListAPIMap); @@ -86,6 +91,16 @@ var accountActionMap = { } } , + "Lock account": { + isAsyncJob: false, + dialogBeforeActionFn : doLockAccount, + inProcessText: "Locking account....", + afterActionSeccessFn: function(jsonObj) { + $("#midmenuItem_"+jsonObj.id).data("jsonObj", jsonObj); + accountJsonToDetailsTab(jsonObj); + } + } + , "Enable account": { isAsyncJob: false, dialogBeforeActionFn : doEnableAccount, @@ -210,6 +225,22 @@ function doDisableAccount($actionLink, listAPIMap, $detailsTab) { }).dialog("open"); } +function doLockAccount($actionLink, listAPIMap, $detailsTab) { + var jsonObj = $detailsTab.data("jsonObj"); + + $("#dialog_lock_account") + .dialog('option', 'buttons', { + "Yes": function() { + $(this).dialog("close"); + var apiCommand = "command=lockAccount&account="+jsonObj.name+"&domainId="+jsonObj.domainid; + doActionToDetailsTab(jsonObj.id, $actionLink, apiCommand, listAPIMap); + }, + "Cancel": function() { + $(this).dialog("close"); + } + }).dialog("open"); +} + function doEnableAccount($actionLink, listAPIMap, $detailsTab) { var jsonObj = $detailsTab.data("jsonObj");