service.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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. isDisabled: '',
  24. isHidden: '',
  25. isSelected: 'true',
  26. description: ''
  27. });
  28. /*App.User = Em.Object.extend({
  29. username: null
  30. });*/
  31. App.ServiceModel = Em.Object.extend({
  32. name:null,
  33. components:[]
  34. });
  35. // uncomment if column names are camelized in JSON (or fixture), rather than _ separated
  36. /*
  37. DS.Model.reopen({
  38. namingConvention: {
  39. keyToJSONKey: function(key) {
  40. return key;
  41. },
  42. foreignKey: function(key) {
  43. return key;
  44. }
  45. }
  46. });
  47. */
  48. App.Component = DS.Model.extend({
  49. componentName:DS.attr('string'),
  50. label:DS.attr('string'),
  51. type:DS.attr('boolean'),
  52. service:DS.belongsTo('App.Service'),
  53. host:DS.belongsTo('App.Host'),
  54. workStatus:DS.attr('string')
  55. });
  56. App.Component.FIXTURES = [
  57. {
  58. id:1,
  59. component_name:'NameNode',
  60. label: 'NN',
  61. type: true,
  62. service_id:1,
  63. host_id:1,
  64. work_status:true
  65. },
  66. {
  67. id:2,
  68. component_name:'SNameNode',
  69. label: 'SNN',
  70. type: true,
  71. service_id:1,
  72. host_id:2,
  73. work_status:false
  74. },
  75. {
  76. id:3,
  77. component_name:'DataNode',
  78. label: 'DN',
  79. service_id:1,
  80. type: false,
  81. host_id:2
  82. },
  83. {
  84. id:4,
  85. component_name:'JobTracker',
  86. label: 'TT',
  87. type: true,
  88. service_id:2,
  89. host_id:4,
  90. work_status:true
  91. },
  92. {
  93. id:5,
  94. component_name:'TaskTracker',
  95. label: 'JT',
  96. type: false,
  97. service_id:2,
  98. host_id:4
  99. },
  100. {
  101. id:6,
  102. component_name:'HBase Master',
  103. label: 'HBM',
  104. type: true,
  105. service_id:3,
  106. host_id:4
  107. },
  108. {
  109. id:7,
  110. component_name:'Region Server',
  111. label: 'RS',
  112. type: false,
  113. service_id:3,
  114. host_id:2
  115. }
  116. ];
  117. App.Service = DS.Model.extend({
  118. serviceName: DS.attr('string'),
  119. label: DS.attr('string'),
  120. components: DS.hasMany('App.Component'),
  121. serviceAudit: DS.hasMany('App.ServiceAudit'),
  122. healthStatus: DS.attr('string'),
  123. workStatus: DS.attr('boolean'),
  124. alerts: DS.hasMany('App.Alert'),
  125. quickLinks: DS.hasMany('App.QuickLinks')
  126. });
  127. App.Service.FIXTURES = [
  128. {
  129. id:1,
  130. service_name:'hdfs',
  131. label:'HDFS',
  132. components: [1, 2, 3],
  133. service_audit: [1, 2, 3],
  134. health_status: 'LIVE',
  135. work_status: true,
  136. alerts: [1, 2],
  137. quick_links: [1, 2, 3, 4]
  138. },
  139. {
  140. id:2,
  141. service_name:'mapreduce',
  142. label:'MapReduce',
  143. components: [4, 5],
  144. service_audit: [4, 5, 6],
  145. health_status: 'LIVE',
  146. work_status: true,
  147. alerts: [3, 4],
  148. quick_links: [5, 6, 7, 8, 9, 10]
  149. },
  150. {
  151. id:3,
  152. service_name:'hbase',
  153. label:'HBase',
  154. components: [6, 7],
  155. health_status: 'DEAD',
  156. work_status: false,
  157. alerts: [5, 6],
  158. quick_links: [11, 12, 13, 14]
  159. },
  160. {
  161. id:4,
  162. service_name:'zookeeper',
  163. label:'Zookeeper',
  164. health_status: 'DEAD',
  165. work_status: false,
  166. alerts: [7, 8]
  167. },
  168. {
  169. id:5,
  170. service_name:'oozie',
  171. label:'Oozie',
  172. health_status: 'DEAD',
  173. work_status: false,
  174. alerts: [9, 10]
  175. },
  176. {
  177. id:6,
  178. service_name:'hive',
  179. label:'Hive',
  180. health_status: 'DEAD',
  181. work_status: false,
  182. alerts: [11, 12]
  183. }
  184. ];
  185. App.QuickLinks = DS.Model.extend({
  186. label: DS.attr('string'),
  187. url: DS.attr('string')
  188. });
  189. App.QuickLinks.FIXTURES = [
  190. {
  191. id: 1,
  192. label: 'NameNode UI',
  193. url: ''
  194. },
  195. {
  196. id: 2,
  197. label: 'NameNode logs',
  198. url: ''
  199. },
  200. {
  201. id: 3,
  202. label: 'NameNode JMX',
  203. url: ''
  204. },
  205. {
  206. id: 4,
  207. label: 'Thread Stacks',
  208. url: ''
  209. },
  210. {
  211. id: 5,
  212. label: 'JobTracker UI',
  213. url: ''
  214. },
  215. {
  216. id: 6,
  217. label: 'Scheduling Info',
  218. url: ''
  219. },
  220. {
  221. id: 7,
  222. label: 'Running Jobs',
  223. url: ''
  224. },
  225. {
  226. id: 8,
  227. label: 'Retired Jobs',
  228. url: ''
  229. },
  230. {
  231. id: 9,
  232. label: 'JobHistory Server',
  233. url: ''
  234. },
  235. {
  236. id: 10,
  237. label: 'JobTracker Logs',
  238. url: ''
  239. },
  240. {
  241. id: 11,
  242. label: 'HBase Master UI',
  243. url: ''
  244. },
  245. {
  246. id: 12,
  247. label: 'HBase Logs',
  248. url: ''
  249. },
  250. {
  251. id: 13,
  252. label: 'Zookeeper Info',
  253. url: ''
  254. },
  255. {
  256. id: 14,
  257. label: 'HBase Master JMX',
  258. url: ''
  259. }
  260. ];