ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject git commit: AMBARI-6204. Selected main menu option is not highlighted first time. (akovalenko)
Date Mon, 23 Jun 2014 15:43:15 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk f71cfb007 -> 891b1205d


AMBARI-6204. Selected main menu option is not highlighted first time. (akovalenko)


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

Branch: refs/heads/trunk
Commit: 891b1205d33a2291debd6fadeeabf4adaae4f63c
Parents: f71cfb0
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Mon Jun 23 18:43:08 2014 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Mon Jun 23 18:43:08 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/views/main/menu.js | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/891b1205/ambari-web/app/views/main/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js
index e17f3f5..9ac0f40 100644
--- a/ambari-web/app/views/main/menu.js
+++ b/ambari-web/app/views/main/menu.js
@@ -71,25 +71,26 @@ App.MainMenuView = Em.CollectionView.extend({
      *    Adds observer on lastSetURL and calls navigation sync procedure
      */
   didInsertElement:function () {
-    App.router.location.addObserver('lastSetURL', this, 'renderOnRoute');
     this.renderOnRoute();
   },
 
   /**
    *    Syncs navigation menu with requested URL
    */
-  renderOnRoute:function () {
-    var last_url = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/, '');
-    if (last_url.substr(1, 4) !== 'main' || !this._childViews) {
-      return;
+  renderOnRoute: function () {
+    if (App.router.get('clusterController.isLoaded')) {
+      var last_url = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/, '');
+      if (last_url.substr(1, 4) !== 'main' || !this._childViews) {
+        return;
+      }
+      var reg = /^\/main\/([a-z]+)/g;
+      var sub_url = reg.exec(last_url);
+      var chunk = (null != sub_url) ? sub_url[1] : 'dashboard';
+      $.each(this._childViews, function () {
+        this.set('active', this.get('content.routing') == chunk ? "active" : "");
+      });
     }
-    var reg = /^\/main\/([a-z]+)/g;
-    var sub_url = reg.exec(last_url);
-    var chunk = (null != sub_url) ? sub_url[1] : 'dashboard';
-    $.each(this._childViews, function () {
-      this.set('active', this.get('content.routing') == chunk ? "active" : "");
-    });
-  },
+  }.observes('App.router.location.lastSetURL', 'App.router.clusterController.isLoaded'),
 
   itemViewClass:Em.View.extend({
 


Mime
View raw message