hbase.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
  19. templateName: require('templates/main/dashboard/service/hbase'),
  20. serviceName: 'hbase',
  21. masterServerHeapSummary: function () {
  22. var heapUsed = this.get('service').get('heapMemoryUsed');
  23. var heapMax = this.get('service').get('heapMemoryMax');
  24. var percent = heapMax > 0 ? 100 * heapUsed / heapMax : 0;
  25. var heapString = heapUsed>0 ? heapUsed.bytesToSize(1, "parseFloat") : 0;
  26. var heapMaxString = heapMax>0 ? heapMax.bytesToSize(1, "parseFloat") : 0;
  27. return this.t('dashboard.services.hbase.masterServerHeap.summary').format(heapString, heapMaxString, percent.toFixed(1));
  28. }.property('service'),
  29. summaryHeader: function () {
  30. return this.t("dashboard.services.hbase.summary").format(this.get('service.regionServers.length'), this.get('service.averageLoad'));
  31. }.property('service'),
  32. hbaseMasterWebUrl: function () {
  33. return "http://" + this.get('service').get('master').get('hostName') + ":60010";
  34. }.property('service.master'),
  35. averageLoad: function () {
  36. return this.t('dashboard.services.hbase.averageLoadPerServer').format(this.get('service.averageLoad'));
  37. }.property("service"),
  38. masterStartedTime: function () {
  39. var uptime = this.get('service').get('masterStartTime');
  40. var formatted = (new Date().getTime() - uptime).toDaysHoursMinutes();
  41. return this.t('dashboard.services.uptime').format(formatted.d, formatted.h, formatted.m);
  42. }.property("service"),
  43. masterActivatedTime: function () {
  44. var uptime = this.get('service').get('masterActiveTime');
  45. var formatted = (new Date().getTime() - uptime).toDaysHoursMinutes();
  46. return this.t('dashboard.services.uptime').format(formatted.d, formatted.h, formatted.m);
  47. }.property("service"),
  48. regionServerComponent: function () {
  49. return App.Component.find().findProperty('componentName', 'HBASE_REGIONSERVER');
  50. }.property('components'),
  51. toggleInfoView: function() {
  52. $('#hbase-info').toggle('blind', 1000);
  53. }
  54. });