stack.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.Stack = DS.Model.extend({
  20. id: DS.attr('string'), // ${stackName}-${stackVersion}-${repoVersion}.
  21. stackName: DS.attr('string'),
  22. stackVersion: DS.attr('string'),
  23. repositoryVersion: DS.attr('string'),
  24. showAvailable: DS.attr('boolean'), // All of the instances should have this value to true. We should map only those stacks that has this flag set to true
  25. type: DS.attr('string'), // ["PATCH", "STANDARD"]
  26. useRedhatSatellite: DS.attr('boolean'),
  27. stackServices: DS.hasMany('App.ServiceSimple'),
  28. operatingSystems: DS.hasMany('App.OperatingSystem'),
  29. isSelected: DS.attr('boolean', {defaultValue: false}),
  30. stackNameVersion: function () {
  31. //${stackName}-${stackVersion}.
  32. return this.get('stackName') + '-' + this.get('stackVersion');
  33. }.property('stackName', 'stackVersion'),
  34. isPatch: function () {
  35. return this.get('type') == "PATCH";
  36. }.property('type'),
  37. displayName: function () {
  38. //${stackName}-${repositoryVersion}.
  39. return this.get('stackName') + '-' + this.get('repositoryVersion');
  40. }.property('stackName', 'repositoryVersion'),
  41. /**
  42. * @return: {Array} returns supported repositories for all OperatingSystem's supported by a stack instance
  43. */
  44. repositories: function () {
  45. var operatingSystems = this.get('operatingSystems');
  46. var repositories = [];
  47. operatingSystems.forEach(function (os) {
  48. os.get('repositories').forEach(function (repository) {
  49. repositories.pushObject(repository);
  50. }, this);
  51. }, this);
  52. return repositories;
  53. }.property('id')
  54. });
  55. App.Stack.FIXTURES = [];