You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/03/12 20:31:31 UTC

[6/6] ambari git commit: AMBARI-10045. Host detail page: Component action button isn't disabled while it's action list is empty (alexantonenko)

AMBARI-10045. Host detail page: Component action button isn't disabled while it's action list is empty (alexantonenko)


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

Branch: refs/heads/trunk
Commit: d786be4ae63c89a1157e54997e79e7aa3439c143
Parents: 751b310
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Mar 12 18:37:34 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Mar 12 21:31:20 2015 +0200

----------------------------------------------------------------------
 .../main/host/details/host_component_view.js    |  5 +++--
 .../host/details/host_component_view_test.js    | 20 +++++++++++++++++++-
 2 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d786be4a/ambari-web/app/views/main/host/details/host_component_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details/host_component_view.js b/ambari-web/app/views/main/host/details/host_component_view.js
index 758a2bd..fece46d 100644
--- a/ambari-web/app/views/main/host/details/host_component_view.js
+++ b/ambari-web/app/views/main/host/details/host_component_view.js
@@ -103,11 +103,12 @@ App.HostComponentView = Em.View.extend({
   /**
    * CSS-class for disabling drop-down menu with list of host component actions
    * Disabled if host's <code>healthClass</code> is health-status-DEAD-YELLOW (lost heartbeat)
+   * Disabled if component's action list is empty
    * @type {String}
    */
   disabled: function () {
-    return (this.get('parentView.content.healthClass') === "health-status-DEAD-YELLOW") ? 'disabled' : '';
-  }.property('parentView.content.healthClass'),
+    return ( (this.get('parentView.content.healthClass') === "health-status-DEAD-YELLOW") || (this.get('noActionAvailable') === 'hidden' && this.get('isRestartComponentDisabled'))) ? 'disabled' : '';
+  }.property('parentView.content.healthClass', 'noActionAvailable', 'isRestartComponentDisabled'),
 
   /**
    * For Upgrade failed state

http://git-wip-us.apache.org/repos/asf/ambari/blob/d786be4a/ambari-web/test/views/main/host/details/host_component_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host/details/host_component_view_test.js b/ambari-web/test/views/main/host/details/host_component_view_test.js
index 44cb5fa..e0dcb40 100644
--- a/ambari-web/test/views/main/host/details/host_component_view_test.js
+++ b/ambari-web/test/views/main/host/details/host_component_view_test.js
@@ -55,10 +55,26 @@ describe('App.HostComponentView', function() {
     var tests = Em.A([
       {
         parentView: {content: {healthClass: 'health-status-DEAD-YELLOW'}},
+        noActionAvailable: '',
+        isRestartComponentDisabled: true,
         e: 'disabled'
       },
       {
         parentView: {content: {healthClass: 'another-class'}},
+        noActionAvailable: '',
+        isRestartComponentDisabled: true,
+        e: ''
+      },
+      {
+        parentView: {content: {healthClass: 'another-class'}},
+        noActionAvailable: 'hidden',
+        isRestartComponentDisabled: true,
+        e: 'disabled'
+      },
+      {
+        parentView: {content: {healthClass: 'another-class'}},
+        noActionAvailable: 'hidden',
+        isRestartComponentDisabled: false,
         e: ''
       }
     ]);
@@ -68,7 +84,9 @@ describe('App.HostComponentView', function() {
         hostComponentView = App.HostComponentView.create({
           startBlinking: function(){},
           doBlinking: function(){},
-          parentView: test.parentView
+          parentView: test.parentView,
+          noActionAvailable: test.noActionAvailable,
+          isRestartComponentDisabled: test.isRestartComponentDisabled
         });
         expect(hostComponentView.get('disabled')).to.equal(test.e);
       });