hbase_links.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.HBaseLinksView = App.LinkDashboardWidgetView.extend({
  20. templateName: require('templates/main/dashboard/widgets/hbase_links'),
  21. title: Em.I18n.t('dashboard.widgets.HBaseLinks'),
  22. id: '19',
  23. model_type: 'hbase',
  24. port: '60010',
  25. componentName: 'HBASE_REGIONSERVER',
  26. /**
  27. * All master components
  28. */
  29. masters: function () {
  30. return this.get('model.hostComponents').filterProperty('isMaster', true);
  31. }.property('model.hostComponents.@each'),
  32. /**
  33. * Passive master components
  34. */
  35. passiveMasters: function () {
  36. if (App.supports.multipleHBaseMasters) {
  37. return this.get('masters').filterProperty('haStatus', 'false');
  38. }
  39. return [];
  40. }.property('masters'),
  41. /**
  42. * Formatted output for passive master components
  43. */
  44. passiveMasterOutput: function () {
  45. return Em.I18n.t('service.hbase.passiveMasters').format(this.get('passiveMasters').length);
  46. }.property('passiveMasters'),
  47. /**
  48. * One(!) active master component
  49. */
  50. activeMaster: function () {
  51. if(App.supports.multipleHBaseMasters) {
  52. return this.get('masters').findProperty('haStatus', 'true');
  53. } else {
  54. return this.get('masters')[0];
  55. }
  56. }.property('masters'),
  57. activeMasterTitle: function(){
  58. if (App.supports.multipleHBaseMasters) {
  59. return this.t('service.hbase.activeMaster');
  60. } else {
  61. return this.get('activeMaster.host.publicHostName');
  62. }
  63. }.property('activeMaster'),
  64. hbaseMasterWebUrl: function () {
  65. if (this.get('activeMaster.host') && this.get('activeMaster.host').get('publicHostName')) {
  66. return "http://" + this.get('activeMaster.host').get('publicHostName') + ':' + this.get('port');
  67. }
  68. return '';
  69. }.property('activeMaster'),
  70. calcWebUrl: function() {
  71. return '';
  72. }
  73. });