AMBARI-6963. When ganglia is not installed, we have js error on dashboard, also it makes unable to relogin after install (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/664d53cc Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/664d53cc Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/664d53cc Branch: refs/heads/branch-alerts-dev Commit: 664d53cc5715218a8bbc43416397a2997715a8ae Parents: 5ed94d5 Author: Alex Antonenko <hiv...@gmail.com> Authored: Thu Aug 21 00:50:43 2014 +0300 Committer: Alex Antonenko <hiv...@gmail.com> Committed: Thu Aug 21 01:53:49 2014 +0300 ---------------------------------------------------------------------- .../app/views/main/dashboard/widgets/namenode_cpu.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/664d53cc/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js b/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js index cd3b7f8..b44fcbf 100644 --- a/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js +++ b/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js @@ -27,17 +27,24 @@ App.NameNodeCpuPieChartView = App.PieChartDashboardWidgetView.extend({ widgetHtmlId: 'widget-nn-cpu', cpuWio: null, nnHostName:"", + intervalId: null, + + willDestroyElement: function() { + clearInterval(this.get("intervalId")); + }, didInsertElement: function() { this._super(); - var self = this; + var self = this, + intervalId; if (App.get('isHaEnabled')) { this.set('nnHostName', this.get('model').get('activeNameNode.hostName')); }else{ this.set('nnHostName', this.get('model').get('nameNode.hostName')); } this.getValue(); - setInterval(function() {self.getValue()}, App.componentsUpdateInterval); + intervalId = setInterval(function() {self.getValue()}, App.componentsUpdateInterval); + this.set('intervalId', intervalId); }, getValue: function () { @@ -57,7 +64,7 @@ App.NameNodeCpuPieChartView = App.PieChartDashboardWidgetView.extend({ }, updateValueSuccess: function (response) { - this.set('cpuWio', response.metrics.cpu.cpu_wio); + this.set('cpuWio', Em.get(response, 'metrics.cpu.cpu_wio')); this.calc(); },