ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [1/2] ambari git commit: AMBARI-8731 Navigating to/from hosts causes increasing number of Versions tab. (ababiichuk)
Date Tue, 16 Dec 2014 18:25:03 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk d45f38641 -> 870030a44


AMBARI-8731 Navigating to/from hosts causes increasing number of Versions tab. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 870030a44c407b17d0bca62b82cb9320b4f1ca8b
Parents: a42be2c
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Tue Dec 16 16:49:11 2014 +0200
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Tue Dec 16 20:09:15 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/views/main/host/menu.js | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/870030a4/ambari-web/app/views/main/host/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/menu.js b/ambari-web/app/views/main/host/menu.js
index 485b95e..5762a1a 100644
--- a/ambari-web/app/views/main/host/menu.js
+++ b/ambari-web/app/views/main/host/menu.js
@@ -40,25 +40,18 @@ App.MainHostMenuView = Em.CollectionView.extend({
       routing: 'alerts',
       badgeText: '0',
       badgeClasses: 'label'
+    }),
+    Em.Object.create({
+      name: 'versions',
+      label: Em.I18n.t('hosts.host.menu.stackVersions'),
+      routing: 'stackVersions',
+      hidden: function() {
+        return !App.get('supports.stackUpgrade')
+      }.property('App.get.supports.stackUpgrade')
     })
   ],
 
   /**
-   * Add conditional menu options
-   */
-  setConditionalOptions: function () {
-    if (App.get('supports.stackUpgrade')) {
-      this.get('content').push(
-          Em.Object.create({
-            name: 'versions',
-            label: Em.I18n.t('hosts.host.menu.stackVersions'),
-            routing: 'stackVersions'
-          })
-      );
-    }
-  },
-
-  /**
    * Update Alerts menu option counter text and class
    */
   updateAlertCounter: function () {
@@ -79,7 +72,6 @@ App.MainHostMenuView = Em.CollectionView.extend({
 
   init: function () {
     this._super();
-    this.setConditionalOptions();
     this.updateAlertCounter();
     this.activateView();
   },
@@ -100,10 +92,10 @@ App.MainHostMenuView = Em.CollectionView.extend({
   itemViewClass: Em.View.extend({
     classNameBindings: ["active"],
     active: "",
-    template: Ember.Handlebars.compile('<a {{action hostNavigate view.content.routing
}} href="#"> {{unbound view.content.label}} ' +
+    template: Ember.Handlebars.compile('{{#unless view.content.hidden}}<a {{action hostNavigate
view.content.routing }} href="#"> {{unbound view.content.label}} ' +
     '{{#if view.content.badgeText}} ' +
     '<span {{bindAttr class="view.content.badgeClasses"}}> ' +
     '{{view.content.badgeText}}' +
-    '</span>  {{/if}}</a>')
+    '</span>  {{/if}}</a>{{/unless}}')
   })
 });
\ No newline at end of file


Mime
View raw message