Updated Branches: refs/heads/trunk 574dfad4d -> 157ad266a
AMBARI-2690. Datanode Live widget displays 0 dead when no datanode is live on a cluster. (Xi Wang 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/157ad266 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/157ad266 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/157ad266 Branch: refs/heads/trunk Commit: 157ad266ae41bf9172b0a8c23954d88a1bc3c5a7 Parents: 574dfad Author: Yusaku Sako <[email protected]> Authored: Tue Jul 30 13:25:09 2013 -0700 Committer: Yusaku Sako <[email protected]> Committed: Tue Jul 30 13:25:09 2013 -0700 ---------------------------------------------------------------------- .../app/templates/main/dashboard/service/hdfs.hbs | 4 ++-- ambari-web/app/views/main/dashboard/service/hdfs.js | 3 +++ .../views/main/dashboard/widgets/datanode_live.js | 16 +++++++++------- .../main/dashboard/widgets/tasktracker_live.js | 6 +++--- 4 files changed, 17 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/157ad266/ambari-web/app/templates/main/dashboard/service/hdfs.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/dashboard/service/hdfs.hbs b/ambari-web/app/templates/main/dashboard/service/hdfs.hbs index ec84e0b..6bc1783 100644 --- a/ambari-web/app/templates/main/dashboard/service/hdfs.hbs +++ b/ambari-web/app/templates/main/dashboard/service/hdfs.hbs @@ -68,8 +68,8 @@ <tr> <td>{{t dashboard.services.hdfs.datanodecounts}}</td> <td> - {{view.service.liveDataNodes.length}} {{t dashboard.services.hdfs.nodes.live}} / - {{view.service.deadDataNodes.length}} {{t dashboard.services.hdfs.nodes.dead}} / + {{view.dataNodesLive.length}} {{t dashboard.services.hdfs.nodes.live}} / + {{view.dataNodesDead.length}} {{t dashboard.services.hdfs.nodes.dead}} / {{view.service.decommissionDataNodes.length}} {{t dashboard.services.hdfs.nodes.decom}} </td> </tr> http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/157ad266/ambari-web/app/views/main/dashboard/service/hdfs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/dashboard/service/hdfs.js b/ambari-web/app/views/main/dashboard/service/hdfs.js index 610a99f..15207b0 100644 --- a/ambari-web/app/views/main/dashboard/service/hdfs.js +++ b/ambari-web/app/views/main/dashboard/service/hdfs.js @@ -39,6 +39,9 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({ dataNodesLive: function(){ return App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","STARTED"); }.property('service'), + dataNodesDead: function(){ + return App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","INSTALLED"); + }.property('service'), dataNodeHostText: function () { if(this.get("service.dataNodes") > 1){ http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/157ad266/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 89a2544..1453712 100644 --- a/ambari-web/app/views/main/dashboard/widgets/datanode_live.js +++ b/ambari-web/app/views/main/dashboard/widgets/datanode_live.js @@ -31,11 +31,13 @@ App.DataNodeUpView = App.DashboardWidgetView.extend({ hiddenInfo: function () { var result = []; - result.pushObject(this.get('model.liveDataNodes.length') + ' ' + this.t('dashboard.services.hdfs.nodes.live')); - result.pushObject(this.get('model.deadDataNodes.length') + ' ' + this.t('dashboard.services.hdfs.nodes.dead')); + result.pushObject( App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","STARTED").length + + ' ' + this.t('dashboard.services.hdfs.nodes.live')); + result.pushObject( App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","INSTALLED").length + + ' ' + this.t('dashboard.services.hdfs.nodes.dead')); result.pushObject(this.get('model.decommissionDataNodes.length')+ ' ' + this.t('dashboard.services.hdfs.nodes.decom')); return result; - }.property('model.liveDataNodes.length','model.deadDataNodes.length','model.decommissionDataNodes.length'), + }.property('model', 'model.decommissionDataNodes.length'), hiddenInfoClass: "hidden-info-three-line", classNameBindings: ['isRed', 'isOrange', 'isGreen'], @@ -60,12 +62,12 @@ App.DataNodeUpView = App.DashboardWidgetView.extend({ maxValue: 100, data: function () { - return ((this.get('model.liveDataNodes.length')/ this.get('model.dataNodes.length')).toFixed(2)) * 100; - }.property('model.dataNodes.length', 'model.liveDataNodes.length'), + return ((App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","STARTED").length / this.get('model.dataNodes.length')).toFixed(2)) * 100; + }.property('model.dataNodes.length', 'model'), content: function () { - return this.get('model.liveDataNodes.length') + "/" + this.get('model.dataNodes.length'); - }.property('model.dataNodes.length', 'model.liveDataNodes.length'), + return App.HostComponent.find().filterProperty('componentName', 'DATANODE').filterProperty("workStatus","STARTED").length + "/" + this.get('model.dataNodes.length'); + }.property('model.dataNodes.length', 'model'), editWidget: function (event) { var parent = this; http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/157ad266/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 96fe2d5..77469c1 100644 --- a/ambari-web/app/views/main/dashboard/widgets/tasktracker_live.js +++ b/ambari-web/app/views/main/dashboard/widgets/tasktracker_live.js @@ -31,7 +31,7 @@ App.TaskTrackerUpView = App.DashboardWidgetView.extend({ hiddenInfo: function () { var svc = this.get('model'); - var liveCount = svc.get('aliveTrackers').get('length'); + var liveCount = App.HostComponent.find().filterProperty('componentName', 'TASKTRACKER').filterProperty("workStatus","STARTED").length; var totalCount = svc.get('taskTrackers').get('length'); var result = []; result.pushObject(liveCount + " live"); @@ -61,11 +61,11 @@ App.TaskTrackerUpView = App.DashboardWidgetView.extend({ maxValue: 100, data: function () { - return ((this.get('model.aliveTrackers.length')/ this.get('model.taskTrackers.length')).toFixed(2)) * 100; + 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'), content: function () { - return this.get('model.aliveTrackers.length') + "/" + this.get('model.taskTrackers.length'); + return App.HostComponent.find().filterProperty('componentName', 'TASKTRACKER').filterProperty("workStatus","STARTED").length + "/" + this.get('model.taskTrackers.length'); }.property('model.taskTrackers.length', 'model.aliveTrackers.length'), editWidget: function (event) {
