service.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. service:DS.belongsTo('App.Service'),
  51. host:DS.belongsTo('App.Host')
  52. });
  53. App.Component.FIXTURES = [
  54. {
  55. id:1,
  56. component_name:'NameNode',
  57. service_id:1,
  58. host_id:1
  59. },
  60. {
  61. id:2,
  62. component_name:'SNameNode',
  63. service_id:1,
  64. host_id:2
  65. },
  66. {
  67. id:3,
  68. component_name:'DataNode',
  69. service_id:1,
  70. host_id:2
  71. },
  72. {
  73. id:4,
  74. component_name:'100Tracker',
  75. service_id:2,
  76. host_id:4
  77. },
  78. {
  79. id:5,
  80. component_name:'jobTaskTracker',
  81. service_id:2,
  82. host_id:4
  83. }
  84. ];
  85. // COMPONENTS:
  86. //- HbaseMaster, 100 Region Servers
  87. //Zookeeper - 3 Zookeeper Servers
  88. //Oozie - Oozie Master
  89. //Hive - Hive Metastore
  90. App.Service = DS.Model.extend({
  91. serviceName:DS.attr('string'),
  92. label:DS.attr('string'),
  93. components:DS.hasMany('App.Component')
  94. });
  95. App.Service.FIXTURES = [
  96. {
  97. id:1,
  98. service_name:'hdfs',
  99. label:'HDFS',
  100. components:[1, 2, 3]
  101. },
  102. {
  103. id:2,
  104. service_name:'mapreduce',
  105. label:'MapReduce',
  106. components:[4, 5]
  107. },
  108. {
  109. id:3,
  110. service_name:'hbase',
  111. label:'HBase'
  112. },
  113. {
  114. id:4,
  115. service_name:'zookeeper',
  116. label:'Zookeeper'
  117. },
  118. {
  119. id:5,
  120. service_name:'oozie',
  121. label:'Oozie'
  122. },
  123. {
  124. id:6,
  125. service_name:'hive',
  126. label:'Hive'
  127. }
  128. ];