component.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. /**
  19. * Here will be stored slave functions related to components
  20. * @type {Object}
  21. */
  22. module.exports = {
  23. /**
  24. * Return list of installed components. Syntax is:
  25. *
  26. * [{
  27. * id : 'DATANODE',
  28. * displayName : 'DataNode',
  29. * isMaster : true,
  30. * isSlave : false,
  31. * isClient : false
  32. * }]
  33. *
  34. */
  35. getInstalledComponents : function(){
  36. var components = App.HostComponent.find();
  37. var names = components.mapProperty('componentName').uniq();
  38. var result = [];
  39. names.forEach(function(componentName){
  40. var component = components.findProperty('componentName', componentName);
  41. result.push(Ember.Object.create({
  42. id: componentName,
  43. isMaster: component.get('isMaster'),
  44. isSlave: component.get('isSlave'),
  45. isClient: component.get('isClient'),
  46. displayName: component.get('displayName'),
  47. serviceName: component.get('service.id')
  48. }));
  49. });
  50. return result;
  51. }
  52. };