stack_service.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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. 'MAPREDUCE',
  186. 'MAPREDUCE2',
  187. 'YARN',
  188. 'TEZ',
  189. 'NAGIOS',
  190. 'GANGLIA',
  191. 'HIVE',
  192. 'HCATALOG',
  193. 'WEBHCAT',
  194. 'HBASE',
  195. 'PIG',
  196. 'SQOOP',
  197. 'OOZIE',
  198. 'ZOOKEEPER',
  199. 'HUE',
  200. 'FALCON',
  201. 'STORM',
  202. 'FLUME'
  203. ];
  204. App.StackService.dependency = {
  205. 'HDP-1': {
  206. 'MAPREDUCE': ['PIG', 'OOZIE', 'HIVE'],
  207. 'ZOOKEEPER': ['HBASE', 'HIVE', 'WEBHCAT']
  208. },
  209. 'HDP-2': {
  210. 'YARN': ['PIG', 'OOZIE', 'HIVE', 'TEZ'],
  211. 'TEZ': ['YARN'],
  212. 'OOZIE': ['FALCON'],
  213. 'ZOOKEEPER': ['HDFS', 'HBASE', 'HIVE', 'WEBHCAT', 'STORM']
  214. }
  215. };
  216. //@TODO: Write unit test for no two keys in the object should have any intersecting elements in their values
  217. App.StackService.coSelected = {
  218. 'YARN': ['MAPREDUCE2'],
  219. 'HIVE': ['HCATALOG', 'WEBHCAT']
  220. };
  221. App.StackService.reviewPageHandlers = {
  222. 'HIVE': {
  223. 'Database': 'loadHiveDbValue'
  224. },
  225. 'NAGIOS': {
  226. 'Administrator': 'loadNagiosAdminValue'
  227. },
  228. 'OOZIE': {
  229. 'Database': 'loadOozieDbValue'
  230. }
  231. };
  232. //TODO after moving validation/recommendation to BE defaultConfigsHandler must be deleted
  233. App.StackService.defaultConfigsHandler = {
  234. YARN: {defaultsProviders: [App.YARNDefaultsProvider.create()], configsValidator: App.YARNConfigsValidator},
  235. MAPREDUCE2: {defaultsProviders: [App.YARNDefaultsProvider.create()], configsValidator: App.MapReduce2ConfigsValidator},
  236. HIVE: {defaultsProviders: [App.HiveDefaultsProvider.create()], configsValidator: App.HiveConfigsValidator},
  237. STORM: {defaultsProviders: [App.STORMDefaultsProvider.create()], configsValidator: App.STORMConfigsValidator},
  238. TEZ: {defaultsProviders: [App.TezDefaultsProvider.create()], configsValidator: App.TezConfigsValidator}
  239. };
  240. App.StackService.configCategories = function () {
  241. var serviceConfigCategories = [];
  242. switch (this.get('serviceName')) {
  243. case 'HDFS':
  244. serviceConfigCategories.pushObjects([
  245. App.ServiceConfigCategory.create({ name: 'NAMENODE', displayName: 'NameNode'}),
  246. App.ServiceConfigCategory.create({ name: 'SECONDARY_NAMENODE', displayName: 'Secondary NameNode'}),
  247. App.ServiceConfigCategory.create({ name: 'DATANODE', displayName: 'DataNode'}),
  248. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  249. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  250. App.ServiceConfigCategory.create({ name: 'Advanced core-site', displayName: 'Custom core-site.xml', siteFileName: 'core-site.xml', canAddProperty: true}),
  251. App.ServiceConfigCategory.create({ name: 'Advanced hdfs-site', displayName: 'Custom hdfs-site.xml', siteFileName: 'hdfs-site.xml', canAddProperty: true}),
  252. App.ServiceConfigCategory.create({ name: 'Advanced hdfs-log4j', displayName: 'Custom log4j.properties', siteFileName: 'hdfs-log4j.xml', canAddProperty: false}),
  253. App.ServiceConfigCategory.create({ name: 'Advanced hadoop-env', displayName: 'hadoop-env.sh content', siteFileName: 'hadoop-env.xml', canAddProperty: false})
  254. ]);
  255. break;
  256. case 'GLUSTERFS':
  257. serviceConfigCategories.pushObjects([
  258. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  259. App.ServiceConfigCategory.create({ name: 'Advanced core-site', displayName : 'Custom core-site.xml', siteFileName: 'core-site.xml', canAddProperty: true})
  260. ]);
  261. break;
  262. case 'MAPREDUCE':
  263. serviceConfigCategories.pushObjects([
  264. App.ServiceConfigCategory.create({ name: 'HISTORYSERVER', displayName: 'History Server'}),
  265. App.ServiceConfigCategory.create({ name: 'JOBTRACKER', displayName: 'JobTracker'}),
  266. App.ServiceConfigCategory.create({ name: 'TASKTRACKER', displayName: 'TaskTracker'}),
  267. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  268. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  269. App.ServiceConfigCategory.create({ name: 'Advanced mapred-site', displayName: 'Custom mapred-site.xml', siteFileName: 'mapred-site.xml', canAddProperty: true}),
  270. App.ServiceConfigCategory.create({ name: 'Advanced mapreduce-log4j', displayName: 'Custom log4j.properties', siteFileName: 'mapreduce-log4j.xml', canAddProperty: false}),
  271. App.ServiceConfigCategory.create({ name: 'Advanced mapred-env', displayName: 'mapred-env.sh content', siteFileName: 'mapred-env.xml', canAddProperty: false})
  272. ]);
  273. break;
  274. case 'YARN':
  275. serviceConfigCategories.pushObjects([
  276. App.ServiceConfigCategory.create({ name: 'RESOURCEMANAGER', displayName: 'Resource Manager'}),
  277. App.ServiceConfigCategory.create({ name: 'NODEMANAGER', displayName: 'Node Manager'}),
  278. App.ServiceConfigCategory.create({ name: 'APP_TIMELINE_SERVER', displayName: 'Application Timeline Server'}),
  279. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  280. 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}),
  281. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  282. App.ServiceConfigCategory.create({ name: 'Advanced yarn-site', displayName: 'Custom yarn-site.xml', siteFileName: 'yarn-site.xml', canAddProperty: true}),
  283. App.ServiceConfigCategory.create({ name: 'Advanced yarn-log4j', displayName: 'Custom log4j.properties', siteFileName: 'yarn-log4j.xml', canAddProperty: false}),
  284. App.ServiceConfigCategory.create({ name: 'Advanced yarn-env', displayName: 'yarn-env.sh content', siteFileName: 'yarn-env.xml', canAddProperty: false})
  285. ]);
  286. break;
  287. case 'MAPREDUCE2':
  288. serviceConfigCategories.pushObjects([
  289. App.ServiceConfigCategory.create({ name: 'HISTORYSERVER', displayName: 'History Server'}),
  290. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  291. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  292. App.ServiceConfigCategory.create({ name: 'AdvancedMapredSite', displayName: 'Custom mapred-site.xml', siteFileName: 'mapred-site.xml', canAddProperty: true}),
  293. App.ServiceConfigCategory.create({ name: 'Advanced mapred-env', displayName: 'mapred-env.sh content', siteFileName: 'mapred-env.xml', canAddProperty: false})
  294. ]);
  295. break;
  296. case 'HIVE':
  297. serviceConfigCategories.pushObjects([
  298. App.ServiceConfigCategory.create({ name: 'HIVE_METASTORE', displayName: 'Hive Metastore'}),
  299. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  300. App.ServiceConfigCategory.create({ name: 'Advanced hive-site', displayName: 'Custom hive-site.xml', siteFileName: 'hive-site.xml', canAddProperty: true}),
  301. App.ServiceConfigCategory.create({ name: 'Advanced hive-log4j', displayName: 'Custom log4j.properties', siteFileName: 'hive-log4j.xml', canAddProperty: false}),
  302. App.ServiceConfigCategory.create({ name: 'Advanced hive-exec-log4j', displayName: 'Custom hive-exec-log4j', siteFileName: 'hive-exec-log4j.xml', canAddProperty: false}),
  303. App.ServiceConfigCategory.create({ name: 'Advanced hive-env', displayName: 'hive-env.sh content', siteFileName: 'hive-env.xml', canAddProperty: false})
  304. ]);
  305. break;
  306. case 'WEBHCAT':
  307. serviceConfigCategories.pushObjects([
  308. App.ServiceConfigCategory.create({ name: 'WEBHCAT_SERVER', displayName: 'WebHCat Server'}),
  309. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  310. App.ServiceConfigCategory.create({ name: 'Advanced webhcat-site', displayName: 'Custom webhcat-site.xml', siteFileName: 'webhcat-site.xml', canAddProperty: true}),
  311. App.ServiceConfigCategory.create({ name: 'Advanced webhcat-env', displayName: 'webhcat-env.sh content', siteFileName: 'webhcat-env.xml', canAddProperty: false})
  312. ]);
  313. break;
  314. case 'HBASE':
  315. serviceConfigCategories.pushObjects([
  316. App.ServiceConfigCategory.create({ name: 'HBASE_MASTER', displayName: 'HBase Master'}),
  317. App.ServiceConfigCategory.create({ name: 'HBASE_REGIONSERVER', displayName: 'RegionServer'}),
  318. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  319. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  320. App.ServiceConfigCategory.create({ name: 'Advanced hbase-site', displayName: 'Custom hbase-site.xml', siteFileName: 'hbase-site.xml', canAddProperty: true}),
  321. App.ServiceConfigCategory.create({ name: 'Advanced hbase-log4j', displayName: 'Custom log4j.properties', siteFileName: 'hbase-log4j.xml', canAddProperty: false}),
  322. App.ServiceConfigCategory.create({ name: 'Advanced hbase-env', displayName: 'hbase-env.sh content', siteFileName: 'hbase-env.xml', canAddProperty: false})
  323. ]);
  324. break;
  325. case 'ZOOKEEPER':
  326. serviceConfigCategories.pushObjects([
  327. App.ServiceConfigCategory.create({ name: 'ZOOKEEPER_SERVER', displayName: 'ZooKeeper Server'}),
  328. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  329. App.ServiceConfigCategory.create({ name: 'Advanced zookeeper-log4j', displayName: 'Custom log4j.properties', siteFileName: 'zookeeper-log4j.xml', canAddProperty: false}),
  330. App.ServiceConfigCategory.create({ name: 'Advanced zoo.cfg', displayName: 'Custom zoo.cfg', siteFileName: 'zoo.cfg', canAddProperty: true}),
  331. App.ServiceConfigCategory.create({ name: 'Advanced zookeeper-env', displayName: 'zookeeper-env.sh content', siteFileName: 'zookeeper-env.xml', canAddProperty: false})
  332. ]);
  333. break;
  334. case 'OOZIE':
  335. serviceConfigCategories.pushObjects([
  336. App.ServiceConfigCategory.create({ name: 'OOZIE_SERVER', displayName: 'Oozie Server'}),
  337. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  338. App.ServiceConfigCategory.create({ name: 'Advanced oozie-site', displayName: 'Custom oozie-site.xml', siteFileName: 'oozie-site.xml', canAddProperty: true}),
  339. App.ServiceConfigCategory.create({ name: 'Advanced oozie-log4j', displayName: 'Custom log4j.properties', siteFileName: 'oozie-log4j.xml', canAddProperty: false}),
  340. App.ServiceConfigCategory.create({ name: 'Advanced oozie-env', displayName: 'oozie-env.sh content', siteFileName: 'oozie-env.xml', canAddProperty: false})
  341. ]);
  342. break;
  343. case 'PIG':
  344. serviceConfigCategories.pushObjects([
  345. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Custom pig.properties', siteFileName: 'pig-properties.xml', canAddProperty: false}),
  346. App.ServiceConfigCategory.create({ name: 'Advanced pig-log4j', displayName: 'Custom log4j.properties', siteFileName: 'pig-log4j.xml', canAddProperty: false}),
  347. App.ServiceConfigCategory.create({ name: 'Advanced pig-env', displayName: 'pig-env.sh content', siteFileName: 'pig-env.xml', canAddProperty: false})
  348. ]);
  349. break;
  350. case 'FALCON':
  351. serviceConfigCategories.pushObjects([
  352. App.ServiceConfigCategory.create({ name: 'FALCON_SERVER', displayName: 'Falcon Server'}),
  353. App.ServiceConfigCategory.create({ name: 'Falcon - Oozie integration', displayName: 'Falcon - Oozie integration'}),
  354. App.ServiceConfigCategory.create({ name: 'FalconStartupSite', displayName: 'Falcon startup.properties'}),
  355. App.ServiceConfigCategory.create({ name: 'FalconRuntimeSite', displayName: 'Falcon runtime.properties'}),
  356. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  357. App.ServiceConfigCategory.create({ name: 'Advanced falcon-startup.properties', displayName: 'Custom startup.properties', siteFileName: 'falcon-startup.properties.xml', canAddProperty: true}),
  358. App.ServiceConfigCategory.create({ name: 'Advanced falcon-runtime.properties', displayName: 'Custom runtime.properties', siteFileName: 'falcon-runtime.properties.xml', canAddProperty: true}),
  359. App.ServiceConfigCategory.create({ name: 'Advanced falcon-env', displayName: 'falcon-env.sh content', siteFileName: 'falcon-env.xml', canAddProperty: false})
  360. ]);
  361. break;
  362. case 'STORM':
  363. serviceConfigCategories.pushObjects([
  364. App.ServiceConfigCategory.create({ name: 'NIMBUS', displayName: 'Nimbus'}),
  365. App.ServiceConfigCategory.create({ name: 'SUPERVISOR', displayName: 'Supervisor'}),
  366. App.ServiceConfigCategory.create({ name: 'STORM_UI_SERVER', displayName: 'Storm UI Server'}),
  367. App.ServiceConfigCategory.create({ name: 'STORM_REST_API', displayName: 'Storm REST API Server'}),
  368. App.ServiceConfigCategory.create({ name: 'DRPC_SERVER', displayName: 'DRPC Server'}),
  369. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  370. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  371. App.ServiceConfigCategory.create({ name: 'Advanced storm-site', displayName: 'Custom storm.yaml', siteFileName: 'storm-site.xml', canAddProperty: true}),
  372. App.ServiceConfigCategory.create({ name: 'Advanced storm-env', displayName: 'storm-env.sh content', siteFileName: 'storm-env.xml', canAddProperty: false})
  373. ]);
  374. break;
  375. case 'TEZ':
  376. serviceConfigCategories.pushObjects([
  377. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  378. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'}),
  379. App.ServiceConfigCategory.create({ name: 'Advanced tez-site', displayName: 'Custom tez-site.xml', siteFileName: 'tez-site.xml', canAddProperty: true}),
  380. App.ServiceConfigCategory.create({ name: 'Advanced tez-env', displayName: 'tez-env.sh content', siteFileName: 'tez-env.xml', canAddProperty: false})
  381. ]);
  382. break;
  383. case 'FLUME':
  384. serviceConfigCategories.pushObjects([
  385. App.ServiceConfigCategory.create({ name: 'FLUME_HANDLER', displayName: 'flume.conf', siteFileName: 'flume-conf', canAddProperty: false})
  386. ]);
  387. break;
  388. case 'SQOOP':
  389. serviceConfigCategories.pushObjects([
  390. App.ServiceConfigCategory.create({ name: 'Advanced sqoop-env', displayName: 'sqoop-env.sh content', siteFileName: 'sqoop-env.xml', canAddProperty: false})
  391. ]);
  392. break;
  393. case 'HCATALOG':
  394. break;
  395. default:
  396. serviceConfigCategories.pushObjects([
  397. App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
  398. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'})
  399. ]);
  400. var configTypes = Object.keys(this.get('configTypes')).without('core-site').without('global');
  401. configTypes.forEach(function (type) {
  402. var displayName = 'Custom ' + type;
  403. var canAddProperty = true;
  404. var siteFileName = type + '.xml';
  405. if (type.endsWith('-env') || type.endsWith('-log4j')){
  406. var content = this.get('configs').findProperty('name',"content");
  407. if (!content) {
  408. return;
  409. }
  410. canAddProperty = false;
  411. displayName = content.get('description');
  412. }
  413. serviceConfigCategories.pushObject(App.ServiceConfigCategory.create({ name: 'Advanced ' + type, displayName: displayName, siteFileName: siteFileName,
  414. canAddProperty: canAddProperty}));
  415. }, this);
  416. }
  417. return serviceConfigCategories;
  418. };