host_component.js 1.7 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.HostComponent = DS.Model.extend({
  20. workStatus: DS.attr('string'),
  21. componentName: DS.attr('string'),
  22. host: DS.belongsTo('App.Host'),
  23. service: DS.belongsTo('App.Service'),
  24. isRunning: function(){
  25. return (this.get('workStatus') == 'STARTED' || this.get('workStatus') == 'STARTING');
  26. }.property('workStatus'),
  27. displayName: function () { console.log('model',this.get('isLoaded'));
  28. return App.format.role(this.get('componentName'));
  29. }.property('componentName')
  30. })
  31. App.HostComponent.Status = {
  32. started: "STARTED",
  33. starting: "STARTING",
  34. stopped: "INSTALLED",
  35. stopping: "STOPPING",
  36. getKeyName:function(value){
  37. switch(value){
  38. case this.started:
  39. return 'started';
  40. case this.starting:
  41. return 'starting';
  42. case this.stopped:
  43. return 'installed';
  44. case this.stopping:
  45. return 'stopping';
  46. }
  47. return 'none';
  48. }
  49. }
  50. App.HostComponent.FIXTURES = [];