service.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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 = Em.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('boolean')
  57. });
  58. App.Component.FIXTURES = [
  59. {
  60. id:1,
  61. component_name:'NameNode',
  62. label: 'NN',
  63. type: true,
  64. service_id:1,
  65. host_id:1,
  66. work_status:false
  67. },
  68. {
  69. id:2,
  70. component_name:'SNameNode',
  71. label: 'SNN',
  72. type: true,
  73. service_id:1,
  74. host_id:2,
  75. work_status:true
  76. },
  77. {
  78. id:3,
  79. component_name:'DataNode',
  80. label: 'DN',
  81. service_id:1,
  82. type: false,
  83. host_id:2,
  84. work_status:true
  85. },
  86. {
  87. id:4,
  88. component_name:'JobTracker',
  89. label: 'JT',
  90. type: true,
  91. service_id:2,
  92. host_id:4,
  93. work_status:true
  94. },
  95. {
  96. id:5,
  97. component_name:'TaskTracker',
  98. label: 'TT',
  99. type: false,
  100. service_id:2,
  101. host_id:4,
  102. work_status:true
  103. },
  104. {
  105. id:6,
  106. component_name:'HBase Master',
  107. label: 'HBM',
  108. type: true,
  109. service_id:3,
  110. host_id:4,
  111. work_status:true
  112. },
  113. {
  114. id:7,
  115. component_name:'Region Server',
  116. label: 'RS',
  117. type: false,
  118. service_id:3,
  119. host_id:2,
  120. work_status:true
  121. }
  122. ];
  123. App.Service = DS.Model.extend({
  124. serviceName: DS.attr('string'),
  125. label: DS.attr('string'),
  126. components: DS.hasMany('App.Component'),
  127. serviceAudit: DS.hasMany('App.ServiceAudit'),
  128. healthStatus: DS.attr('string'),
  129. workStatus: DS.attr('boolean'),
  130. alerts: DS.hasMany('App.Alert'),
  131. quickLinks: DS.hasMany('App.QuickLinks')
  132. });
  133. App.Service.Health = {
  134. live: "LIVE",
  135. dead: "DEAD",
  136. start: "STARTING",
  137. stop: "STOPPING"
  138. }
  139. App.Service.FIXTURES = [
  140. {
  141. id:1,
  142. service_name:'hdfs',
  143. label:'HDFS',
  144. components: [1, 2, 3],
  145. service_audit: [1, 2, 3],
  146. health_status: 'LIVE',
  147. work_status: true,
  148. alerts: [1, 2],
  149. quick_links: [1, 2, 3, 4]
  150. },
  151. {
  152. id:2,
  153. service_name:'mapreduce',
  154. label:'MapReduce',
  155. components: [4, 5],
  156. service_audit: [4, 5, 6],
  157. health_status: 'STARTING',
  158. work_status: true,
  159. alerts: [3, 4],
  160. quick_links: [5, 6, 7, 8, 9, 10]
  161. },
  162. {
  163. id:3,
  164. service_name:'hbase',
  165. label:'HBase',
  166. components: [6, 7],
  167. health_status: 'DEAD',
  168. work_status: false,
  169. alerts: [5, 6],
  170. quick_links: [11, 12, 13, 14]
  171. },
  172. {
  173. id:4,
  174. service_name:'zookeeper',
  175. label:'Zookeeper',
  176. health_status: 'STOPPING',
  177. work_status: false,
  178. alerts: [7, 8]
  179. },
  180. {
  181. id:5,
  182. service_name:'oozie',
  183. label:'Oozie',
  184. health_status: 'DEAD',
  185. work_status: false,
  186. alerts: [9, 10]
  187. },
  188. {
  189. id:6,
  190. service_name:'hive',
  191. label:'Hive',
  192. health_status: 'DEAD',
  193. work_status: false,
  194. alerts: [11, 12]
  195. }
  196. ];
  197. App.QuickLinks = DS.Model.extend({
  198. label: DS.attr('string'),
  199. url: DS.attr('string')
  200. });
  201. App.QuickLinks.FIXTURES = [
  202. {
  203. id: 1,
  204. label: 'NameNode UI',
  205. url: ''
  206. },
  207. {
  208. id: 2,
  209. label: 'NameNode logs',
  210. url: ''
  211. },
  212. {
  213. id: 3,
  214. label: 'NameNode JMX',
  215. url: ''
  216. },
  217. {
  218. id: 4,
  219. label: 'Thread Stacks',
  220. url: ''
  221. },
  222. {
  223. id: 5,
  224. label: 'JobTracker UI',
  225. url: ''
  226. },
  227. {
  228. id: 6,
  229. label: 'Scheduling Info',
  230. url: ''
  231. },
  232. {
  233. id: 7,
  234. label: 'Running Jobs',
  235. url: ''
  236. },
  237. {
  238. id: 8,
  239. label: 'Retired Jobs',
  240. url: ''
  241. },
  242. {
  243. id: 9,
  244. label: 'JobHistory Server',
  245. url: ''
  246. },
  247. {
  248. id: 10,
  249. label: 'JobTracker Logs',
  250. url: ''
  251. },
  252. {
  253. id: 11,
  254. label: 'HBase Master UI',
  255. url: ''
  256. },
  257. {
  258. id: 12,
  259. label: 'HBase Logs',
  260. url: ''
  261. },
  262. {
  263. id: 13,
  264. label: 'Zookeeper Info',
  265. url: ''
  266. },
  267. {
  268. id: 14,
  269. label: 'HBase Master JMX',
  270. url: ''
  271. }
  272. ];