stack_service.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  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. require('utils/helper');
  20. require('mixins/models/service_mixin');
  21. require('models/service_config');
  22. require('utils/configs/defaults_providers/yarn_defaults_provider');
  23. require('utils/configs/defaults_providers/tez_defaults_provider');
  24. require('utils/configs/defaults_providers/hive_defaults_provider');
  25. require('utils/configs/defaults_providers/storm_defaults_provider');
  26. require('utils/configs/defaults_providers/oozie_defaults_provider');
  27. require('utils/configs/validators/yarn_configs_validator');
  28. require('utils/configs/validators/hive_configs_validator');
  29. require('utils/configs/validators/tez_configs_validator');
  30. require('utils/configs/validators/mapreduce2_configs_validator');
  31. require('utils/configs/validators/storm_configs_validator');
  32. /**
  33. * This model loads all services supported by the stack
  34. * The model maps to the http://hostname:8080/api/v1/stacks2/HDP/versions/${versionNumber}/stackServices?fields=StackServices/*,serviceComponents/*
  35. * @type {*}
  36. */
  37. App.StackService = DS.Model.extend(App.ServiceModelMixin, {
  38. comments: DS.attr('string'),
  39. configTypes: DS.attr('object'),
  40. serviceVersion: DS.attr('string'),
  41. serviceCheckSupported: DS.attr('boolean'),
  42. stackName: DS.attr('string'),
  43. stackVersion: DS.attr('string'),
  44. isSelected: DS.attr('boolean', {defaultValue: true}),
  45. isInstalled: DS.attr('boolean', {defaultValue: false}),
  46. serviceComponents: DS.hasMany('App.StackServiceComponent'),
  47. configs: DS.attr('array'),
  48. // Is the service a distributed filesystem
  49. isDFS: function () {
  50. var dfsServices = ['HDFS', 'GLUSTERFS'];
  51. return dfsServices.contains(this.get('serviceName'));
  52. }.property('serviceName'),
  53. // Primary DFS. used if there is more than one DFS in a stack.
  54. // Only one service in the stack should be tagged as primary DFS.
  55. isPrimaryDFS: function () {
  56. return this.get('serviceName') === 'HDFS';
  57. }.property('serviceName'),
  58. configTypesRendered: function () {
  59. var configTypes = this.get('configTypes');
  60. if (this.get('serviceName') == 'HDFS') return configTypes;
  61. else {
  62. var renderedConfigTypes = $.extend(true, {}, configTypes);
  63. delete renderedConfigTypes['core-site'];
  64. return renderedConfigTypes
  65. }
  66. }.property('serviceName', 'configTypes'),
  67. displayNameOnSelectServicePage: function () {
  68. var displayName = this.get('displayName');
  69. var services = this.get('coSelectedServices').slice();
  70. var serviceDisplayNames = services.map(function (item) {
  71. return App.format.role(item);
  72. }, this);
  73. if (!!serviceDisplayNames.length) {
  74. serviceDisplayNames.unshift(displayName);
  75. displayName = serviceDisplayNames.join(" + ");
  76. }
  77. return displayName;
  78. }.property('coSelectedServices', 'serviceName'),
  79. isHiddenOnSelectServicePage: function () {
  80. var hiddenServices = ['MAPREDUCE2', 'HCATALOG', 'WEBHCAT'];
  81. return hiddenServices.contains(this.get('serviceName'));
  82. }.property('serviceName'),
  83. dependentServices: function () {
  84. var serviceName = this.get('serviceName');
  85. var dependentServices = [];
  86. if (App.get('isHadoop2Stack')) {
  87. dependentServices = App.StackService.dependency['HDP-2'][serviceName];
  88. } else {
  89. dependentServices = App.StackService.dependency['HDP-1'][serviceName];
  90. }
  91. return dependentServices;
  92. }.property('serviceName'),
  93. /**
  94. * other services on which the service is dependent
  95. */
  96. serviceDependency: function () {
  97. var serviceName = this.get('serviceName');
  98. var serviceDependencyMap, key, serviceDependencies = [];
  99. if (App.get('isHadoop2Stack')) {
  100. serviceDependencyMap = App.StackService.dependency['HDP-2'];
  101. } else {
  102. serviceDependencyMap = App.StackService.dependency['HDP-1'];
  103. }
  104. for (key in serviceDependencyMap) {
  105. if (serviceDependencyMap[key].contains(serviceName)) serviceDependencies.pushObject(key);
  106. }
  107. return serviceDependencies;
  108. }.property('serviceName'),
  109. // Is the service required for monitoring of other hadoop ecosystem services
  110. isMonitoringService: function () {
  111. var services = ['NAGIOS', 'GANGLIA'];
  112. return services.contains(this.get('serviceName'));
  113. }.property('serviceName'),
  114. coSelectedServices: function () {
  115. var coSelectedServices = App.StackService.coSelected[this.get('serviceName')];
  116. if (!!coSelectedServices) {
  117. return coSelectedServices;
  118. } else {
  119. return [];
  120. }
  121. }.property('serviceName'),
  122. hasClient: function () {
  123. var serviceComponents = this.get('serviceComponents');
  124. return serviceComponents.someProperty('isClient');
  125. }.property('serviceName'),
  126. hasMaster: function () {
  127. var serviceComponents = this.get('serviceComponents');
  128. return serviceComponents.someProperty('isMaster');
  129. }.property('serviceName'),
  130. hasSlave: function () {
  131. var serviceComponents = this.get('serviceComponents');
  132. return serviceComponents.someProperty('isSlave');
  133. }.property('serviceName'),
  134. isClientOnlyService: function () {
  135. var serviceComponents = this.get('serviceComponents');
  136. return serviceComponents.everyProperty('isClient');
  137. }.property('serviceName'),
  138. isNoConfigTypes: function () {
  139. var configTypes = this.get('configTypes');
  140. return !(configTypes && !!Object.keys(configTypes).length);
  141. }.property('configTypes'),
  142. customReviewHandler: function () {
  143. return App.StackService.reviewPageHandlers[this.get('serviceName')];
  144. }.property('serviceName'),
  145. defaultsProviders: function () {
  146. var defaultConfigsHandler = App.StackService.defaultConfigsHandler[this.get('serviceName')];
  147. return defaultConfigsHandler && defaultConfigsHandler.defaultsProviders;
  148. }.property('serviceName'),
  149. configsValidator: function () {
  150. var defaultConfigsHandler = App.StackService.defaultConfigsHandler[this.get('serviceName')];
  151. return defaultConfigsHandler && defaultConfigsHandler.configsValidator;
  152. }.property('serviceName'),
  153. /**
  154. * configCategories are fetched from App.StackService.configCategories.
  155. * Also configCategories that does not match any serviceComponent of a service and not included in the permissible default pattern are omitted
  156. */
  157. configCategories: function () {
  158. var configCategories = [];
  159. var serviceName = this.get('serviceName');
  160. var configTypes = this.get('configTypes');
  161. var serviceComponents = this.get('serviceComponents');
  162. if (configTypes && Object.keys(configTypes).length) {
  163. var pattern = ["General", "CapacityScheduler", "^Advanced", "Env$", "^Custom", "Falcon - Oozie integration", "FalconStartupSite", "FalconRuntimeSite"];
  164. configCategories = App.StackService.configCategories.call(this).filter(function (_configCategory) {
  165. var serviceComponentName = _configCategory.get('name');
  166. var isServiceComponent = serviceComponents.someProperty('componentName', serviceComponentName);
  167. if (isServiceComponent) return isServiceComponent;
  168. var result = false;
  169. pattern.forEach(function (_pattern) {
  170. var regex = new RegExp(_pattern);
  171. if (regex.test(serviceComponentName)) result = true;
  172. });
  173. return result;
  174. });
  175. }
  176. return configCategories;
  177. }.property('serviceName', 'configTypes', 'serviceComponents')
  178. });
  179. App.StackService.FIXTURES = [];
  180. App.StackService.displayOrder = [
  181. 'HDFS',
  182. 'MAPREDUCE',
  183. 'MAPREDUCE2',
  184. 'YARN',
  185. 'TEZ',
  186. 'NAGIOS',
  187. 'GANGLIA',
  188. 'HIVE',
  189. 'HCATALOG',
  190. 'WEBHCAT',
  191. 'HBASE',
  192. 'PIG',
  193. 'SQOOP',
  194. 'OOZIE',
  195. 'ZOOKEEPER',
  196. 'HUE',
  197. 'FALCON',
  198. 'STORM',
  199. 'FLUME'
  200. ];
  201. App.StackService.dependency = {
  202. 'HDP-1': {
  203. 'MAPREDUCE': ['PIG', 'OOZIE', 'HIVE'],
  204. 'ZOOKEEPER': ['HBASE', 'HIVE', 'WEBHCAT']
  205. },
  206. 'HDP-2': {
  207. 'YARN': ['PIG', 'OOZIE', 'HIVE', 'TEZ'],
  208. 'TEZ': ['YARN'],
  209. 'OOZIE': ['FALCON'],
  210. 'ZOOKEEPER': ['HDFS', 'HBASE', 'HIVE', 'WEBHCAT', 'STORM']
  211. }
  212. };
  213. //@TODO: Write unit test for no two keys in the object should have any intersecting elements in their values
  214. App.StackService.coSelected = {
  215. 'YARN': ['MAPREDUCE2'],
  216. 'HIVE': ['HCATALOG', 'WEBHCAT']
  217. };
  218. App.StackService.reviewPageHandlers = {
  219. 'HIVE': {
  220. 'Database': 'loadHiveDbValue'
  221. },
  222. 'NAGIOS': {
  223. 'Administrator': 'loadNagiosAdminValue'
  224. },
  225. 'OOZIE': {
  226. 'Database': 'loadOozieDbValue'
  227. }
  228. };
  229. App.StackService.defaultConfigsHandler = {
  230. YARN: {defaultsProviders: [App.YARNDefaultsProvider.create()], configsValidator: App.YARNConfigsValidator},
  231. MAPREDUCE2: {defaultsProviders: [App.YARNDefaultsProvider.create()], configsValidator: App.MapReduce2ConfigsValidator},
  232. HIVE: {defaultsProviders: [App.HiveDefaultsProvider.create()], configsValidator: App.HiveConfigsValidator},
  233. STORM: {defaultsProviders: [App.STORMDefaultsProvider.create()], configsValidator: App.STORMConfigsValidator},
  234. TEZ: {defaultsProviders: [App.TezDefaultsProvider.create()], configsValidator: App.TezConfigsValidator}
  235. };
  236. App.StackService.configCategories = function () {
  237. var serviceConfigCategories = [];
  238. switch (this.get('serviceName')) {
  239. case 'HDFS':
  240. serviceConfigCategories.pushObjects([
  241. App.ServiceConfigCategory.create({ name: 'NAMENODE', displayName: 'NameNode'}),
  242. App.ServiceConfigCategory.create({ name: 'SECONDARY_NAMENODE', displayName: 'Secondary NameNode'}),
  243. App.ServiceConfigCategory.create({ name: 'DATANODE', displayName: 'DataNode'}),
  244. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  245. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  246. App.ServiceConfigCategory.create({ name: 'Advanced core-site', displayName: 'Custom core-site.xml', siteFileName: 'core-site.xml', canAddProperty: true}),
  247. App.ServiceConfigCategory.create({ name: 'Advanced hdfs-site', displayName: 'Custom hdfs-site.xml', siteFileName: 'hdfs-site.xml', canAddProperty: true}),
  248. App.ServiceConfigCategory.create({ name: 'Advanced hdfs-log4j', displayName: 'Custom log4j.properties', siteFileName: 'hdfs-log4j.xml', canAddProperty: false}),
  249. App.ServiceConfigCategory.create({ name: 'Advanced hadoop-env', displayName: 'hadoop-env.sh content', siteFileName: 'hadoop-env.xml', canAddProperty: false})
  250. ]);
  251. break;
  252. case 'GLUSTERFS':
  253. serviceConfigCategories.pushObjects([
  254. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  255. App.ServiceConfigCategory.create({ name: 'Advanced core-site', displayName : 'Custom core-site.xml', siteFileName: 'core-site.xml', canAddProperty: true})
  256. ]);
  257. break;
  258. case 'MAPREDUCE':
  259. serviceConfigCategories.pushObjects([
  260. App.ServiceConfigCategory.create({ name: 'HISTORYSERVER', displayName: 'History Server'}),
  261. App.ServiceConfigCategory.create({ name: 'JOBTRACKER', displayName: 'JobTracker'}),
  262. App.ServiceConfigCategory.create({ name: 'TASKTRACKER', displayName: 'TaskTracker'}),
  263. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  264. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  265. App.ServiceConfigCategory.create({ name: 'Advanced mapred-site', displayName: 'Custom mapred-site.xml', siteFileName: 'mapred-site.xml', canAddProperty: true}),
  266. App.ServiceConfigCategory.create({ name: 'Advanced mapreduce-log4j', displayName: 'Custom log4j.properties', siteFileName: 'mapreduce-log4j.xml', canAddProperty: false}),
  267. App.ServiceConfigCategory.create({ name: 'Advanced mapred-env', displayName: 'mapred-env.sh content', siteFileName: 'mapred-env.xml', canAddProperty: false})
  268. ]);
  269. break;
  270. case 'YARN':
  271. serviceConfigCategories.pushObjects([
  272. App.ServiceConfigCategory.create({ name: 'RESOURCEMANAGER', displayName: 'Resource Manager'}),
  273. App.ServiceConfigCategory.create({ name: 'NODEMANAGER', displayName: 'Node Manager'}),
  274. App.ServiceConfigCategory.create({ name: 'APP_TIMELINE_SERVER', displayName: 'Application Timeline Server'}),
  275. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  276. App.ServiceConfigCategory.create({ name: 'CapacityScheduler', displayName: 'Scheduler', isCapacityScheduler: true, isCustomView: true, siteFileName: 'capacity-scheduler.xml', siteFileNames: ['capacity-scheduler.xml', 'mapred-queue-acls.xml'], canAddProperty: App.supports.capacitySchedulerUi}),
  277. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  278. App.ServiceConfigCategory.create({ name: 'Advanced yarn-site', displayName: 'Custom yarn-site.xml', siteFileName: 'yarn-site.xml', canAddProperty: true}),
  279. App.ServiceConfigCategory.create({ name: 'Advanced yarn-log4j', displayName: 'Custom log4j.properties', siteFileName: 'yarn-log4j.xml', canAddProperty: false}),
  280. App.ServiceConfigCategory.create({ name: 'Advanced yarn-env', displayName: 'yarn-env.sh content', siteFileName: 'yarn-env.xml', canAddProperty: false})
  281. ]);
  282. break;
  283. case 'MAPREDUCE2':
  284. serviceConfigCategories.pushObjects([
  285. App.ServiceConfigCategory.create({ name: 'HISTORYSERVER', displayName: 'History Server'}),
  286. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  287. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  288. App.ServiceConfigCategory.create({ name: 'AdvancedMapredSite', displayName: 'Custom mapred-site.xml', siteFileName: 'mapred-site.xml', canAddProperty: true}),
  289. App.ServiceConfigCategory.create({ name: 'Advanced mapred-env', displayName: 'mapred-env.sh content', siteFileName: 'mapred-env.xml', canAddProperty: false})
  290. ]);
  291. break;
  292. case 'HIVE':
  293. serviceConfigCategories.pushObjects([
  294. App.ServiceConfigCategory.create({ name: 'HIVE_METASTORE', displayName: 'Hive Metastore'}),
  295. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  296. App.ServiceConfigCategory.create({ name: 'Advanced hive-site', displayName: 'Custom hive-site.xml', siteFileName: 'hive-site.xml', canAddProperty: true}),
  297. App.ServiceConfigCategory.create({ name: 'Advanced hive-log4j', displayName: 'Custom log4j.properties', siteFileName: 'hive-log4j.xml', canAddProperty: false}),
  298. App.ServiceConfigCategory.create({ name: 'Advanced hive-exec-log4j', displayName: 'Custom hive-exec-log4j', siteFileName: 'hive-exec-log4j.xml', canAddProperty: false}),
  299. App.ServiceConfigCategory.create({ name: 'Advanced hive-env', displayName: 'hive-env.sh content', siteFileName: 'hive-env.xml', canAddProperty: false})
  300. ]);
  301. break;
  302. case 'WEBHCAT':
  303. serviceConfigCategories.pushObjects([
  304. App.ServiceConfigCategory.create({ name: 'WEBHCAT_SERVER', displayName: 'WebHCat Server'}),
  305. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  306. App.ServiceConfigCategory.create({ name: 'Advanced webhcat-site', displayName: 'Custom webhcat-site.xml', siteFileName: 'webhcat-site.xml', canAddProperty: true}),
  307. App.ServiceConfigCategory.create({ name: 'Advanced webhcat-env', displayName: 'webhcat-env.sh content', siteFileName: 'webhcat-env.xml', canAddProperty: false})
  308. ]);
  309. break;
  310. case 'HBASE':
  311. serviceConfigCategories.pushObjects([
  312. App.ServiceConfigCategory.create({ name: 'HBASE_MASTER', displayName: 'HBase Master'}),
  313. App.ServiceConfigCategory.create({ name: 'HBASE_REGIONSERVER', displayName: 'RegionServer'}),
  314. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  315. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  316. App.ServiceConfigCategory.create({ name: 'Advanced hbase-site', displayName: 'Custom hbase-site.xml', siteFileName: 'hbase-site.xml', canAddProperty: true}),
  317. App.ServiceConfigCategory.create({ name: 'Advanced hbase-log4j', displayName: 'Custom log4j.properties', siteFileName: 'hbase-log4j.xml', canAddProperty: false}),
  318. App.ServiceConfigCategory.create({ name: 'Advanced hbase-env', displayName: 'hbase-env.sh content', siteFileName: 'hbase-env.xml', canAddProperty: false})
  319. ]);
  320. break;
  321. case 'ZOOKEEPER':
  322. serviceConfigCategories.pushObjects([
  323. App.ServiceConfigCategory.create({ name: 'ZOOKEEPER_SERVER', displayName: 'ZooKeeper Server'}),
  324. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  325. App.ServiceConfigCategory.create({ name: 'Advanced zookeeper-log4j', displayName: 'Custom log4j.properties', siteFileName: 'zookeeper-log4j.xml', canAddProperty: false}),
  326. App.ServiceConfigCategory.create({ name: 'Advanced zoo.cfg', displayName: 'Custom zoo.cfg', siteFileName: 'zoo.cfg', canAddProperty: true}),
  327. App.ServiceConfigCategory.create({ name: 'Advanced zookeeper-env', displayName: 'zookeeper-env.sh content', siteFileName: 'zookeeper-env.xml', canAddProperty: false})
  328. ]);
  329. break;
  330. case 'OOZIE':
  331. serviceConfigCategories.pushObjects([
  332. App.ServiceConfigCategory.create({ name: 'OOZIE_SERVER', displayName: 'Oozie Server'}),
  333. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  334. App.ServiceConfigCategory.create({ name: 'Advanced oozie-site', displayName: 'Custom oozie-site.xml', siteFileName: 'oozie-site.xml', canAddProperty: true}),
  335. App.ServiceConfigCategory.create({ name: 'Advanced oozie-log4j', displayName: 'Custom log4j.properties', siteFileName: 'oozie-log4j.xml', canAddProperty: false}),
  336. App.ServiceConfigCategory.create({ name: 'Advanced oozie-env', displayName: 'oozie-env.sh content', siteFileName: 'oozie-env.xml', canAddProperty: false})
  337. ]);
  338. break;
  339. case 'PIG':
  340. serviceConfigCategories.pushObjects([
  341. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Custom pig.properties', siteFileName: 'pig-properties.xml', canAddProperty: false}),
  342. App.ServiceConfigCategory.create({ name: 'Advanced pig-log4j', displayName: 'Custom log4j.properties', siteFileName: 'pig-log4j.xml', canAddProperty: false}),
  343. App.ServiceConfigCategory.create({ name: 'Advanced pig-env', displayName: 'pig-env.sh content', siteFileName: 'pig-env.xml', canAddProperty: false})
  344. ]);
  345. break;
  346. case 'FALCON':
  347. serviceConfigCategories.pushObjects([
  348. App.ServiceConfigCategory.create({ name: 'FALCON_SERVER', displayName: 'Falcon Server'}),
  349. App.ServiceConfigCategory.create({ name: 'Falcon - Oozie integration', displayName: 'Falcon - Oozie integration'}),
  350. App.ServiceConfigCategory.create({ name: 'FalconStartupSite', displayName: 'Falcon startup.properties'}),
  351. App.ServiceConfigCategory.create({ name: 'FalconRuntimeSite', displayName: 'Falcon runtime.properties'}),
  352. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  353. App.ServiceConfigCategory.create({ name: 'Advanced falcon-startup.properties', displayName: 'Custom startup.properties', siteFileName: 'falcon-startup.properties.xml', canAddProperty: true}),
  354. App.ServiceConfigCategory.create({ name: 'Advanced falcon-runtime.properties', displayName: 'Custom runtime.properties', siteFileName: 'falcon-runtime.properties.xml', canAddProperty: true}),
  355. App.ServiceConfigCategory.create({ name: 'Advanced falcon-env', displayName: 'falcon-env.sh content', siteFileName: 'falcon-env.xml', canAddProperty: false})
  356. ]);
  357. break;
  358. case 'STORM':
  359. serviceConfigCategories.pushObjects([
  360. App.ServiceConfigCategory.create({ name: 'NIMBUS', displayName: 'Nimbus'}),
  361. App.ServiceConfigCategory.create({ name: 'SUPERVISOR', displayName: 'Supervisor'}),
  362. App.ServiceConfigCategory.create({ name: 'STORM_UI_SERVER', displayName: 'Storm UI Server'}),
  363. App.ServiceConfigCategory.create({ name: 'STORM_REST_API', displayName: 'Storm REST API Server'}),
  364. App.ServiceConfigCategory.create({ name: 'DRPC_SERVER', displayName: 'DRPC Server'}),
  365. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  366. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  367. App.ServiceConfigCategory.create({ name: 'Advanced storm-site', displayName: 'Custom storm.yaml', siteFileName: 'storm-site.xml', canAddProperty: true}),
  368. App.ServiceConfigCategory.create({ name: 'Advanced storm-env', displayName: 'storm-env.sh content', siteFileName: 'storm-env.xml', canAddProperty: false})
  369. ]);
  370. break;
  371. case 'TEZ':
  372. serviceConfigCategories.pushObjects([
  373. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  374. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  375. App.ServiceConfigCategory.create({ name: 'Advanced tez-site', displayName: 'Custom tez-site.xml', siteFileName: 'tez-site.xml', canAddProperty: true}),
  376. App.ServiceConfigCategory.create({ name: 'Advanced tez-env', displayName: 'tez-env.sh content', siteFileName: 'tez-env.xml', canAddProperty: false})
  377. ]);
  378. break;
  379. case 'FLUME':
  380. serviceConfigCategories.pushObjects([
  381. App.ServiceConfigCategory.create({ name: 'FLUME_HANDLER', displayName: 'flume.conf', siteFileName: 'flume-conf', canAddProperty: false})
  382. ]);
  383. break;
  384. case 'SQOOP':
  385. serviceConfigCategories.pushObjects([
  386. App.ServiceConfigCategory.create({ name: 'Advanced sqoop-env', displayName: 'sqoop-env.sh content', siteFileName: 'sqoop-env.xml', canAddProperty: false})
  387. ]);
  388. break;
  389. case 'HCATALOG':
  390. break;
  391. default:
  392. serviceConfigCategories.pushObjects([
  393. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  394. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'})
  395. ]);
  396. var configTypes = Object.keys(this.get('configTypes')).without('core-site').without('global');
  397. configTypes.forEach(function (type) {
  398. var displayName = 'Custom ' + type;
  399. var canAddProperty = true;
  400. var siteFileName = type + '.xml';
  401. if (type.endsWith('-env') || type.endsWith('-log4j')){
  402. var content = this.get('configs').findProperty('name',"content");
  403. if (!content) {
  404. return;
  405. }
  406. canAddProperty = false;
  407. displayName = content.get('description');
  408. }
  409. serviceConfigCategories.pushObject(App.ServiceConfigCategory.create({ name: 'Advanced ' + type, displayName: displayName, siteFileName: siteFileName,
  410. canAddProperty: canAddProperty}));
  411. }, this);
  412. }
  413. return serviceConfigCategories;
  414. };