AMBARI-9069 Hosts page: Versions column should show actual version number. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a9ca6fac Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a9ca6fac Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a9ca6fac Branch: refs/heads/trunk Commit: a9ca6fac4f364a17f9e1b3abc5b4a6085d01b338 Parents: c4d131f Author: aBabiichuk <[email protected]> Authored: Fri Jan 9 18:37:26 2015 +0200 Committer: aBabiichuk <[email protected]> Committed: Fri Jan 9 19:23:35 2015 +0200 ---------------------------------------------------------------------- ambari-web/app/styles/application.less | 6 +++--- ambari-web/app/templates/main/host.hbs | 10 ++++++---- ambari-web/app/views/main/host.js | 22 ++++++++++++++++++++-- 3 files changed, 29 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/a9ca6fac/ambari-web/app/styles/application.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less index 3410a1b..8a5bac9 100644 --- a/ambari-web/app/styles/application.less +++ b/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, http://git-wip-us.apache.org/repos/asf/ambari/blob/a9ca6fac/ambari-web/app/templates/main/host.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/host.hbs b/ambari-web/app/templates/main/host.hbs index 1ae508e..db18f0c 100644 --- a/ambari-web/app/templates/main/host.hbs +++ b/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}}} http://git-wip-us.apache.org/repos/asf/ambari/blob/a9ca6fac/ambari-web/app/views/main/host.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/host.js b/ambari-web/app/views/main/host.js index d85296b..72aeacb 100644 --- a/ambari-web/app/views/main/host.js +++ b/ambari-web/app/views/main/host.js @@ -585,12 +585,30 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, { }.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'),
