CLOUDSTACK-5527: UI > accounts page > support both "Add (non-LDAP) Account" and "Add LDAP Account" when LDAP is enabled.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/89945cd7 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/89945cd7 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/89945cd7 Branch: refs/heads/opendaylight Commit: 89945cd705496237168641bef71acacb20af56a6 Parents: 3c68b9f Author: Jessica Wang <jessicaw...@apache.org> Authored: Thu Jan 2 16:47:23 2014 -0800 Committer: Jessica Wang <jessicaw...@apache.org> Committed: Thu Jan 2 16:48:13 2014 -0800 ---------------------------------------------------------------------- ui/scripts/accounts.js | 37 +++++++++++++++++++++++++++-- ui/scripts/accountsWizard.js | 2 +- ui/scripts/ui-custom/accountsWizard.js | 9 ++++--- 3 files changed, 42 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89945cd7/ui/scripts/accounts.js ---------------------------------------------------------------------- diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index 0293992..a15cc87 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -86,11 +86,44 @@ action: { custom: cloudStack.uiCustom.accountsWizard( - cloudStack.accountsWizard + cloudStack.accountsWizard, + false ) } - } + }, + + addLdapAccount: { + label: 'Add LDAP Account', + isHeader: true, + preFilter: function(args) { + if ((isAdmin() || isDomainAdmin()) && isLdapEnabled()) { + return true; + } else { + return false; + } + }, + messages: { + notification: function(args) { + return 'Add LDAP Account'; + } + }, + notification: { + poll: function(args) { + args.complete({ + actionFilter: accountActionfilter + }); + } + }, + + action: { + custom: cloudStack.uiCustom.accountsWizard( + cloudStack.accountsWizard, + true + ) + } + + } }, dataProvider: function(args) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89945cd7/ui/scripts/accountsWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/accountsWizard.js b/ui/scripts/accountsWizard.js index e41f8c4..6b4907c 100644 --- a/ui/scripts/accountsWizard.js +++ b/ui/scripts/accountsWizard.js @@ -174,7 +174,7 @@ action: function(args) { var array1 = []; - var ldapStatus = isLdapEnabled(); + var ldapStatus = args.isLdap; if (args.username) { array1.push("&username=" + args.username); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89945cd7/ui/scripts/ui-custom/accountsWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/accountsWizard.js b/ui/scripts/ui-custom/accountsWizard.js index e52c21f..f2017f8 100644 --- a/ui/scripts/ui-custom/accountsWizard.js +++ b/ui/scripts/ui-custom/accountsWizard.js @@ -16,10 +16,10 @@ // under the License. (function($, cloudStack) { - cloudStack.uiCustom.accountsWizard = function(args) { + cloudStack.uiCustom.accountsWizard = function(args, isLdap) { return function(listViewArgs) { var context = listViewArgs.context; - var ldapStatus = isLdapEnabled(); + var ldapStatus = isLdap; var accountsWizard = function(data) { var $wizard = $('#template').find('div.accounts-wizard').clone(); var $form = $wizard.find('form'); @@ -39,6 +39,7 @@ args.action({ context: context, data: data, + isLdap: isLdap, groupname: groupname, response: { error: function(message) { @@ -58,6 +59,7 @@ args.action({ context: context, data: data, + isLdap: isLdap, username: username[i], response: { error: function(message) { @@ -74,6 +76,7 @@ args.action({ context: context, data: data, + isLdap: isLdap, username: username, response: { error: function(message) { @@ -188,7 +191,7 @@ $wizard.find('.manual-account-details').append(informationNotInLdapForm); return $wizard.dialog({ - title: _l('label.add.account'), + title: ldapStatus ? _l('Add LDAP Account') : _l('label.add.account'), width: ldapStatus ? 800 : 330, height: ldapStatus ? 500 : 500, closeOnEscape: false,