configureServices.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. *
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. *
  20. */
  21. var globalOptionsInfo = null;
  22. Y.one('#configureClusterAdvancedSubmitButtonId').on('click',function (e) {
  23. if (this.hasClass('disabled')) {
  24. return;
  25. }
  26. var opts = configureServicesUtil.generateUserOpts();
  27. e.target.set('disabled', true);
  28. var url = "../php/frontend/configureServices.php?clusterName="+globalOptionsInfo.clusterName;
  29. var requestData = opts;
  30. var submitButton = e.target;
  31. var thisScreenId = "#configureClusterAdvancedCoreDivId";
  32. var nextScreenId = "#deployCoreDivId";
  33. var nextScreenRenderFunction = renderDeploy;
  34. var errorFunction = configureServicesUtil.handleConfigureServiceErrors;
  35. submitDataAndProgressToNextScreen(url, requestData, submitButton,
  36. thisScreenId, nextScreenId, nextScreenRenderFunction, errorFunction);
  37. });
  38. // register event handlers for dynamic validation
  39. // when a key is pressed on a password field, perform password validation
  40. Y.one("#configureClusterAdvancedDynamicRenderDivId").delegate(
  41. {
  42. 'keyup' : function (e) {
  43. configureServicesUtil.checkPasswordCorrectness();
  44. configureServicesUtil.updateServiceErrorCount(e.target.get('name'));
  45. }
  46. },
  47. "input[type=password]"
  48. );
  49. // when a key is pressed on a text field, just clear the error
  50. Y.one("#configureClusterAdvancedDynamicRenderDivId").delegate(
  51. {
  52. 'keyup' : function (e) {
  53. configureServicesUtil.clearErrorReason('#' + e.target.get('id'));
  54. configureServicesUtil.updateServiceErrorCount(e.target.get('name'));
  55. }
  56. },
  57. "input[type=text],input[type=password]:not(.retypePassword)"
  58. );
  59. function renderConfigureServicesInternal (optionsInfo) {
  60. Y.one("#configureClusterAdvancedDynamicRenderDivId").setContent(configureServicesUtil.getOptionsSummaryMarkup(optionsInfo, false));
  61. $('#configureServicesTabs a:first').tab('show');
  62. Y.one("#configureClusterAdvancedCoreDivId").show();
  63. Y.one('#configureClusterAdvancedSubmitButtonId').simulate('click');
  64. hideLoadingImg();
  65. }
  66. function renderOptionsPage (optionsInfo) {
  67. globalOptionsInfo = optionsInfo;
  68. var inputUrl = "../php/frontend/fetchClusterServices.php?clusterName=" + optionsInfo.clusterName + "&getConfigs=true";
  69. executeStage(inputUrl, renderConfigureServicesInternal);
  70. }