yarn-app.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import Converter from 'yarn-ui/utils/converter';
  2. import DS from 'ember-data';
  3. export default DS.Model.extend({
  4. appName: DS.attr('string'),
  5. user: DS.attr('string'),
  6. queue: DS.attr('string'),
  7. state: DS.attr('string'),
  8. startTime: DS.attr('string'),
  9. elapsedTime: DS.attr('string'),
  10. finalStatus: DS.attr('string'),
  11. finishedTime: DS.attr('finishedTime'),
  12. progress: DS.attr('number'),
  13. diagnostics: DS.attr('string'),
  14. amContainerLogs: DS.attr('string'),
  15. amHostHttpAddress: DS.attr('string'),
  16. logAggregationStatus: DS.attr('string'),
  17. unmanagedApplication: DS.attr('string'),
  18. amNodeLabelExpression: DS.attr('string'),
  19. applicationTags: DS.attr('string'),
  20. priority: DS.attr('number'),
  21. allocatedMB: DS.attr('number'),
  22. allocatedVCores: DS.attr('number'),
  23. runningContainers: DS.attr('number'),
  24. memorySeconds: DS.attr('number'),
  25. vcoreSeconds: DS.attr('number'),
  26. preemptedResourceMB: DS.attr('number'),
  27. preemptedResourceVCores: DS.attr('number'),
  28. numNonAMContainerPreempted: DS.attr('number'),
  29. numAMContainerPreempted: DS.attr('number'),
  30. isFailed: function() {
  31. return this.get('finalStatus') == "FAILED"
  32. }.property("finalStatus"),
  33. allocatedResource: function() {
  34. return Converter.resourceToString(this.get("allocatedMB"), this.get("allocatedVCores"));
  35. }.property("allocatedMB", "allocatedVCores"),
  36. preemptedResource: function() {
  37. return Converter.resourceToString(this.get("preemptedResourceMB"), this.get("preemptedResourceVCores"));
  38. }.property("preemptedResourceMB", "preemptedResourceVCores"),
  39. aggregatedResourceUsage: function() {
  40. return Converter.resourceToString(this.get("memorySeconds"), this.get("vcoreSeconds")) + " (× Secs)";
  41. }.property("memorySeconds", "vcoreSeconds"),
  42. progressStyle: function() {
  43. return "width: " + this.get("progress") + "%";
  44. }.property("progress"),
  45. finalStatusStyle: function() {
  46. var style = "default";
  47. var finalStatus = this.get("finalStatus");
  48. if (finalStatus == "KILLED") {
  49. style = "warning";
  50. } else if (finalStatus == "FAILED") {
  51. style = "danger";
  52. } else {
  53. style = "success";
  54. }
  55. return "label label-" + style;
  56. }.property("finalStatus")
  57. });