flume.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with this
  4. * work for additional information regarding copyright ownership. The ASF
  5. * licenses this file to you under the Apache License, Version 2.0 (the
  6. * "License"); you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. * License for the specific language governing permissions and limitations under
  15. * the License.
  16. */
  17. var App = require('app');
  18. App.FlumeService = App.Service.extend({
  19. version: DS.attr('string'),
  20. agents: DS.hasMany('App.FlumeAgent'),
  21. flumeHandlersTotal: DS.attr('number')
  22. });
  23. App.FlumeAgent = DS.Model.extend({
  24. /**
  25. * ID of a flume agent will be of the format
  26. * '<agent-name>-<host-name>'
  27. */
  28. id: DS.attr('string'),
  29. name: DS.attr('string'),
  30. /**
  31. * Status of agent. One of 'RUNNING', 'NOT_RUNNING', 'UNKNOWN'.
  32. */
  33. status: DS.attr('string'),
  34. host: DS.belongsTo('App.Host'),
  35. hostName: DS.attr('string'),
  36. channelsCount: DS.attr('number'),
  37. sourcesCount: DS.attr('number'),
  38. sinksCount: DS.attr('number'),
  39. healthClass : function() {
  40. switch (this.get('status')) {
  41. case 'RUNNING':
  42. return App.healthIconClassGreen;
  43. break;
  44. case 'NOT_RUNNING':
  45. return App.healthIconClassRed;
  46. break;
  47. case 'UNKNOWN':
  48. default:
  49. return App.healthIconClassYellow;
  50. break;
  51. }
  52. }.property('status'),
  53. displayStatus : function() {
  54. switch (this.get('status')) {
  55. case 'RUNNING':
  56. return "Running";
  57. break;
  58. case 'NOT_RUNNING':
  59. return "Stopped";
  60. break;
  61. case 'UNKNOWN':
  62. default:
  63. return "Unknown";
  64. break;
  65. }
  66. }.property('status')
  67. });
  68. App.FlumeAgent.FIXTURES = [];
  69. App.FlumeService.FIXTURES = [];