You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2014/02/11 12:22:28 UTC

git commit: AMBARI-4592. Host Details page: When heartbeat is lost, Client action pulldown should be disabled. (onechiporenko)

Updated Branches:
  refs/heads/trunk ccb61e86d -> 49bcf0fa0


AMBARI-4592. Host Details page: When heartbeat is lost, Client action pulldown should be disabled. (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 49bcf0fa038c482e7a7509e8ef97c6282918f34d
Parents: ccb61e8
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Tue Feb 11 13:20:17 2014 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Tue Feb 11 13:20:17 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/models/host.js                  | 4 ++--
 ambari-web/app/templates/main/host/summary.hbs | 2 +-
 ambari-web/test/models/host_test.js            | 6 ++++--
 3 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/49bcf0fa/ambari-web/app/models/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host.js b/ambari-web/app/models/host.js
index 1c72637..9eebda6 100644
--- a/ambari-web/app/models/host.js
+++ b/ambari-web/app/models/host.js
@@ -185,11 +185,11 @@ App.Host = DS.Model.extend({
   }.property('memory'),
 
   /**
-   * Return true if the host has not sent heartbeat within the last 180 seconds
+   * Return true if the host <code>healthStatus</code> is UNKNOWN
    * @returns {bool}
    */
   isNotHeartBeating : function() {
-    return (App.testMode) ? false : ((new Date()).getTime() - this.get('lastHeartBeatTime')) > 180 * 1000;
+    return (App.testMode) ? false : (this.get('healthStatus') === "UNKNOWN");
   }.property('lastHeartBeatTime'),
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/49bcf0fa/ambari-web/app/templates/main/host/summary.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/summary.hbs b/ambari-web/app/templates/main/host/summary.hbs
index dfe6798..12ae14a 100644
--- a/ambari-web/app/templates/main/host/summary.hbs
+++ b/ambari-web/app/templates/main/host/summary.hbs
@@ -77,7 +77,7 @@
             <div class="span5 row">
               {{#if App.isAdmin}}
                 <div class="btn-group pull-right">
-                  <button id="add_component" data-toggle="dropdown" {{bindAttr class=":btn :dropdown-toggle"}}>
+                  <button id="add_component" data-toggle="dropdown" {{bindAttr class=":btn :dropdown-toggle controller.content.isNotHeartBeating:disabled"}}>
                     {{t common.installed}}
                     <span class="caret pull-right"></span>
                   </button>

http://git-wip-us.apache.org/repos/asf/ambari/blob/49bcf0fa/ambari-web/test/models/host_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/host_test.js b/ambari-web/test/models/host_test.js
index 5058414..26144d7 100644
--- a/ambari-web/test/models/host_test.js
+++ b/ambari-web/test/models/host_test.js
@@ -51,7 +51,9 @@ describe('App.Host', function () {
       last_heart_beat_time: (new Date()).getTime()
     }
   ];
-  App.set('testMode', false);
+  before(function() {
+    App.set('testMode', false);
+  });
   App.store.loadMany(App.Host, data);
 
   describe('#diskUsedFormatted', function () {
@@ -109,7 +111,7 @@ describe('App.Host', function () {
     });
     it('host3 - false', function () {
       var host = App.Host.find().findProperty('hostName', 'host3');
-      expect(host.get('isNotHeartBeating')).to.equal(false);
+      expect(host.get('isNotHeartBeating')).to.equal(true);
     });
   });