cluster-metric.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import DS from 'ember-data';
  2. export default DS.Model.extend({
  3. appsSubmitted: DS.attr('number'),
  4. appsCompleted: DS.attr('number'),
  5. appsPending: DS.attr('number'),
  6. appsRunning: DS.attr('number'),
  7. appsFailed: DS.attr('number'),
  8. appsKilled: DS.attr('number'),
  9. reservedMB: DS.attr('number'),
  10. availableMB: DS.attr('number'),
  11. allocatedMB: DS.attr('number'),
  12. reservedVirtualCores: DS.attr('number'),
  13. availableVirtualCores: DS.attr('number'),
  14. allocatedVirtualCores: DS.attr('number'),
  15. containersAllocated: DS.attr('number'),
  16. containersReserved: DS.attr('number'),
  17. containersPending: DS.attr('number'),
  18. totalMB: DS.attr('number'),
  19. totalVirtualCores: DS.attr('number'),
  20. totalNodes: DS.attr('number'),
  21. lostNodes: DS.attr('number'),
  22. unhealthyNodes: DS.attr('number'),
  23. decommissionedNodes: DS.attr('number'),
  24. rebootedNodes: DS.attr('number'),
  25. activeNodes: DS.attr('number'),
  26. getFinishedAppsDataForDonutChart: function() {
  27. var arr = [];
  28. arr.push({
  29. label: "Completed",
  30. value: this.get("appsCompleted")
  31. });
  32. arr.push({
  33. label: "Killed",
  34. value: this.get("appsKilled")
  35. });
  36. arr.push({
  37. label: "Failed",
  38. value: this.get("appsFailed")
  39. });
  40. return arr;
  41. }.property("appsCompleted", "appsKilled", "appsFailed"),
  42. getRunningAppsDataForDonutChart: function() {
  43. var arr = [];
  44. arr.push({
  45. label: "Pending",
  46. value: this.get("appsPending")
  47. });
  48. arr.push({
  49. label: "Running",
  50. value: this.get("appsRunning")
  51. });
  52. return arr;
  53. }.property("appsPending", "appsRunning"),
  54. getNodesDataForDonutChart: function() {
  55. var arr = [];
  56. arr.push({
  57. label: "Active",
  58. value: this.get("activeNodes")
  59. });
  60. arr.push({
  61. label: "Unhealthy",
  62. value: this.get("unhealthyNodes")
  63. });
  64. arr.push({
  65. label: "Decomissioned",
  66. value: this.get("decommissionedNodes")
  67. });
  68. return arr;
  69. }.property("activeNodes", "unhealthyNodes", "decommissionedNodes"),
  70. getMemoryDataForDonutChart: function() {
  71. var type = "MB";
  72. var arr = [];
  73. arr.push({
  74. label: "Allocated",
  75. value: this.get("allocated" + type)
  76. });
  77. arr.push({
  78. label: "Reserved",
  79. value: this.get("reserved" + type)
  80. });
  81. arr.push({
  82. label: "Available",
  83. value: this.get("available" + type)
  84. });
  85. return arr;
  86. }.property("allocatedMB", "reservedMB", "availableMB"),
  87. getVCoreDataForDonutChart: function() {
  88. var type = "VirtualCores";
  89. var arr = [];
  90. arr.push({
  91. label: "Allocated",
  92. value: this.get("allocated" + type)
  93. });
  94. arr.push({
  95. label: "Reserved",
  96. value: this.get("reserved" + type)
  97. });
  98. arr.push({
  99. label: "Available",
  100. value: this.get("available" + type)
  101. });
  102. return arr;
  103. }.property("allocatedVirtualCores", "reservedVirtualCores", "availableVirtualCores"),
  104. });