stack.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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}-${repositoryVersion}.
  21. stackName: DS.attr('string'),
  22. stackVersion: DS.attr('string'),
  23. stackDefault: DS.attr('boolean'),
  24. minJdkVersion: DS.attr('string'),
  25. maxJdkVersion: DS.attr('string'),
  26. repositoryVersion: DS.attr('string'),
  27. 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
  28. type: DS.attr('string'), // ["PATCH", "STANDARD"]
  29. useRedhatSatellite: DS.attr('boolean'),
  30. stackServices: DS.hasMany('App.ServiceSimple'),
  31. operatingSystems: DS.hasMany('App.OperatingSystem'),
  32. isSelected: DS.attr('boolean', {defaultValue: false}),
  33. stackNameVersion: Em.computed.concat('-', 'stackName', 'stackVersion'),
  34. isPatch: Em.computed.equal('type', 'PATCH'),
  35. displayName: Em.computed.concat('-', 'stackName', 'repositoryVersion'),
  36. /**
  37. * @type {boolean}
  38. */
  39. usePublicRepo: true,
  40. /**
  41. * @type {boolean}
  42. */
  43. useLocalRepo: false,
  44. /**
  45. * @return: {Array} returns supported repositories for all OperatingSystem's supported by a stack instance
  46. */
  47. repositories: function () {
  48. var operatingSystems = this.get('operatingSystems');
  49. var repositories = [];
  50. operatingSystems.filterProperty('isSelected', true).forEach(function (os) {
  51. os.get('repositories').forEach(function (repository) {
  52. repositories.pushObject(repository);
  53. }, this);
  54. }, this);
  55. return repositories;
  56. }.property('operatingSystems.@each.isSelected'),
  57. cleanReposBaseUrls: function () {
  58. this.get('operatingSystems').forEach(function (os) {
  59. os.get('repositories').setEach('baseUrl', '');
  60. });
  61. },
  62. restoreReposBaseUrls: function () {
  63. this.get('operatingSystems').forEach(function (os) {
  64. os.get('repositories').forEach(function (repo) {
  65. repo.set('baseUrl', repo.get('baseUrlInit'));
  66. });
  67. });
  68. }
  69. });
  70. App.Stack.FIXTURES = [];