Updated Branches: refs/heads/trunk 613aee60b -> 96751430b
AMBARI-3087. Ambari dashboard does not update when datanodes are lost. (xiwang via yusaku) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/96751430 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/96751430 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/96751430 Branch: refs/heads/trunk Commit: 96751430b7c5110076a8026bfdb7c1f203d68321 Parents: 613aee6 Author: Yusaku Sako <[email protected]> Authored: Wed Sep 4 10:08:50 2013 -0700 Committer: Yusaku Sako <[email protected]> Committed: Wed Sep 4 10:09:07 2013 -0700 ---------------------------------------------------------------------- .../main/dashboard/widgets/datanode_live.js | 23 ++++++++++++-------- .../main/dashboard/widgets/tasktracker_live.js | 16 +++++++++----- 2 files changed, 24 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/96751430/ambari-web/app/views/main/dashboard/widgets/datanode_live.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/dashboard/widgets/datanode_live.js b/ambari-web/app/views/main/dashboard/widgets/datanode_live.js index 962b47f..98738df 100644 --- a/ambari-web/app/views/main/dashboard/widgets/datanode_live.js +++ b/ambari-web/app/views/main/dashboard/widgets/datanode_live.js @@ -30,26 +30,31 @@ App.DataNodeUpView = App.TextDashboardWidgetView.extend({ hiddenInfo: function () { var result = []; - result.pushObject( App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","STARTED").length - + ' ' + Em.I18n.t('dashboard.services.hdfs.nodes.live')); - result.pushObject( App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","INSTALLED").length - + ' ' + Em.I18n.t('dashboard.services.hdfs.nodes.dead')); + result.pushObject(this.get('dataNodesLive').length + ' ' + Em.I18n.t('dashboard.services.hdfs.nodes.live')); + result.pushObject(this.get('dataNodesDead').length + ' ' + Em.I18n.t('dashboard.services.hdfs.nodes.dead')); result.pushObject(this.get('model.decommissionDataNodes.length')+ ' ' + Em.I18n.t('dashboard.services.hdfs.nodes.decom')); return result; - }.property('model', 'model.decommissionDataNodes.length'), + }.property('dataNodesLive', 'dataNodesDead', 'model.decommissionDataNodes.length'), hiddenInfoClass: "hidden-info-three-line", thresh1: 40, thresh2: 70, maxValue: 100, + dataNodesLive: function(){ + return App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","STARTED"); + }.property('model.hostComponents.@each'), + dataNodesDead: function(){ + return App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","INSTALLED"); + }.property('model.hostComponents.@each'), + data: function () { - return ((App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","STARTED").length / this.get('model.dataNodes.length')).toFixed(2)) * 100; - }.property('model.dataNodes.length', 'model'), + return ((this.get('dataNodesLive').length / this.get('model.dataNodes.length')).toFixed(2)) * 100; + }.property('model.dataNodes.length', 'dataNodesLive'), content: function () { - return App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","STARTED").length + "/" + this.get('model.dataNodes.length'); - }.property('model.dataNodes.length', 'model'), + return this.get('dataNodesLive').length + "/" + this.get('model.dataNodes.length'); + }.property('model.dataNodes.length', 'dataNodesLive'), editWidget: function (event) { var parent = this; http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/96751430/ambari-web/app/views/main/dashboard/widgets/tasktracker_live.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/dashboard/widgets/tasktracker_live.js b/ambari-web/app/views/main/dashboard/widgets/tasktracker_live.js index b7cd038..c64a6b4 100644 --- a/ambari-web/app/views/main/dashboard/widgets/tasktracker_live.js +++ b/ambari-web/app/views/main/dashboard/widgets/tasktracker_live.js @@ -27,25 +27,29 @@ App.TaskTrackerUpView = App.TextDashboardWidgetView.extend({ hiddenInfo: function () { var svc = this.get('model'); - var liveCount = App.HostComponent.find().filterProperty('componentName', 'TASKTRACKER').filterProperty("workStatus","STARTED").length; + var liveCount = this.get('taskTrackersLive').length; var totalCount = svc.get('taskTrackers').get('length'); var result = []; result.pushObject(liveCount + " live"); result.pushObject(totalCount + " total"); return result; - }.property('model.aliveTrackers.length', 'model.taskTrackers.length'), + }.property('model.taskTrackers.length', 'taskTrackersLive'), thresh1: 40, thresh2: 70, maxValue: 100, + taskTrackersLive: function(){ + return App.HostComponent.find().filterProperty('componentName', 'TASKTRACKER').filterProperty("workStatus","STARTED"); + }.property('model.hostComponents.@each'), + data: function () { - return ( App.HostComponent.find().filterProperty('componentName', 'TASKTRACKER').filterProperty("workStatus","STARTED").length / this.get('model.taskTrackers.length')).toFixed(2) * 100; - }.property('model.taskTrackers.length', 'model.aliveTrackers.length'), + return (this.get('taskTrackersLive').length / this.get('model.taskTrackers.length')).toFixed(2) * 100; + }.property('model.taskTrackers.length', 'taskTrackersLive'), content: function () { - return App.HostComponent.find().filterProperty('componentName', 'TASKTRACKER').filterProperty("workStatus","STARTED").length + "/" + this.get('model.taskTrackers.length'); - }.property('model.taskTrackers.length', 'model.aliveTrackers.length'), + return this.get('taskTrackersLive').length + "/" + this.get('model.taskTrackers.length'); + }.property('model.taskTrackers.length', 'taskTrackersLive'), editWidget: function (event) { var parent = this;
