Browse Source

AMBARI-9069 Hosts page: Versions column should show actual version number. (ababiichuk)

aBabiichuk 10 years ago
parent
commit
a9ca6fac4f

+ 3 - 3
ambari-web/app/styles/application.less

@@ -3606,7 +3606,7 @@ table.graphs {
     .col6,
     td:first-child + td + td + td + td + td + td,
     th:first-child + th + th + th + th + th + th {
-      width: 11%!important;
+      width: 10%!important;
     }
     .col7,
     td:first-child + td + td + td + td + td + td + td,
@@ -3623,13 +3623,13 @@ table.graphs {
     .col9,
     td:first-child + td + td + td + td + td + td + td + td + td,
     th:first-child + th + th + th + th + th + th + th + th + th{
-      width: 10%!important;
+      width: 9%!important;
     }
 
     .col10,
     td:first-child + td + td + td + td + td + td + td + td + td + td,
     th:first-child + th + th + th + th + th + th + th + th + th + th{
-      width: 13%!important;
+      width: 15%!important;
     }
 
     .col11,

+ 6 - 4
ambari-web/app/templates/main/host.hbs

@@ -132,10 +132,12 @@
           </td>
 
           <td class="load-avg">{{host.loadAvg}}</td>
-          <td {{bindAttr class="App.supports.stackUpgrade::hidden :host-table-versions"}}>
-            <a href="#" class="expander" {{action toggleVersions target="view"}}>
-              <span {{bindAttr class="view.isVersionsCollapsed:icon-caret-right:icon-caret-down"}}></span>
-              {{view.content.stackVersions.length}} {{pluralize view.content.stackVersions.length singular="t:common.version" plural="t:common.versions"}}
+          <td {{bindAttr class="App.supports.stackUpgrade::hidden view.hasSingleVersion:not-active-link :host-table-versions"}}>
+            <a href="#" class="expander black" {{action toggleVersions target="view"}}>
+              {{#unless view.hasSingleVersion}}
+                <span {{bindAttr class="view.isVersionsCollapsed:icon-caret-right:icon-caret-down"}}></span>
+              {{/unless}}
+              {{view.currentVersion}}
             </a>
             <div class="stack-versions collapsed-list">
               {{{view.versionlabels}}}

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

@@ -584,13 +584,31 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
       return this.get('content.hostComponents').getEach('displayName').join("<br />");
     }.property('content.hostComponents.length'),
 
+    /**
+     * true if host has only one repoversion
+     * in this case expander in version columnn is hidden
+     * @returns {Boolean}
+     */
+    hasSingleVersion: function() {
+      return this.get('content.stackVersions.length') == 1;
+    }.property('content.stackVersions.length'),
+
+    /**
+     * this version is always shown others hidden unless expander is open
+     * @returns {String}
+     */
+    currentVersion: function() {
+      var repoVersion = this.get('content.stackVersions').findProperty('isCurrent');
+      return repoVersion.get('repoVersion') + " (" + repoVersion.get('displayStatus') + ")";
+    }.property('content.stackVersions'),
+
     /**
      * String with list of host components <code>displayName</code>
      * @returns {String}
      */
     versionlabels: function () {
-      return this.get('content.stackVersions').map(function (version) {
-        return Em.I18n.t('hosts.host.stackVersions.table.labels').format(version.get('version'), version.get('displayStatus'));
+      return this.get('content.stackVersions').filterProperty('isCurrent', false).map(function (version) {
+        return Em.I18n.t('hosts.host.stackVersions.table.labels').format(version.get('repoVersion'), version.get('displayStatus'));
       }).join("<br />");
     }.property('content.stackVersions.length'),