installer.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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.InstallerController = Em.Controller.extend({
  20. name: 'installerController',
  21. isStepDisabled: [],
  22. totalSteps: 10,
  23. init: function () {
  24. this.clusters = App.Cluster.find();
  25. this.isStepDisabled.pushObject(Ember.Object.create({
  26. step: 1,
  27. value: false
  28. }));
  29. for (var i = 2; i <= this.totalSteps; i++) {
  30. this.isStepDisabled.pushObject(Ember.Object.create({
  31. step: i,
  32. value: true
  33. }));
  34. }
  35. },
  36. setStepsEnable: function () {
  37. for (var i = 2; i <= this.totalSteps; i++) {
  38. var step = this.get('isStepDisabled').findProperty('step', i);
  39. if (i <= this.get('currentStep')) {
  40. step.set('value', false);
  41. } else {
  42. step.set('value', true);
  43. }
  44. }
  45. }.observes('currentStep'),
  46. prevInstallStatus: function () {
  47. console.log('Inside the prevInstallStep function: The name is ' + App.router.get('loginController.loginName'));
  48. var result = App.db.isCompleted()
  49. if (result == '1') {
  50. return true;
  51. }
  52. }.property('App.router.loginController.loginName'),
  53. currentStep: function () {
  54. return App.get('router').getInstallerCurrentStep();
  55. }.property(),
  56. clusters: null,
  57. isStep1: function () {
  58. return this.get('currentStep') == 1;
  59. }.property('currentStep'),
  60. isStep2: function () {
  61. return this.get('currentStep') == 2;
  62. }.property('currentStep'),
  63. isStep3: function () {
  64. return this.get('currentStep') == 3;
  65. }.property('currentStep'),
  66. isStep4: function () {
  67. return this.get('currentStep') == 4;
  68. }.property('currentStep'),
  69. isStep5: function () {
  70. return this.get('currentStep') == 5;
  71. }.property('currentStep'),
  72. isStep6: function () {
  73. return this.get('currentStep') == 6;
  74. }.property('currentStep'),
  75. isStep7: function () {
  76. return this.get('currentStep') == 7;
  77. }.property('currentStep'),
  78. isStep8: function () {
  79. return this.get('currentStep') == 8;
  80. }.property('currentStep'),
  81. isStep9: function () {
  82. return this.get('currentStep') == 9;
  83. }.property('currentStep'),
  84. isStep10: function () {
  85. return this.get('currentStep') == 10;
  86. }.property('currentStep'),
  87. gotoStep1: function () {
  88. if (this.get('isStepDisabled').findProperty('step', 1).get('value') === true) {
  89. return;
  90. } else {
  91. App.router.send('gotoStep1');
  92. }
  93. },
  94. gotoStep2: function () {
  95. if (this.get('isStepDisabled').findProperty('step', 2).get('value') === true) {
  96. return;
  97. } else {
  98. App.router.send('gotoStep2');
  99. }
  100. },
  101. gotoStep3: function () {
  102. if (this.get('isStepDisabled').findProperty('step', 3).get('value') === true) {
  103. return;
  104. } else {
  105. App.router.send('gotoStep3');
  106. }
  107. },
  108. gotoStep4: function () {
  109. if (this.get('isStepDisabled').findProperty('step', 4).get('value') === true) {
  110. return;
  111. } else {
  112. App.router.send('gotoStep4');
  113. }
  114. },
  115. gotoStep5: function () {
  116. if (this.get('isStepDisabled').findProperty('step', 5).get('value') === true) {
  117. return;
  118. } else {
  119. App.router.send('gotoStep5');
  120. }
  121. },
  122. gotoStep6: function () {
  123. if (this.get('isStepDisabled').findProperty('step', 6).get('value') === true) {
  124. return;
  125. } else {
  126. App.router.send('gotoStep6');
  127. }
  128. },
  129. gotoStep7: function () {
  130. if (this.get('isStepDisabled').findProperty('step', 7).get('value') === true) {
  131. return;
  132. } else {
  133. App.router.send('gotoStep7');
  134. }
  135. },
  136. gotoStep8: function () {
  137. if (this.get('isStepDisabled').findProperty('step', 8).get('value') === true) {
  138. return;
  139. } else {
  140. App.router.send('gotoStep8');
  141. }
  142. },
  143. gotoStep9: function () {
  144. if (this.get('isStepDisabled').findProperty('step', 9).get('value') === true) {
  145. return;
  146. } else {
  147. App.router.send('gotoStep9');
  148. }
  149. },
  150. gotoStep10: function () {
  151. if (this.get('isStepDisabled').findProperty('step', 10).get('value') === true) {
  152. return;
  153. } else {
  154. App.router.send('gotoStep10');
  155. }
  156. },
  157. /**
  158. *
  159. * @param cluster ClusterModel
  160. */
  161. createCluster: function (cluster) {
  162. alert('created cluster ' + cluster.name);
  163. }
  164. });