step7_controller.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. App.KerberosWizardStep7Controller = App.KerberosProgressPageController.extend({
  19. name: 'kerberosWizardStep7Controller',
  20. clusterDeployState: 'KERBEROS_DEPLOY',
  21. isSingleRequestPage: true,
  22. request: {},
  23. commands: [],
  24. contextForPollingRequest: Em.I18n.t('requestInfo.kerberizeCluster'),
  25. /**
  26. * Define whether show Back button
  27. * @type {Boolean}
  28. */
  29. isBackButtonDisabled: true,
  30. /**
  31. * Start cluster kerberization. On retry just unkerberize and kerbrize cluster.
  32. * @param {bool} isRetry
  33. */
  34. setRequest: function (isRetry) {
  35. var self = this;
  36. var kerberizeRequest = {
  37. name: 'KERBERIZE_CLUSTER',
  38. ajaxName: 'admin.kerberize.cluster',
  39. ajaxData: {
  40. data: {
  41. Clusters: {
  42. security_type: "KERBEROS"
  43. }
  44. }
  45. }
  46. };
  47. if (isRetry) {
  48. // on retry we have to unkerberize cluster
  49. this.unkerberizeCluster().always(function() {
  50. // clear current request object before start of kerberize process
  51. self.set('request', kerberizeRequest);
  52. self.clearStage();
  53. self.loadStep();
  54. });
  55. } else {
  56. this.set('request', kerberizeRequest);
  57. }
  58. },
  59. retry: function () {
  60. this.set('showRetry', false);
  61. this.get('tasks').setEach('status', 'PENDING');
  62. App.router.send('retry');
  63. },
  64. /**
  65. * Enable or disable previous steps according to tasks statuses
  66. */
  67. enableDisablePreviousSteps: function () {
  68. var wizardController = App.router.get(this.get('content.controllerName'));
  69. if (this.get('tasks').someProperty('status', 'FAILED')) {
  70. wizardController.enableStep(4);
  71. this.set('isBackButtonDisabled', false);
  72. } else {
  73. wizardController.setLowerStepsDisable(6);
  74. this.set('isBackButtonDisabled', true);
  75. }
  76. }.observes('tasks.@each.status')
  77. });