service.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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.ServiceInfo = Ember.Object.extend({
  20. elementId:'service',
  21. serviceName:'',
  22. displayName:'',
  23. isMaster:'',
  24. isClient:'',
  25. isDisabled:'',
  26. isHidden:'',
  27. isSelected:'true',
  28. description:''
  29. });
  30. /*App.User = Em.Object.extend({
  31. username: null
  32. });*/
  33. App.ServiceModel = Em.Object.extend({
  34. name:null,
  35. components:[]
  36. });
  37. // uncomment if column names are camelized in JSON (or fixture), rather than _ separated
  38. /*
  39. DS.Model.reopen({
  40. namingConvention: {
  41. keyToJSONKey: function(key) {
  42. return key;
  43. },
  44. foreignKey: function(key) {
  45. return key;
  46. }
  47. }
  48. });
  49. */
  50. App.Component = DS.Model.extend({
  51. componentName:DS.attr('string'),
  52. label:DS.attr('string'),
  53. type:DS.attr('boolean'),
  54. service:DS.belongsTo('App.Service'),
  55. host:DS.belongsTo('App.Host'),
  56. workStatus:DS.attr('string'),
  57. isMaster:function () {
  58. return this.get('type');
  59. }.property('type'),
  60. isSlave:function () {
  61. return !this.get('type');
  62. }.property('type'),
  63. // checkedForHostFilter: true // this is for host page to set checkboxes checked
  64. decommissioned: DS.attr('boolean')
  65. });
  66. App.Component.Status = {
  67. started:"STARTED",
  68. starting:"STARTING",
  69. stopped:"STOPPED",
  70. stopping:"STOPPING"
  71. }
  72. App.Component.FIXTURES = [
  73. {
  74. id:1,
  75. component_name:'NameNode',
  76. label:'NN',
  77. type:true,
  78. service_id:1,
  79. host_id:1,
  80. work_status:App.Component.Status.stopped
  81. },
  82. {
  83. id:2,
  84. component_name:'SNameNode',
  85. label:'SNN',
  86. type:true,
  87. service_id:1,
  88. host_id:2,
  89. work_status:App.Component.Status.started
  90. },
  91. {
  92. id:3,
  93. component_name:'DataNode',
  94. label:'DN',
  95. service_id:1,
  96. type:false,
  97. host_id:2,
  98. work_status:App.Component.Status.started,
  99. decommissioned: true
  100. },
  101. {
  102. id:4,
  103. component_name:'JobTracker',
  104. label:'JT',
  105. type:true,
  106. service_id:2,
  107. host_id:4,
  108. work_status:App.Component.Status.started
  109. },
  110. {
  111. id:5,
  112. component_name:'TaskTracker',
  113. label:'TT',
  114. type:false,
  115. service_id:2,
  116. host_id:4,
  117. work_status:App.Component.Status.started
  118. },
  119. {
  120. id:6,
  121. component_name:'HBase Master',
  122. label:'HBM',
  123. type:true,
  124. service_id:3,
  125. host_id:4,
  126. work_status:App.Component.Status.started
  127. },
  128. {
  129. id:7,
  130. component_name:'Region Server',
  131. label:'RS',
  132. type:false,
  133. service_id:3,
  134. host_id:2,
  135. work_status:App.Component.Status.started
  136. },
  137. {
  138. id:8,
  139. component_name:'Oozie',
  140. label:'Oz',
  141. type:false,
  142. service_id:5,
  143. host_id:2,
  144. work_status:App.Component.Status.started
  145. }
  146. ];
  147. App.Service = DS.Model.extend({
  148. serviceName:DS.attr('string'),
  149. label:DS.attr('string'),
  150. components:DS.hasMany('App.Component'),
  151. serviceAudit:DS.hasMany('App.ServiceAudit'),
  152. healthStatus:DS.attr('string'),
  153. workStatus:DS.attr('boolean'),
  154. alerts:DS.hasMany('App.Alert'),
  155. quickLinks:DS.hasMany('App.QuickLinks')
  156. });
  157. App.Service.Health = {
  158. live:"LIVE",
  159. dead:"DEAD",
  160. start:"STARTING",
  161. stop:"STOPPING"
  162. }
  163. App.Service.FIXTURES = [
  164. {
  165. id:1,
  166. service_name:'hdfs',
  167. label:'HDFS',
  168. components:[1, 2, 3],
  169. service_audit:[1, 2, 3],
  170. health_status:App.Service.Health.live,
  171. work_status:true,
  172. alerts:[1, 2],
  173. quick_links:[1, 2, 3, 4]
  174. },
  175. {
  176. id:2,
  177. service_name:'mapreduce',
  178. label:'MapReduce',
  179. components:[4, 5],
  180. service_audit:[4, 5, 6],
  181. health_status:App.Service.Health.start,
  182. work_status:true,
  183. alerts:[3, 4],
  184. quick_links:[5, 6, 7, 8, 9, 10, 17, 18]
  185. },
  186. {
  187. id:3,
  188. service_name:'hbase',
  189. label:'HBase',
  190. components:[6, 7],
  191. health_status:App.Service.Health.dead,
  192. work_status:false,
  193. alerts:[5, 6],
  194. quick_links:[11, 12, 13, 14, 15, 16]
  195. },
  196. {
  197. id:4,
  198. service_name:'zookeeper',
  199. label:'ZooKeeper',
  200. health_status:App.Service.Health.stop,
  201. work_status:false,
  202. components:[1, 2, 3],
  203. alerts:[7, 8]
  204. },
  205. {
  206. id:5,
  207. service_name:'oozie',
  208. label:'Oozie',
  209. health_status:App.Service.Health.dead,
  210. work_status:false,
  211. components:[8],
  212. alerts:[9, 10]
  213. },
  214. {
  215. id:6,
  216. service_name:'hive',
  217. label:'Hive + HCatalog',
  218. health_status:App.Service.Health.dead,
  219. work_status:false,
  220. components:[5],
  221. alerts:[11, 12]
  222. }
  223. ];
  224. App.QuickLinks = DS.Model.extend({
  225. label:DS.attr('string'),
  226. url:DS.attr('string')
  227. });
  228. App.QuickLinks.FIXTURES = [
  229. {
  230. id:1,
  231. label:'NameNode UI',
  232. url:'http://%@:50070/dfshealth.jsp'
  233. },
  234. {
  235. id:2,
  236. label:'NameNode logs',
  237. url:'http://%@:50070/logs'
  238. },
  239. {
  240. id:3,
  241. label:'NameNode JMX',
  242. url:'http://%@:50070/jmx'
  243. },
  244. {
  245. id:4,
  246. label:'Thread Stacks',
  247. url:'http://%@:50070/stacks'
  248. },
  249. {
  250. id:5,
  251. label:'JobTracker UI',
  252. url:'http://%@:50030/jobtracker.jsp'
  253. },
  254. {
  255. id:6,
  256. label:'Scheduling Info',
  257. url:'http://%@:50030/scheduler'
  258. },
  259. {
  260. id:7,
  261. label:'Running Jobs',
  262. url:'http://%@:50030/jobtracker.jsp#running_jobs'
  263. },
  264. {
  265. id:8,
  266. label:'Retired Jobs',
  267. url:'http://%@:50030/jobtracker.jsp#retired_jobs'
  268. },
  269. {
  270. id:9,
  271. label:'JobHistory Server',
  272. url:'http://%@:51111/jobhistoryhome.jsp'
  273. },
  274. {
  275. id:10,
  276. label:'JobTracker Logs',
  277. url:'http://%@:50030/logs'
  278. },
  279. {
  280. id:11,
  281. label:'HBase Master UI',
  282. url:'http://%@:60010/master-status'
  283. },
  284. {
  285. id:12,
  286. label:'HBase Logs',
  287. url:'http://%@:60010/logs'
  288. },
  289. {
  290. id:13,
  291. label:'Zookeeper Info',
  292. url:'http://%@:60010/zk.jsp'
  293. },
  294. {
  295. id:14,
  296. label:'HBase Master JMX',
  297. url:'http://%@:60010/jmx'
  298. },
  299. {
  300. id:15,
  301. label:'Debug Dump',
  302. url:'http://%@:60010/dump'
  303. },
  304. {
  305. id:16,
  306. label:'Thread Stacks',
  307. url:'http://%@:60010/stacks'
  308. },
  309. {
  310. id:17,
  311. label:'JobTracker JMX',
  312. url:'http://%@:50030/jmx'
  313. },
  314. {
  315. id:18,
  316. label:'Thread Stacks',
  317. url:'http://%@:50030/stacks'
  318. }
  319. ];