hosts.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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.HostInfo = Ember.Object.extend({
  20. elementId: 'host',
  21. name: '',
  22. cpu: null,
  23. memory: null,
  24. message: 'Information',
  25. barColor: 'progress-info',
  26. isChecked: true,
  27. bootLog:null,
  28. bootStatus: 'PENDING',
  29. bootStatusForDisplay:function () {
  30. switch (this.get('bootStatus')) {
  31. case 'PENDING':
  32. return 'Preparing';
  33. case 'REGISTERED':
  34. return 'Success';
  35. case 'FAILED':
  36. return 'Failed';
  37. case 'RUNNING':
  38. return 'Installing';
  39. case 'DONE':
  40. case 'REGISTERING':
  41. default:
  42. return 'Registering';
  43. }
  44. }.property('bootStatus'),
  45. bootBarColor:function () {
  46. switch (this.get('bootStatus')) {
  47. case 'REGISTERED':
  48. return 'progress-success';
  49. case 'FAILED':
  50. return 'progress-danger';
  51. case 'PENDING':
  52. case 'RUNNING':
  53. case 'DONE':
  54. case 'REGISTERING':
  55. default:
  56. return 'progress-info';
  57. }
  58. }.property('bootStatus'),
  59. bootStatusColor:function () {
  60. switch (this.get('bootStatus')) {
  61. case 'REGISTERED':
  62. return 'text-success';
  63. case 'FAILED':
  64. return 'text-error';
  65. case 'PENDING':
  66. case 'RUNNING':
  67. case 'DONE':
  68. case 'REGISTERING':
  69. default:
  70. return 'text-info';
  71. }
  72. }.property('bootStatus'),
  73. isBootDone:function () {
  74. switch (this.get('bootStatus')) {
  75. case 'REGISTERED':
  76. case 'FAILED':
  77. return true;
  78. case 'PENDING':
  79. case 'RUNNING':
  80. case 'DONE':
  81. case 'REGISTERING':
  82. default:
  83. return false;
  84. }
  85. }.property('bootStatus')
  86. });