step7_controller.js 6.8 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.InstallerStep7Controller = Em.ArrayController.extend({
  20. name: 'installerStep7Controller',
  21. content: [],
  22. selectedService: null,
  23. selectedSlaveHosts: null,
  24. isSubmitDisabled: function() {
  25. return !this.everyProperty('errorCount', 0);
  26. }.property('@each.errorCount'),
  27. init: function () {
  28. // TODO: get selected services from previous step
  29. var selectedServices = [ 'HDFS', 'MapReduce', 'Ganglia', 'Nagios', 'HBase', 'Pig', 'Sqoop', 'Oozie', 'Hive', 'Templeton', 'ZooKeeper'];
  30. var configProperties = App.ConfigProperties.create();
  31. var mockData = [
  32. {
  33. serviceName: 'Nagios',
  34. configCategories: [
  35. App.ServiceConfigCategory.create({ name: 'General'})
  36. ],
  37. configs: configProperties.filterProperty('serviceName', 'NAGIOS')
  38. },
  39. {
  40. serviceName: 'Hive/HCat',
  41. configCategories: [
  42. App.ServiceConfigCategory.create({ name: 'Hive Metastore'}),
  43. App.ServiceConfigCategory.create({ name: 'Advanced'})
  44. ],
  45. configs: configProperties.filterProperty('serviceName', 'HIVE')
  46. },
  47. {
  48. serviceName: 'HDFS',
  49. configCategories: [
  50. App.ServiceConfigCategory.create({ name: 'NameNode'}),
  51. App.ServiceConfigCategory.create({ name: 'SNameNode'}),
  52. App.ServiceConfigCategory.create({ name: 'DataNode'}),
  53. App.ServiceConfigCategory.create({ name: 'General'}),
  54. App.ServiceConfigCategory.create({ name: 'Advanced'})
  55. ],
  56. configs: configProperties.filterProperty('serviceName', 'HDFS')
  57. /*
  58. [
  59. {
  60. name: 'ambari.namenode.host',
  61. displayName: 'NameNode host',
  62. value: 'host0001.com.com',
  63. defaultValue: '',
  64. description: 'The host that has been assigned to run NameNode',
  65. displayType: 'masterHost',
  66. category: 'NameNode'
  67. },
  68. {
  69. name: 'ambari.snamenode.host',
  70. displayName: 'SNameNode host',
  71. value: 'host0002.com.com',
  72. defaultValue: '',
  73. description: 'The host that has been assigned to run Secondary NameNode',
  74. displayType: 'masterHost',
  75. category: 'SNameNode'
  76. },
  77. {
  78. name: 'ambari.datanode.hosts',
  79. displayName: 'DataNode hosts',
  80. value: [ 'host0003.com.com', 'host0004.com.com', 'host0005.com.com' ],
  81. defaultValue: '',
  82. description: 'The hosts that have been assigned to run DataNodes',
  83. displayType: 'slaveHosts',
  84. category: 'DataNode'
  85. }
  86. ]
  87. */
  88. },
  89. {
  90. serviceName: 'MapReduce',
  91. configCategories: [
  92. App.ServiceConfigCategory.create({ name: 'JobTracker'}),
  93. App.ServiceConfigCategory.create({ name: 'TaskTracker'}),
  94. App.ServiceConfigCategory.create({ name: 'General'}),
  95. App.ServiceConfigCategory.create({ name: 'Advanced'})
  96. ],
  97. configs: configProperties.filterProperty('serviceName', 'MAPREDUCE')
  98. },
  99. {
  100. serviceName: 'HBase',
  101. configCategories: [
  102. App.ServiceConfigCategory.create({ name: 'HBase Master'}),
  103. App.ServiceConfigCategory.create({ name: 'RegionServer'}),
  104. App.ServiceConfigCategory.create({ name: 'General'}),
  105. App.ServiceConfigCategory.create({ name: 'Advanced'})
  106. ],
  107. configs: configProperties.filterProperty('serviceName', 'HBASE')
  108. },
  109. {
  110. serviceName: 'ZooKeeper',
  111. configCategories: [
  112. App.ServiceConfigCategory.create({ name: 'ZooKeeper Server'}),
  113. App.ServiceConfigCategory.create({ name: 'Advanced'})
  114. ],
  115. configs: configProperties.filterProperty('serviceName', 'ZOOKEEPER')
  116. },
  117. {
  118. serviceName: 'Oozie',
  119. configCategories: [
  120. App.ServiceConfigCategory.create({ name: 'Oozie Server'}),
  121. App.ServiceConfigCategory.create({ name: 'Advanced'})
  122. ],
  123. configs: configProperties.filterProperty('serviceName', 'OOZIE')
  124. },
  125. {
  126. serviceName: 'Templeton',
  127. configCategories: [
  128. App.ServiceConfigCategory.create({ name: 'Templeton Server'}),
  129. App.ServiceConfigCategory.create({ name: 'Advanced'})
  130. ],
  131. configs: configProperties.filterProperty('serviceName', 'TEMPLETON')
  132. },
  133. {
  134. serviceName: 'Misc',
  135. configCategories: [
  136. App.ServiceConfigCategory.create({ name: 'General'}),
  137. App.ServiceConfigCategory.create({ name: 'Advanced'})
  138. ],
  139. configs: configProperties.filterProperty('serviceName', 'MISC')
  140. }
  141. ];
  142. var self = this;
  143. mockData.forEach(function(_serviceConfig) {
  144. var serviceConfig = App.ServiceConfig.create({
  145. serviceName: _serviceConfig.serviceName,
  146. configCategories: _serviceConfig.configCategories,
  147. configs: []
  148. });
  149. _serviceConfig.configs.forEach(function(_serviceConfigProperty) {
  150. var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
  151. serviceConfigProperty.serviceConfig = serviceConfig;
  152. serviceConfig.configs.pushObject(serviceConfigProperty);
  153. serviceConfigProperty.validate();
  154. });
  155. console.log('pushing ' + serviceConfig.serviceName);
  156. self.content.pushObject(serviceConfig);
  157. });
  158. this.set('selectedService', this.objectAt(0));
  159. },
  160. submit: function() {
  161. if (!this.get('isSubmitDisabled')) {
  162. App.get('router').transitionTo('step8');
  163. }
  164. },
  165. showSlaveHosts: function(event) {
  166. this.set('selectedSlaveHosts', event.context);
  167. App.ModalPopup.show({
  168. header: 'Slave Hosts',
  169. bodyClass: Ember.View.extend({
  170. templateName: require('templates/installer/slaveHostsMatrix')
  171. })
  172. });
  173. },
  174. addSlaveComponentGroup: function(event) {
  175. App.ModalPopup.show({
  176. header: 'Add a ' + event.context + ' Group',
  177. bodyClass: Ember.View.extend({
  178. templateName: require('templates/installer/slaveHostsMatrix')
  179. })
  180. });
  181. }
  182. });