upgrade_entity.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. /**
  19. * @type {Ember.Object}
  20. * @class
  21. */
  22. App.upgradeEntity = Em.Object.extend({
  23. /**
  24. * type of entity "GROUP", "ITEM", "TASK"
  25. * @type {string}
  26. */
  27. type: null,
  28. /**
  29. * @type {boolean}
  30. */
  31. isExpanded: false,
  32. /**
  33. * @type {boolean}
  34. */
  35. isRunning: function () {
  36. return ['IN_PROGRESS'].contains(this.get('status'));
  37. }.property('status'),
  38. /**
  39. * width style of progress bar
  40. * @type {string}
  41. */
  42. progressWidth: function () {
  43. return "width:" + Math.floor(this.get('progress')) + '%;';
  44. }.property('progress'),
  45. /**
  46. * @type {number}
  47. */
  48. progress: function () {
  49. return Math.floor(this.get('progress_percent'));
  50. }.property('progress_percent'),
  51. /**
  52. * indicate whether entity has active link
  53. * @type {boolean}
  54. */
  55. isActive: function () {
  56. return this.get('status') !== 'PENDING';
  57. }.property('status')
  58. });