upgrade_task_view.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.upgradeTaskView = Em.View.extend({
  20. templateName: require('templates/main/admin/stack_upgrade/upgrade_task'),
  21. /**
  22. * @type {object|null}
  23. */
  24. task: null,
  25. statusIconMap: {
  26. 'COMPLETED': 'icon-ok',
  27. 'WARNING': 'icon-warning-sign',
  28. 'FAILED': 'icon-warning-sign',
  29. 'PENDING': 'icon-cog'
  30. },
  31. /**
  32. * @type {boolean}
  33. */
  34. isManualDone: false,
  35. /**
  36. * @type {string}
  37. */
  38. iconClass: function () {
  39. return this.get('statusIconMap')[this.get('content.status')] || 'icon-question-sign';
  40. }.property('content.status'),
  41. /**
  42. * @type {boolean}
  43. */
  44. isFailed: function () {
  45. return this.get('content.status') === 'FAILED';
  46. }.property('content.status'),
  47. /**
  48. * @type {boolean}
  49. */
  50. isManualOpened: function () {
  51. //TODO modify logic according to actual API
  52. return this.get('content.status') === 'IN_PROGRESS' && this.get('content.type') === 'manual'
  53. }.property('content.status', 'content.type')
  54. });