Updated Branches: refs/heads/master fb7eb0619 -> f80ecfe4b
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eaa41433/ui/index.jsp ---------------------------------------------------------------------- diff --git a/ui/index.jsp b/ui/index.jsp index af5fa37..813dbcb 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -238,10 +238,10 @@ under the License. <!-- Step 6: Network --> <div class="step network always-load" wizard-step-id="network"> <!-- 5a: Network description --> - <div class="wizard-step-conditional nothing-to-select"> + <div class="wizard-step-conditional nothing-to-select"> <p id="from_instance_page_1"><fmt:message key="message.zone.no.network.selection"/></p> <p id="from_instance_page_2"><fmt:message key="message.please.proceed"/></p> - <p id="from_vpc_tier"></p> + <p id="from_vpc_tier"></p> </div> <!-- 5b: Select network --> @@ -432,7 +432,7 @@ under the License. <a href="5"><fmt:message key="label.edit"/></a> </div> </div> - + <!-- Security groups --> <div class="select odd"> <div class="name"> @@ -469,6 +469,37 @@ under the License. <div class="button next"><span><fmt:message key="label.next"/></span></div> </div> </div> + <!-- Accounts wizard --> + <div class="multi-wizard accounts-wizard"> + <form> + <div class="steps"> + <div class="content"> + <div class="select-container ldap-account-choice"> + <table> + <thead> + <tr> + <th style="width:40px">Select</th> + <th style="width:110px">Realname</th> + <th style="width:70px">Username</th> + <th>Email</th> + </tr> + </thead> + <tbody> + </tbody> + </table> + </div> + </div> + <div class="content input-area"> + <div class="select-container manual-account-details"> + </div> + </div> + </div> + </form> + <div class="buttons"> + <div class="button cancel"><span><fmt:message key="label.cancel"/></span></div> + <div class="button next"><span><fmt:message key="label.add"/></span></div> + </div> + </div> <!-- Zone wizard --> <div class="multi-wizard zone-wizard"> <div class="progress"> @@ -505,7 +536,7 @@ under the License. </div> <div class="select-area advanced-zone disabled"> <div class="desc"> - <fmt:message key="message.desc.advanced.zone"/> + <fmt:message key="message.desc.advanced.zone"/> </div> <input type="radio" name="network-model" value="Advanced" /> <label><fmt:message key="label.advanced"/></label> @@ -533,7 +564,7 @@ under the License. <div class="setup-zone" zone-wizard-form="zone" zone-wizard-step-id="addZone"> <div class="info-desc"> - <fmt:message key="message.desc.zone"/> + <fmt:message key="message.desc.zone"/> </div> <div class="content input-area"> <div class="select-container"></div> @@ -752,7 +783,7 @@ under the License. <li class="secondary-storage"><fmt:message key="label.secondary.storage"/></li> </ul> <div class="info-desc"> - <fmt:message key="message.desc.host"/> + <fmt:message key="message.desc.host"/> </div> <div class="content input-area"> <div class="select-container"></div> @@ -976,7 +1007,7 @@ under the License. <span><fmt:message key="label.refresh"/></span> </div> <div id="update_ssl_button" class="button action main-action reduced-hide lock" title="Updates your Console Proxy SSL Certificate"> - <span class="icon"> </span> + <span class="icon"> </span> <span><fmt:message key="label.update.ssl.cert"/></span> </div> </div> @@ -1050,7 +1081,7 @@ under the License. <span class="button view-all hosts" view-all-title="<fmt:message key="label.virtual.routers"/>" view-all-target="virtualRouters"><fmt:message key="label.view.all"/></span> - </li> + </li> </ul> </div> </div> @@ -1225,7 +1256,7 @@ under the License. <div class="title"> <span></span> </div> - + <div class="button fetch-latest"> <span><fmt:message key="label.fetch.latest"/></span> </div> @@ -1618,7 +1649,7 @@ under the License. <script src="lib/jquery.js" type="text/javascript"></script> <script src="lib/jquery.easing.js" type="text/javascript"></script> <script src="lib/jquery.validate.js" type="text/javascript"></script> - <script src="lib/jquery-ui/js/jquery-ui.js" type="text/javascript"></script> + <script src="lib/jquery-ui/js/jquery-ui.js" type="text/javascript"></script> <script src="lib/date.js" type="text/javascript"></script> <script src="lib/jquery.cookies.js" type="text/javascript"></script> <script src="lib/jquery.md5.js" type="text/javascript" ></script> @@ -1642,7 +1673,7 @@ under the License. <script type="text/javascript" src="scripts/ui/utils.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/ui/events.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/ui/dialog.js?t=<%=now%>"></script> - + <script type="text/javascript" src="scripts/ui/widgets/multiEdit.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/ui/widgets/overlay.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/ui/widgets/dataTable.js?t=<%=now%>"></script> @@ -1650,7 +1681,7 @@ under the License. <script type="text/javascript" src="scripts/ui/widgets/listView.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/ui/widgets/detailView.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/ui/widgets/treeView.js?t=<%=now%>"></script> - <script type="text/javascript" src="scripts/ui/widgets/notifications.js?t=<%=now%>"></script> + <script type="text/javascript" src="scripts/ui/widgets/notifications.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/ui/widgets/tagger.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/ui/widgets/toolTip.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/cloud.core.callbacks.js?t=<%=now%>"></script> @@ -1671,8 +1702,8 @@ under the License. <script type="text/javascript" src="scripts/dashboard.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/ui-custom/instanceWizard.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/instanceWizard.js?t=<%=now%>"></script> - <script type="text/javascript" src="scripts/affinity.js?t=<%=now%>"></script> - <script type="text/javascript" src="scripts/ui-custom/affinity.js?t=<%=now%>"></script> + <script type="text/javascript" src="scripts/affinity.js?t=<%=now%>"></script> + <script type="text/javascript" src="scripts/ui-custom/affinity.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/instances.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/events.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/regions.js?t=<%=now%>"></script> @@ -1687,6 +1718,8 @@ under the License. <script type="text/javascript" src="scripts/ui-custom/uploadVolume.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/storage.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/templates.js?t=<%=now%>"></script> + <script type="text/javascript" src="scripts/accountsWizard.js?t=<%=now%>"></script> + <script type="text/javascript" src="scripts/ui-custom/accountsWizard.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/accounts.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/configuration.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/globalSettings.js?t=<%=now%>"></script> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eaa41433/ui/scripts/accounts.js ---------------------------------------------------------------------- diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index bf0eaf4..e3e28e4 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -76,7 +76,7 @@ return 'label.add.account'; } }, - + /* createForm: { title: 'label.add.account', desc: 'label.add.account', @@ -284,14 +284,21 @@ } }); }, - + */ notification: { poll: function(args) { args.complete({ actionFilter: accountActionfilter }); } - } + }, + + action: { + custom: cloudStack.uiCustom.accountsWizard( + cloudStack.accountsWizard + ) + }, + } }, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eaa41433/ui/scripts/accountsWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/accountsWizard.js b/ui/scripts/accountsWizard.js new file mode 100644 index 0000000..a350085 --- /dev/null +++ b/ui/scripts/accountsWizard.js @@ -0,0 +1,158 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +(function(cloudStack, $) { + cloudStack.accountsWizard = { + + manuallyInputtedAccountInformation: { + domainid: { + label: 'label.domain', + docID: 'helpAccountDomain', + validation: { + required: true + }, + select: function(args) { + var data = {}; + + if (args.context.users) { // In accounts section + data.listAll = true; + } else if (args.context.domains) { // In domain section (use specific domain) + data.id = args.context.domains[0].id; + } + + $.ajax({ + url: createURL("listDomains"), + data: data, + dataType: "json", + async: false, + success: function(json) { + var items = []; + domainObjs = json.listdomainsresponse.domain; + $(domainObjs).each(function() { + items.push({ + id: this.id, + description: this.path + }); + + if (this.level == 0) + rootDomainId = this.id; + }); + args.response.success({ + data: items + }); + } + }); + } + }, + account: { + label: 'label.account', + docID: 'helpAccountAccount', + validation: { + required: true + }, + }, + accounttype: { + label: 'label.type', + docID: 'helpAccountType', + validation: { + required: true + }, + select: function(args) { + var items = []; + items.push({ + id: 0, + description: "User" + }); //regular-user + items.push({ + id: 1, + description: "Admin" + }); //root-admin + args.response.success({ + data: items + }); + } + }, + timezone: { + label: 'label.timezone', + docID: 'helpAccountTimezone', + select: function(args) { + var items = []; + items.push({ + id: "", + description: "" + }); + for (var p in timezoneMap) + items.push({ + id: p, + description: timezoneMap[p] + }); + args.response.success({ + data: items + }); + } + }, + networkdomain: { + label: 'label.network.domain', + docID: 'helpAccountNetworkDomain', + validation: { + required: false + } + } + }, + + action: function(args) { + var array1 = []; + + array1.push("&username=" + args.data.username); + array1.push("&domainid=" + args.data.domainid); + + if (args.data.account != null && args.data.account.length != 0) { + array1.push("&account=" + args.data.account); + } + + if (args.data.accounttype == "1" && args.data.domainid != rootDomainId) { + args.data.accounttype = "2"; + } + array1.push("&accountType=" + args.data.accounttype); + + if (args.data.timezone != null && args.data.timezone.length != 0) { + array1.push("&timezone=" + args.data.timezone); + } + + if (args.data.networkdomain != null && args.data.networkdomain != 0) { + array1.push("&networkDomain=" + args.data.networkdomain); + } + + console.log(array1.join("")); + console.log(args.data); + + $.ajax({ + url: createURL("ldapCreateAccount" + array1.join("")), + dataType: "json", + success: function(json) { + var item = json.createaccountresponse.account; + args.response.success({ + data: item + }); + }, + error: function(XMLHttpResponse) { + args.response.error(parseXMLHttpResponse(XMLHttpResponse)); + } + }); + } + } +}(cloudStack, jQuery)); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eaa41433/ui/scripts/globalSettings.js ---------------------------------------------------------------------- diff --git a/ui/scripts/globalSettings.js b/ui/scripts/globalSettings.js index 947a3b2..48b71d4 100644 --- a/ui/scripts/globalSettings.js +++ b/ui/scripts/globalSettings.js @@ -99,7 +99,6 @@ } } }, - ldapConfiguration: { type: 'select', title: 'LDAP Configuration', @@ -110,29 +109,18 @@ hostname: { label: 'Hostname' }, - queryfilter: { - label: 'Query Filter' - }, - searchbase: { - label: 'Search Base' - }, port: { label: 'LDAP Port' }, - ssl: { - label: 'SSL' - - } - }, dataProvider: function(args) { var data = {}; listViewDataProvider(args, data); $.ajax({ - url: createURL('ldapConfig&listall=true'), //Need a list LDAP configuration API call which needs to be implemented + url: createURL('listLdapConfigurations'), data: data, success: function(json) { - var items = json.ldapconfigresponse.ldapconfig; + var items = json.ldapconfigurationresponse.LdapConfiguration; args.response.success({ data: items }); @@ -142,12 +130,9 @@ } }); }, - detailView: { name: 'label.details', actions: { - - // Remove LDAP remove: { label: 'Remove LDAP', messages: { @@ -159,192 +144,96 @@ } }, action: function(args) { - $.ajax({ - url: createURL("ldapRemove"), + url: createURL("deleteLdapConfiguration&hostname=" + args.context.ldapConfiguration[0].hostname), success: function(json) { - args.response.success(); - } - }); $(window).trigger('cloudStack.fullRefresh'); - } } }, - tabs: { - details: { title: 'LDAP Configuration Details', fields: [{ hostname: { label: 'Hostname' }, - description: { - label: 'label.description' - }, - ssl: { - label: 'SSL' + port: { + label: 'Port' } }], dataProvider: function(args) { + var items = []; + console.log(args); $.ajax({ - url: createURL("ldapConfig&listAll=true"), + url: createURL("listLdapConfigurations&hostname=" + args.context.ldapConfiguration[0].hostname), dataType: "json", async: true, success: function(json) { - var item = json.ldapconfigresponse.ldapconfig; + var item = json.ldapconfigurationresponse.LdapConfiguration; args.response.success({ - data: item + data: item[0] }); } }); } - } - } }, - actions: { add: { - label: 'Configure LDAP', - messages: { confirm: function(args) { return 'Do you really want to configure LDAP ? '; }, notification: function(args) { - return 'LDAP configured'; + console.log(args); + return 'Successfully added a new LDAP server'; } }, - createForm: { - title: 'Configure LDAP', fields: { - name: { - label: 'Bind DN', - validation: { - required: true - } - }, - password: { - label: 'Bind Password', - validation: { - required: true - }, - isPassword: true - }, hostname: { label: 'Hostname', validation: { required: true } }, - queryfilter: { - label: 'Query Filter', - validation: { - required: true - }, - docID: 'helpLdapQueryFilter' - }, - searchbase: { - label: 'SearchBase', - validation: { - required: true - } - }, - ssl: { - label: 'SSL', - isBoolean: true, - isChecked: false - - }, port: { label: 'Port', - defaultValue: '389' - }, - truststore: { - label: 'Trust Store', - isHidden: true, - dependsOn: 'ssl', - validation: { - required: true - } - }, - truststorepassword: { - label: 'Trust Store Password', - isHidden: true, - dependsOn: 'ssl', validation: { required: true } } - } - - }, - - action: function(args) { var array = []; - array.push("&binddn=" + todb(args.data.name)); - array.push("&bindpass=" + todb(args.data.password)); array.push("&hostname=" + todb(args.data.hostname)); - array.push("&searchbase=" + todb(args.data.searchbase)); - array.push("&queryfilter=" + todb(args.data.queryfilter).replace('&', '%26')); - array.push("&port=" + todb(args.data.port)); - - if (args.$form.find('.form-item[rel=ssl]').find('input[type=checkbox]').is(':Checked') == true) { - - array.push("&ssl=true"); - if (args.data.truststore != "") - array.push("&truststore=" + todb(args.data.truststore)); - - if (args.data.truststorepassword != "") - array.push("&truststorepass=" + todb(args.data.truststorepassword)); - - } else - array.push("&ssl=false"); - + array.push("&port=" + todb(args.data.port));; $.ajax({ - url: createURL("ldapConfig" + array.join("")), + url: createURL("addLdapConfiguration" + array.join("")), dataType: "json", - type: "POST", + async: true, success: function(json) { - var items = json.ldapconfigresponse.ldapconfig; + var items = json.ldapconfigurationresponse.LdapAddConfiguration; args.response.success({ data: items }); - }, - error: function(json) { args.response.error(parseXMLHttpResponse(json)); - } - - }); - - } } - } - - - } - - - }, hypervisorCapabilities: { type: 'select', http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eaa41433/ui/scripts/ui-custom/accountsWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/accountsWizard.js b/ui/scripts/ui-custom/accountsWizard.js new file mode 100644 index 0000000..4037788 --- /dev/null +++ b/ui/scripts/ui-custom/accountsWizard.js @@ -0,0 +1,116 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +(function($, cloudStack) { + cloudStack.uiCustom.accountsWizard = function(args) { + return function(listViewArgs) { + var context = listViewArgs.context; + + var accountsWizard = function(data) { + var $wizard = $('#template').find('div.accounts-wizard').clone(); + var $form = $wizard.find('form'); + + var close = function() { + $wizard.dialog('destroy'); + $('div.overlay').fadeOut(function() { + $('div.overlay').remove(); + }); + }; + + var completeAction = function() { + var data = cloudStack.serializeForm($form); + args.action({ + context: context, + data: data, + response: { + success: function(args) { + $('.list-view').listView('refresh'); + close(); + }, + error: function(message) { + close(); + if(message) { + cloudStack.dialog.notice({ + message: message + }); + } + } + } + }); + } + + $wizard.click(function(event) { + var $target = $(event.target); + if ($target.closest('div.button.next').size()) { + $form.validate(); + if ($form.valid()) { + completeAction(); + return true; + } else { + return false; + } + } + + if ($target.closest('div.button.cancel').size()) { + close(); + return false; + } + }); + + var form = cloudStack.dialog.createForm({ + context: context, + noDialog: true, + form: { + title: '', + fields: args.manuallyInputtedAccountInformation + } + }); + + var $manualDetails = form.$formContainer.find('form .form-item'); + $wizard.find('.manual-account-details').append($manualDetails); + + var $table = $wizard.find('.ldap-account-choice tbody'); + + $.ajax({ + url: createURL("listAllLdapUsers"), + dataType: "json", + async: false, + success: function(json) { + $(json.ldapuserresponse.LdapUser).each(function() { + var result = $("<tr>"); + result.append("<td><input type=\"radio\" class=\"required\" name=\"username\" value=\"" + this.username + "\"></td>"); + result.append("<td>" + this.firstname + " " + this.lastname + "</td>"); + result.append("<td>" + this.username + "</td>"); + result.append("<td>" + this.email + "</td>"); + $table.append(result); + }) + } + }); + + return $wizard.dialog({ + title: _l('label.add.account'), + width: 800, + height: 500, + closeOnEscape: false, + zIndex: 5000 + }).closest('.ui-dialog').overlay(); + } + + accountsWizard(args); + }; + }; +})(jQuery, cloudStack);
