step7_controller.js 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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. var mockData = [
  29. {
  30. serviceName: 'HDFS',
  31. configCategories: [
  32. App.ServiceConfigCategory.create({ name: 'General'}),
  33. App.ServiceConfigCategory.create({ name: 'NameNode'}),
  34. App.ServiceConfigCategory.create({ name: 'SNameNode'}),
  35. App.ServiceConfigCategory.create({ name: 'DataNode'}),
  36. App.ServiceConfigCategory.create({ name: 'Advanced'})
  37. ],
  38. configs: [
  39. {
  40. name: 'dfs.prop1',
  41. displayName: 'Prop1',
  42. value: '',
  43. defaultValue: '100',
  44. description: 'This is Prop1',
  45. displayType: 'digits',
  46. unit: 'MB',
  47. category: 'General'
  48. },
  49. {
  50. name: 'dfs.prop2',
  51. displayName: 'Prop2',
  52. value: '',
  53. defaultValue: '0',
  54. description: 'This is Prop2 (Optional)',
  55. displayType: 'number',
  56. isRequired: false,
  57. category: 'General'
  58. },
  59. {
  60. name: 'dfs.adv.prop1',
  61. displayName: 'Adv Prop1',
  62. value: '',
  63. defaultValue: '100',
  64. description: 'This is Adv Prop1',
  65. displayType: 'int',
  66. isRequired: false,
  67. category: 'Advanced'
  68. },
  69. {
  70. name: 'dfs.adv.prop2',
  71. displayName: 'Adv Prop2',
  72. value: '',
  73. displayType: 'string',
  74. defaultValue: 'This is Adv Prop2',
  75. isRequired: false,
  76. category: 'Advanced'
  77. },
  78. {
  79. name: 'hdfs-site.xml',
  80. displayName: 'Custom HDFS Configs',
  81. value: '',
  82. defaultValue: '',
  83. description: 'If you wish to set configuration parameters not exposed through this page, you can specify them here.<br>The text you specify here will be injected into hdfs-site.xml verbatim.',
  84. displayType: 'custom',
  85. isRequired: false,
  86. category: 'Advanced'
  87. },
  88. {
  89. name: 'ambari.namenode.host',
  90. displayName: 'NameNode host',
  91. value: 'host0001.com.com',
  92. defaultValue: '',
  93. description: 'The host that has been assigned to run NameNode',
  94. displayType: 'masterHost',
  95. category: 'NameNode'
  96. },
  97. {
  98. name: 'dfs.namenode.dir',
  99. displayName: 'NameNode directories',
  100. value: '/grid/0/hadoop/namenode\r\n/grid/1/hadoop/namenode',
  101. defaultValue: '',
  102. displayType: 'directories',
  103. category: 'NameNode'
  104. },
  105. {
  106. name: 'dfs.namenode.prop1',
  107. displayName: 'NameNode Prop1',
  108. value: '',
  109. defaultValue: 'default (nn)',
  110. category: 'NameNode'
  111. },
  112. {
  113. name: 'ambari.snamenode.host',
  114. displayName: 'SNameNode host',
  115. value: 'host0002.com.com',
  116. defaultValue: '',
  117. description: 'The host that has been assigned to run Secondary NameNode',
  118. displayType: 'masterHost',
  119. category: 'SNameNode'
  120. },
  121. {
  122. name: 'fs.checkpoint.dir',
  123. displayName: 'SNameNode directories',
  124. value: '',
  125. defaultValue: '',
  126. displayType: 'directories',
  127. category: 'SNameNode'
  128. },
  129. {
  130. name: 'fs.checkpoint.prop1',
  131. displayName: 'SNameNode Prop1',
  132. value: '',
  133. defaultValue: 'default (snn)',
  134. category: 'SNameNode'
  135. },
  136. {
  137. name: 'ambari.datanode.hosts',
  138. displayName: 'DataNode hosts',
  139. value: [ 'host0003.com.com', 'host0004.com.com', 'host0005.com.com' ],
  140. defaultValue: '',
  141. description: 'The hosts that have been assigned to run DataNodes',
  142. displayType: 'slaveHosts',
  143. category: 'DataNode'
  144. },
  145. {
  146. name: 'dfs.data.dir',
  147. displayName: 'DataNode directories',
  148. value: '',
  149. defaultValue: '',
  150. displayType: 'directories',
  151. category: 'DataNode'
  152. },
  153. {
  154. name: 'dfs.data.prop1',
  155. displayName: 'DataNode Prop1',
  156. value: '',
  157. defaultValue: 'default (dn)',
  158. category: 'DataNode'
  159. }
  160. ]
  161. },
  162. {
  163. serviceName: 'MapReduce',
  164. configCategories: [
  165. App.ServiceConfigCategory.create({ name: 'General'}),
  166. App.ServiceConfigCategory.create({ name: 'JobTracker'}),
  167. App.ServiceConfigCategory.create({ name: 'TaskTracker'}),
  168. App.ServiceConfigCategory.create({ name: 'Advanced'})
  169. ],
  170. configs: [
  171. {
  172. name: 'mapred.prop1',
  173. displayName: 'Prop1',
  174. value: '1',
  175. defaultValue: '0',
  176. category: 'General'
  177. },
  178. {
  179. name: 'jt.prop1',
  180. displayName: 'JT Prop1',
  181. value: '2',
  182. defaultValue: '128',
  183. category: 'JobTracker'
  184. },
  185. {
  186. name: 'tt.prop1',
  187. displayName: 'TT Prop1',
  188. value: '3',
  189. defaultValue: '256',
  190. category: 'TaskTracker'
  191. },
  192. {
  193. name: 'mapred.adv.prop1',
  194. displayName: 'Adv Prop1',
  195. value: '',
  196. defaultValue: '1024',
  197. category: 'Advanced'
  198. }
  199. ]
  200. },
  201. {
  202. serviceName: 'HBase',
  203. configCategories: [
  204. App.ServiceConfigCategory.create({ name: 'General'}),
  205. App.ServiceConfigCategory.create({ name: 'HBaseMaster'}),
  206. App.ServiceConfigCategory.create({ name: 'RegionServer'}),
  207. App.ServiceConfigCategory.create({ name: 'Advanced'})
  208. ],
  209. configs: []
  210. },
  211. {
  212. serviceName: 'Hive/HCat',
  213. configCategories: [
  214. App.ServiceConfigCategory.create({ name: 'Hive Metastore'})
  215. ],
  216. configs: []
  217. },
  218. {
  219. serviceName: 'ZooKeeper',
  220. configCategories: [
  221. App.ServiceConfigCategory.create({ name: 'General'})
  222. ],
  223. configs: []
  224. },
  225. {
  226. serviceName: 'Nagios',
  227. configCategories: [
  228. App.ServiceConfigCategory.create({ name: 'General'})
  229. ],
  230. configs: [
  231. {
  232. name: 'nagios_web_login',
  233. displayName: 'Nagios Admin username',
  234. value: 'nagiosadmin',
  235. description: 'Nagios Web UI Admin username'
  236. },
  237. {
  238. name: 'nagios_web_password',
  239. displayName: 'Nagios Admin password',
  240. value: '',
  241. description: 'Nagios Web UI Admin password'
  242. },
  243. {
  244. name: 'nagios_contact',
  245. displayName: 'Alert email address',
  246. description: 'Email address to which alert notifications will be sent'
  247. }
  248. ]
  249. },
  250. {
  251. serviceName: 'Oozie',
  252. configCategories: [
  253. App.ServiceConfigCategory.create({ name: 'General'})
  254. ],
  255. configs: []
  256. },
  257. {
  258. serviceName: 'Misc',
  259. configCategories: [
  260. App.ServiceConfigCategory.create({ name: 'General'})
  261. ],
  262. configs: []
  263. }
  264. ];
  265. var self = this;
  266. mockData.forEach(function(_serviceConfig) {
  267. var serviceConfig = App.ServiceConfig.create({
  268. serviceName: _serviceConfig.serviceName,
  269. configCategories: _serviceConfig.configCategories,
  270. configs: []
  271. });
  272. _serviceConfig.configs.forEach(function(_serviceConfigProperty) {
  273. var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
  274. serviceConfigProperty.serviceConfig = serviceConfig;
  275. serviceConfig.configs.pushObject(serviceConfigProperty);
  276. serviceConfigProperty.validate();
  277. });
  278. console.log('pushing ' + serviceConfig.serviceName);
  279. self.content.pushObject(serviceConfig);
  280. });
  281. this.set('selectedService', this.objectAt(0));
  282. },
  283. submit: function() {
  284. if (!this.get('isSubmitDisabled')) {
  285. App.get('router').transitionTo('step8');
  286. }
  287. },
  288. showSlaveHosts: function(event) {
  289. this.set('selectedSlaveHosts', event.context);
  290. App.ModalPopup.show({
  291. header: 'Slave Hosts',
  292. bodyClass: Ember.View.extend({
  293. templateName: require('templates/installer/slaveHostsMatrix')
  294. })
  295. });
  296. },
  297. addSlaveComponentGroup: function(event) {
  298. App.ModalPopup.show({
  299. header: 'Add a ' + event.context + ' Group',
  300. bodyClass: Ember.View.extend({
  301. templateName: require('templates/installer/slaveHostsMatrix')
  302. })
  303. });
  304. }
  305. });