ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject ambari git commit: AMBARI-11725. Tez UI: Bookmarking capabilities are broken. (Sreenath Somarajapuram via yusaku)
Date Fri, 05 Jun 2015 19:13:44 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 b292893e1 -> 007ab5db6


AMBARI-11725. Tez UI: Bookmarking capabilities are broken. (Sreenath Somarajapuram via yusaku)


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

Branch: refs/heads/branch-2.1
Commit: 007ab5db6f69827a5eaedf7ed685b94d4203b35e
Parents: b292893
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Fri Jun 5 12:12:31 2015 -0700
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Fri Jun 5 12:13:33 2015 -0700

----------------------------------------------------------------------
 .../resources/ui/scripts/init-ambari-view.js    | 33 +++++++++++++-------
 1 file changed, 22 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/007ab5db/contrib/views/tez/src/main/resources/ui/scripts/init-ambari-view.js
----------------------------------------------------------------------
diff --git a/contrib/views/tez/src/main/resources/ui/scripts/init-ambari-view.js b/contrib/views/tez/src/main/resources/ui/scripts/init-ambari-view.js
index 12e0da6..615c727 100644
--- a/contrib/views/tez/src/main/resources/ui/scripts/init-ambari-view.js
+++ b/contrib/views/tez/src/main/resources/ui/scripts/init-ambari-view.js
@@ -72,6 +72,11 @@ function getQueryString(object) {
 function redirectionCheck() {
   var href = window.location.href;
 
+  // Ember expects the url to have /#/
+  if(href.indexOf('?') != -1 && href.indexOf('/#/') == -1) {
+    href = href.replace('?', '/#/?');
+  }
+
   // If opened outside ambari, redirect
   if(window.parent == window) {
     var hrefParts = href.split('/#/'),
@@ -82,11 +87,17 @@ function redirectionCheck() {
           queryParams[PATH_PARAM_NAME] = '/#/' + pathParts[0];
         }
 
-    window.location = '%@?%@'.fmt(
+    href = '%@?%@'.fmt(
       hrefParts[0].replace('/views/', '/#/main/views/'),
       getQueryString(queryParams)
     );
+  }
 
+  // Normalize href
+  href = href.replace(/\/\//g, '/').replace(':/', '://');
+
+  if(href != window.location.href) {
+    window.location = href;
     return true;
   }
 }
@@ -213,18 +224,15 @@ function loadParams() {
 }
 
 function onPathChange() {
-
   var path = window.location.hash.substr(2).trim(),
       pathParts = path.split('?'),
 
       parentUrlParts = window.parent.location.href.split('?'),
-      parentQueryParam = getQueryObject(parentUrlParts[1]);
+      parentQueryParam = getQueryObject(pathParts[1]);
 
-      $.extend(parentQueryParam, getQueryObject(pathParts[1]));
-      delete parentQueryParam[PATH_PARAM_NAME];
-      if(pathParts[0]) {
-        parentQueryParam[PATH_PARAM_NAME] = '/#/' + pathParts[0];
-      }
+  if(pathParts[0]) {
+    parentQueryParam[PATH_PARAM_NAME] = '/#/' + pathParts[0];
+  }
 
   path = getQueryString(parentQueryParam);
   window.parent.history.replaceState(
@@ -234,12 +242,15 @@ function onPathChange() {
   );
 }
 
+function scheduleChangeHandler(arguments) {
+  setTimeout(onPathChange, 100);
+}
+
 if(!redirectionCheck()) {
   App.ApplicationRoute.reopen({
     actions: {
-      didTransition: function (arguments) {
-        setTimeout(onPathChange, 100);
-      }
+      didTransition: scheduleChangeHandler,
+      queryParamsDidChange: scheduleChangeHandler
     }
   });
 


Mime
View raw message