wizard_controller.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. var App = require('app');
  19. App.RAHighAvailabilityWizardController = App.WizardController.extend({
  20. name: 'rAHighAvailabilityWizardController',
  21. totalSteps: 4,
  22. isFinished: false,
  23. content: Em.Object.create({
  24. controllerName: 'rAHighAvailabilityWizardController',
  25. cluster: null,
  26. loadBalancerURL: null,
  27. hosts: null,
  28. services: null,
  29. masterComponentHosts: null
  30. }),
  31. init: function () {
  32. this._super();
  33. this.clearStep();
  34. },
  35. clearStep: function () {
  36. this.set('isFinished', false);
  37. },
  38. setCurrentStep: function (currentStep, completed) {
  39. this._super(currentStep, completed);
  40. App.clusterStatus.setClusterStatus({
  41. clusterName: this.get('content.cluster.name'),
  42. wizardControllerName: 'rAHighAvailabilityWizardController',
  43. localdb: App.db.data
  44. });
  45. },
  46. loadMap: {
  47. '1': [
  48. {
  49. type: 'sync',
  50. callback: function () {
  51. this.load('cluster');
  52. this.load('loadBalancerURL');
  53. }
  54. }
  55. ],
  56. '2': [
  57. {
  58. type: 'async',
  59. callback: function () {
  60. var dfd = $.Deferred();
  61. var self = this;
  62. this.loadHosts().done(function () {
  63. self.loadServicesFromServer();
  64. self.loadMasterComponentHosts();
  65. dfd.resolve();
  66. });
  67. return dfd.promise();
  68. }
  69. }
  70. ]
  71. },
  72. /**
  73. * Remove all loaded data.
  74. * Created as copy for App.router.clearAllSteps
  75. */
  76. clearAllSteps: function () {
  77. this.clearInstallOptions();
  78. // clear temporary information stored during the install
  79. this.set('content.cluster', this.getCluster());
  80. },
  81. /**
  82. * Clear all temporary data
  83. */
  84. finish: function () {
  85. this.resetDbNamespace();
  86. App.router.get('updateController').updateAll();
  87. this.set('isFinished', true);
  88. }
  89. });