installer.js 5.0 KB

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