cluster.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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.User = Em.Object.extend({
  20. username: DS.attr("string")
  21. });
  22. App.User.FIXTURES = [
  23. {},
  24. {}
  25. ];
  26. App.ClusterModel = Em.Object.extend({
  27. clusterName: null,
  28. hosts: [],
  29. services: []
  30. });
  31. // uncomment if column names are camelized in JSON (or fixture), rather than _ separated
  32. /*
  33. DS.Model.reopen({
  34. namingConvention: {
  35. keyToJSONKey: function(key) {
  36. return key;
  37. },
  38. foreignKey: function(key) {
  39. return key;
  40. }
  41. }
  42. });
  43. */
  44. App.Host = DS.Model.extend({
  45. hostName: DS.attr('string'),
  46. cluster: DS.belongsTo('App.Cluster'),
  47. components: DS.hasMany('App.Component'),
  48. cpu: DS.attr('string'),
  49. memory: DS.attr('string'),
  50. diskUsage: DS.attr('string'),
  51. loadAvg: DS.attr('string'),
  52. os: DS.attr('string'),
  53. ip: DS.attr('string'),
  54. isChecked: false,
  55. healthStatus: DS.attr('string'),
  56. workStatus: DS.attr('boolean')
  57. });
  58. App.Host.FIXTURES = [
  59. {
  60. id: 1,
  61. host_name: 'z_host1',
  62. cluster_id: 1,
  63. components:[1, 2, 3, 4],
  64. cpu: '2x2.5GHz',
  65. memory: '8GB',
  66. disk_usage: '40',
  67. load_avg: '0.2, 1.2, 2.4',
  68. ip: '123.123.123.123',
  69. health_status: 'LIVE',
  70. work_status: true
  71. },
  72. {
  73. id: 2,
  74. host_name: 'host2',
  75. cluster_id: 1,
  76. components:[4, 5],
  77. cpu: '2x2.5GHz',
  78. memory: '8GB',
  79. disk_usage: '20',
  80. load_avg: '0.2, 1.2, 2.4',
  81. ip: '255.255.255.255',
  82. health_status: 'DEAD',
  83. work_status: true
  84. },
  85. {
  86. id: 3,
  87. host_name: 'n_host3',
  88. cluster_id: 2,
  89. components:[4, 5, 7],
  90. health_status: 'LIVE',
  91. work_status: false
  92. },
  93. {
  94. id: 4,
  95. host_name: 'b_host4',
  96. cluster_id: 2,
  97. health_status: 'DEAD',
  98. work_status: false
  99. },
  100. {
  101. id: 5,
  102. host_name: 'host5',
  103. cluster_id: 1,
  104. components:[4, 5],
  105. cpu: '2x2.5GHz',
  106. memory: '8GB',
  107. disk_usage: '20',
  108. load_avg: '0.2, 1.2, 2.4',
  109. ip: '255.255.255.255',
  110. health_status: 'DEAD',
  111. work_status: true
  112. },
  113. {
  114. id: 6,
  115. host_name: 'a_host6',
  116. cluster_id: 1,
  117. components:[4, 5],
  118. cpu: '2x2.5GHz',
  119. memory: '8GB',
  120. disk_usage: '20',
  121. load_avg: '0.2, 1.2, 2.4',
  122. ip: '255.255.255.255',
  123. health_status: 'LIVE',
  124. work_status: false
  125. },
  126. {
  127. id: 7,
  128. host_name: 'host7',
  129. cluster_id: 1,
  130. components:[4, 5],
  131. cpu: '2x2.5GHz',
  132. memory: '8GB',
  133. disk_usage: '20',
  134. load_avg: '0.2, 1.2, 2.4',
  135. ip: '255.255.255.255',
  136. health_status: 'LIVE',
  137. work_status: true
  138. }
  139. ];
  140. App.Cluster = DS.Model.extend({
  141. clusterName: DS.attr('string'),
  142. stackName: DS.attr('string'),
  143. hosts: DS.hasMany('App.Host')
  144. });
  145. App.Cluster.FIXTURES = [
  146. {
  147. id: 1,
  148. cluster_name: 'cluster1',
  149. stack_name: 'HDP',
  150. hosts: [1, 2]
  151. },
  152. {
  153. id: 2,
  154. cluster_name: 'cluster2',
  155. stack_name: 'BigTop',
  156. hosts: [3]
  157. }
  158. ];