ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gna...@apache.org
Subject ambari git commit: AMBARI-20641. Pig view fails to load when using ambari thru KNOX. (gauravn7)
Date Sat, 01 Apr 2017 03:30:14 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 1a08c4980 -> b88512e71


AMBARI-20641. Pig view fails to load when using ambari thru KNOX. (gauravn7)


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

Branch: refs/heads/trunk
Commit: b88512e719f894d9ab3d5cb956a29f21e44fc29a
Parents: 1a08c49
Author: Gaurav Nagar <grvngr@gmail.com>
Authored: Sat Apr 1 08:59:53 2017 +0530
Committer: Gaurav Nagar <grvngr@gmail.com>
Committed: Sat Apr 1 08:59:53 2017 +0530

----------------------------------------------------------------------
 .../pig/src/main/resources/ui/pig-web/app/app.js | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b88512e7/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js
index c683f72..35cce9d 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js
@@ -25,16 +25,19 @@ module.exports = Em.Application.create({
   errorLog: "",
 
   getNamespaceUrl: function() {
-    var parts = window.location.pathname.match(/\/[^\/]*/g);
-    var view = parts[1];
-    var version = '/versions' + parts[2];
-    var instance = parts[3];
-    if (parts.length == 4) { // version is not present
-      instance = parts[2];
+    var parts = window.location.pathname.split('/').filter(function (i) {
+      return i !== "";
+    });
+    var view = parts[parts.length - 3];
+    var version = '/versions/' + parts[parts.length - 2];
+    var instance = parts[parts.length - 1];
+
+    if (!/^(\d+\.){2,3}\d+$/.test(parts[parts.length - 2])) { // version is not present
+      instance = parts[parts.length - 2];
       version = '';
     }
-    var namespaceUrl = 'api/v1/views' + view + version + '/instances' + instance;
-    return namespaceUrl;
+    var namespaceUrl = 'api/v1/views/' + view + version + '/instances/' + instance;
+    return namespaceUrl.replace(/^\/|\/$/g, ''); //remove starting slash if proxied through
knox
   },
 
   Resolver: Ember.DefaultResolver.extend({


Mime
View raw message