You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2015/08/28 11:43:24 UTC

ambari git commit: AMBARI-12899 Heatmaps page request metrics when Ambari Metrics service is absent. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/trunk 85c87bffa -> cd3a55783


AMBARI-12899 Heatmaps page request metrics when Ambari Metrics service is absent. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cd3a5578
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cd3a5578
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cd3a5578

Branch: refs/heads/trunk
Commit: cd3a55783dc76803b644902da142f0509c5e808f
Parents: 85c87bf
Author: Andrii Tkach <at...@hortonworks.com>
Authored: Thu Aug 27 15:43:14 2015 +0300
Committer: Andrii Tkach <at...@hortonworks.com>
Committed: Fri Aug 28 12:35:54 2015 +0300

----------------------------------------------------------------------
 .../views/common/widget/heatmap_widget_view.js  | 38 +++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cd3a5578/ambari-web/app/views/common/widget/heatmap_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/widget/heatmap_widget_view.js b/ambari-web/app/views/common/widget/heatmap_widget_view.js
index 62c6cd2..e4aa6c1 100644
--- a/ambari-web/app/views/common/widget/heatmap_widget_view.js
+++ b/ambari-web/app/views/common/widget/heatmap_widget_view.js
@@ -33,6 +33,12 @@ App.HeatmapWidgetView = Em.View.extend(App.WidgetMixin, {
    */
   racks: [],
 
+  /**
+   * @type {$.ajax|null}
+   * @default null
+   */
+  activeRequest: null,
+
   onMetricsLoaded: function () {
     if (!this.get('isLoaded')) {
       this.set('controller.inputMaximum', this.get('content.properties.max_limit'));
@@ -40,6 +46,36 @@ App.HeatmapWidgetView = Em.View.extend(App.WidgetMixin, {
     this._super();
   },
 
+  willDestroyElement: function () {
+    if ($.isPlainObject(this.get('activeRequest'))) {
+      this.get('activeRequest').abort();
+      this.set('activeRequest', null);
+    }
+  },
+
+  getHostComponentsMetrics: function (request) {
+    var ajax = this._super(request);
+    this.set('activeRequest', ajax);
+    return ajax;
+  },
+
+  getHostsMetrics: function (request) {
+    var ajax = this._super(request);
+    this.set('activeRequest', ajax);
+    return ajax;
+  },
+
+  /**
+   * skip metrics loading if AMBARI METRICS service is not started
+   */
+  loadMetrics: function () {
+    if (App.Service.find('AMBARI_METRICS').get('isStarted')) {
+      this._super();
+    } else {
+      this.onMetricsLoaded();
+    }
+  },
+
   /**
    * draw widget
    */
@@ -65,7 +101,7 @@ App.HeatmapWidgetView = Em.View.extend(App.WidgetMixin, {
       App.loadTimer.finish('Heatmaps Page');
       App.loadTimer.finish('Service Heatmaps Page');
     }
-  },
+  }.observes('racks.@each.isLoaded'),
 
   /**
    * calculate value for heatmap widgets