version.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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.StackVersion = DS.Model.extend({
  20. id: DS.attr('string'),
  21. clusterName: DS.attr('string'),
  22. stack: DS.attr('string'),
  23. version: DS.attr('string'),
  24. name: function() {
  25. return this.get('stack') + " " + this.get('version');
  26. }.property('stack', 'version'),
  27. state: DS.attr('string'),
  28. repositoryVersion: DS.belongsTo('App.RepositoryVersion'),
  29. installingHosts: DS.attr('array'),
  30. installedHosts: DS.attr('array'),
  31. installFailedHosts: DS.attr('array'),
  32. upgradingHosts: DS.attr('array'),
  33. upgradedHosts: DS.attr('array'),
  34. upgradeFailedHosts: DS.attr('array'),
  35. currentHosts: DS.attr('array'),
  36. initHosts: function() {
  37. return this.get('installingHosts') && this.get('installingHosts').concat(this.get('installFailedHosts'));
  38. }.property('installFailedHosts', 'installingHosts'),
  39. noInstalledHosts: function() {
  40. return this.get('installedHosts.length') == 0;
  41. }.property('installedHosts.length'),
  42. noCurrentHosts: function() {
  43. return this.get('currentHosts.length') == 0;
  44. }.property('currentHosts.length'),
  45. noInitHosts: function() {
  46. return this.get('initHosts.length') == 0;
  47. }.property('initHosts.length')
  48. });
  49. App.StackVersion.FIXTURES = [];