浏览代码

AMBARI-4854. Hosts page components caret wrong behaviour. (xiwang via yusaku)

Yusaku Sako 11 年之前
父节点
当前提交
156ddc1e11

+ 2 - 6
ambari-web/app/styles/application.less

@@ -3221,15 +3221,11 @@ table.graphs {
     }
     }
   }
   }
   .host-components-expander {
   .host-components-expander {
-    .caret {
+    .icon-caret-right, .icon-caret-down {
       vertical-align: middle;
       vertical-align: middle;
       margin-right: 5px;
       margin-right: 5px;
       margin-bottom: 2px;
       margin-bottom: 2px;
-      &.right {
-        border-left: 4px solid #000000;
-        border-top: 4px solid transparent;
-        border-bottom: 4px solid transparent;
-      }
+      text-decoration: none;
     }
     }
   }
   }
   .host-components {
   .host-components {

+ 2 - 1
ambari-web/app/templates/main/host.hbs

@@ -127,7 +127,8 @@
 
 
           <td>{{host.loadAvg}}</td>
           <td>{{host.loadAvg}}</td>
           <td>
           <td>
-            <a href="#" class="host-components-expander" {{action toggleComponents target="view"}}> <span class="caret right"></span>{{view.content.hostComponents.length}} {{pluralize view.content.hostComponents.length singular="t:common.component" plural="t:common.components"}}</a>
+            <a href="#" class="host-components-expander" {{action toggleComponents target="view"}}> <span {{bindAttr class="view.isComponentsCollapsed:icon-caret-right:icon-caret-down"}}></span>
+              {{view.content.hostComponents.length}} {{pluralize view.content.hostComponents.length singular="t:common.component" plural="t:common.components"}}</a>
             <div id="host-{{unbound host.hostName}}" class="host-components">
             <div id="host-{{unbound host.hostName}}" class="host-components">
               {{{view.labels}}}
               {{{view.labels}}}
             </div>
             </div>

+ 2 - 1
ambari-web/app/views/main/host.js

@@ -206,10 +206,11 @@ App.MainHostView = App.TableView.extend({
     tagName: 'tr',
     tagName: 'tr',
     didInsertElement: function(){
     didInsertElement: function(){
       App.tooltip(this.$("[rel='HealthTooltip'], [rel='UsageTooltip'], [rel='ComponentsTooltip']"));
       App.tooltip(this.$("[rel='HealthTooltip'], [rel='UsageTooltip'], [rel='ComponentsTooltip']"));
+      this.set('isComponentsCollapsed', true);
     },
     },
 
 
     toggleComponents: function(event) {
     toggleComponents: function(event) {
-      this.$(event.target).find('.caret').toggleClass('right');
+      this.set('isComponentsCollapsed', !this.get('isComponentsCollapsed'));
       this.$('.host-components').toggle();
       this.$('.host-components').toggle();
     },
     },