stack.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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}.
  21. stackName: DS.attr('string'),
  22. stackVersion: DS.attr('string'),
  23. active: DS.attr('boolean'), // All of the instances should have this value to true. We should map only those stacks that has active flag set to true
  24. parentStackVersion: DS.attr('string'),
  25. minUpgradeVersion: DS.attr('string'),
  26. minJdkVersion: DS.attr('string'),
  27. maxJdkVersion: DS.attr('string'),
  28. configTypes: DS.attr('object'),
  29. operatingSystems: DS.hasMany('App.OperatingSystem'),
  30. isSelected: DS.attr('boolean', {defaultValue: false}),
  31. /**
  32. * @return: {Array} returns supported repositories for all OperatingSystem's supported by a stack instance
  33. */
  34. repositories: function () {
  35. var operatingSystems = this.get('operatingSystems');
  36. var repositories = [];
  37. operatingSystems.forEach(function (os) {
  38. os.get('repositories').forEach(function (repository) {
  39. repositories.pushObject(repository);
  40. }, this);
  41. }, this);
  42. return repositories;
  43. }.property('id'),
  44. /**
  45. * @return: {Array} App.StackService instances for selected stack instance. For non-selected stack instance returns empty array
  46. */
  47. services: function () {
  48. var result = [];
  49. var isStackSelected = this.get('isSelected');
  50. var stackServices = App.StackService.find().get('length');
  51. if (isStackSelected && stackServices) {
  52. result = App.StackService.find();
  53. }
  54. return result;
  55. }.property('isSelected'),
  56. /**
  57. * Right now there ambari-web is not fetching this information from the server as it does not need as of present.
  58. * @TODO: This should return stack level configurations for selected stack instance i.e properties of cluster-env file
  59. */
  60. configurations: function() {
  61. return [];
  62. }.property('isSelected')
  63. });
  64. App.Stack.FIXTURES = [];