You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2013/11/01 14:26:03 UTC

git commit: AMBARI-3649 If there is no slave component when we click on link to host js error occurs. (ababiichuk)

Updated Branches:
  refs/heads/trunk 87e914c1b -> 00ec1d302


AMBARI-3649 If there is no slave component when we click on link to host js error occurs. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 00ec1d302d04a2a959282a22abf59c8cf858336b
Parents: 87e914c
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Fri Nov 1 15:21:38 2013 +0200
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Fri Nov 1 15:24:10 2013 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host.js         |  2 ++
 ambari-web/app/routes/main.js                   |  2 ++
 .../app/views/main/dashboard/service/hbase.js   |  6 ++++--
 .../app/views/main/dashboard/service/hdfs.js    | 10 ++++++---
 .../views/main/dashboard/service/mapreduce.js   |  4 +++-
 .../app/views/main/dashboard/service/yarn.js    | 22 +++++++++++---------
 .../app/views/main/service/info/summary.js      | 12 +++++++----
 7 files changed, 38 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/00ec1d30/ambari-web/app/controllers/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js
index fe1852b..d682fdf 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -56,6 +56,8 @@ App.MainHostController = Em.ArrayController.extend({
    * @param component App.HostComponent
    */
   filterByComponent:function (component) {
+    if(!component)
+      return;
     var id = component.get('componentName');
     var column = 6;
     this.get('componentsForFilter').setEach('checkedForHostFilter', false);

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/00ec1d30/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index ec2dd9a..c12e06d 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -928,6 +928,8 @@ module.exports = Em.Route.extend({
     router.transitionTo('hosts.hostDetails.index', event.context);
   },
   filterHosts: function (router, component) {
+    if(!component.context)
+      return;
     router.get('mainHostController').filterByComponent(component.context);
     router.transitionTo('hosts.index');
   }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/00ec1d30/ambari-web/app/views/main/dashboard/service/hbase.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service/hbase.js b/ambari-web/app/views/main/dashboard/service/hbase.js
index 28778a5..0a6b610 100644
--- a/ambari-web/app/views/main/dashboard/service/hbase.js
+++ b/ambari-web/app/views/main/dashboard/service/hbase.js
@@ -44,9 +44,11 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
   }.property('service.hostComponents.@each'),
 
   regionServesText: function () {
-    if(this.get('service.regionServers').get("length") > 1){
+    if (this.get('service.regionServers.length') == 0) {
+      return '';
+    } else if (this.get('service.regionServers.length') > 1) {
       return Em.I18n.t('services.service.summary.viewHosts');
-    }else{
+    } else {
       return Em.I18n.t('services.service.summary.viewHost');
     }
   }.property("service"),

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/00ec1d30/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 7a7239d..797e4fd 100644
--- a/ambari-web/app/views/main/dashboard/service/hdfs.js
+++ b/ambari-web/app/views/main/dashboard/service/hdfs.js
@@ -55,9 +55,11 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
   }.property('service.hostComponents.@each'),
 
   dataNodeHostText: function () {
-    if(this.get("service.dataNodes").content.length > 1){
+    if (this.get("service.dataNodes").content.length == 0) {
+      return '';
+    } else if (this.get("service.dataNodes").content.length > 1) {
       return Em.I18n.t('services.service.summary.viewHosts');
-    }else{
+    } else {
       return Em.I18n.t('services.service.summary.viewHost');
     }
   }.property("service"),
@@ -67,7 +69,9 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
   }.property('service.hostComponents.@each'),
 
   journalNodeHostText: function () {
-    if(this.get("service.journalNodes").content.length > 1){
+    if (this.get("service.journalNodes").content.length == 0) {
+      return '';
+    } else if (this.get("service.journalNodes").content.length > 1){
       return Em.I18n.t('services.service.summary.viewHosts');
     }else{
       return Em.I18n.t('services.service.summary.viewHost');

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/00ec1d30/ambari-web/app/views/main/dashboard/service/mapreduce.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service/mapreduce.js b/ambari-web/app/views/main/dashboard/service/mapreduce.js
index 326850a..4714d19 100644
--- a/ambari-web/app/views/main/dashboard/service/mapreduce.js
+++ b/ambari-web/app/views/main/dashboard/service/mapreduce.js
@@ -59,7 +59,9 @@ App.MainDashboardServiceMapreduceView = App.MainDashboardServiceView.extend({
   }.property('service.aliveTrackers', 'service.taskTrackers', 'service.jobsRunning'),
 
   trackersText: function () {
-    if(this.get('service').get('taskTrackers').get('length') > 1){
+    if (this.get('service').get('taskTrackers.length') == 0) {
+      return '';
+    } else if (this.get('service').get('taskTrackers.length') > 1){
       return Em.I18n.t('services.service.summary.viewHosts');
     }else{
       return Em.I18n.t('services.service.summary.viewHost');

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/00ec1d30/ambari-web/app/views/main/dashboard/service/yarn.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service/yarn.js b/ambari-web/app/views/main/dashboard/service/yarn.js
index b641aec..ec4d2ac 100644
--- a/ambari-web/app/views/main/dashboard/service/yarn.js
+++ b/ambari-web/app/views/main/dashboard/service/yarn.js
@@ -43,7 +43,7 @@ App.MainDashboardServiceYARNView = App.MainDashboardServiceView.extend({
   
   nodeManagerComponent: function () {
     return App.HostComponent.find().findProperty('componentName', 'NODEMANAGER');
-  }.property(),
+  }.property('service.hostComponents.@each'),
   
   yarnClientComponent: function () {
     return App.HostComponent.find().findProperty('componentName', 'YARN_CLIENT');
@@ -67,24 +67,26 @@ App.MainDashboardServiceYARNView = App.MainDashboardServiceView.extend({
   }.property("service.resourceManagerStartTime"),
 
   nodeManagersLive: function () {
-    return this.get('service.nodeManagerLiveNodes.length');
-  }.property('service.nodeManagerNodes', 'service.nodeManagerLiveNodes'),
+    return App.HostComponent.find().filterProperty('componentName', 'NODEMANAGER').filterProperty("workStatus","STARTED");
+  }.property('service.hostComponents.@each'),
 
   nodeManagerText: function () {
-    if(this.get("service.nodeManagerNodes.length") > 1){
+    if(!this.get("nodeManagerComponent") || this.get("nodeManagerComponent.length") == 0){
+      return '';
+    } else if(this.get("nodeManagerComponent.length") > 1){
       return Em.I18n.t('services.service.summary.viewHosts');
-    }else{
+    } else {
       return Em.I18n.t('services.service.summary.viewHost');
     }
-  }.property("service.nodeManagerNodes"),
+  }.property("nodeManagerComponent"),
 
   nodeManagersLiveTextView: App.ComponentLiveTextView.extend({
     liveComponents: function() {
-      return this.get("service.nodeManagerLiveNodes.length");
-    }.property('service.nodeManagerNodes', 'service.nodeManagerLiveNodes', 'service.nodeManagerLiveNodes.length'),
+      return App.HostComponent.find().filterProperty('componentName', 'NODEMANAGER').filterProperty("workStatus","STARTED").get("length");
+    }.property("service.hostComponents.@each"),
     totalComponents: function() {
-      return this.get("service.nodeManagerNodes.length");
-    }.property("service.nodeManagerNodes.length")
+      return App.HostComponent.find().filterProperty('componentName', 'NODEMANAGER').get("length");
+    }.property("service.hostComponents.@each")
   }),
 
   nodeManagersStatus: function () {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/00ec1d30/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index a962f47..e2c4c48 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -82,9 +82,11 @@ App.MainServiceInfoSummaryView = Em.View.extend({
   }.property('servers'),
 
   clientsHostText: function () {
-    if(this.get("hasManyClients")){
+    if (this.get('clients').length == 0) {
+      return '';
+    } else if (this.get("hasManyClients")) {
       return Em.I18n.t('services.service.summary.viewHosts');
-    }else{
+    } else {
       return Em.I18n.t('services.service.summary.viewHost');
     }
   }.property("hasManyClients"),
@@ -174,9 +176,11 @@ App.MainServiceInfoSummaryView = Em.View.extend({
     var service = this.get('controller.content');
     if (service.get("id") == "GANGLIA") {
       var monitors = service.get('hostComponents').filterProperty('isMaster', false);
-      if (monitors.length > 1){
+      if (monitors.length == 0) {
+        return '';
+      } else if (monitors.length > 1) {
         return Em.I18n.t('services.service.summary.viewHosts');
-      }else{
+      } else {
         return Em.I18n.t('services.service.summary.viewHost');
       }
     }