You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2014/06/23 17:43:15 UTC
git commit: AMBARI-6204. Selected main menu option is not highlighted
first time. (akovalenko)
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 <ak...@hortonworks.com>
Authored: Mon Jun 23 18:43:08 2014 +0300
Committer: Aleksandr Kovalenko <ak...@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({