stack_service.js 23 KB

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