ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject git commit: AMBARI-5718. View: Pig should not hardcode REST API with view name + instance name. (jaimin)
Date Fri, 09 May 2014 22:03:56 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.0 9032b6916 -> c2879de3f


AMBARI-5718. View: Pig should not hardcode REST API with view name + instance name. (jaimin)


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

Branch: refs/heads/branch-1.6.0
Commit: c2879de3fe277cdf5ac82b14955c70813d6e3323
Parents: 9032b69
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Fri May 9 15:03:23 2014 -0700
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Fri May 9 15:03:23 2014 -0700

----------------------------------------------------------------------
 .../src/main/resources/ui/pig-web/app/initialize.js  | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c2879de3/contrib/views/pig/src/main/resources/ui/pig-web/app/initialize.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/initialize.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/initialize.js
index 0f2424b..c1938e5 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/initialize.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/initialize.js
@@ -18,8 +18,21 @@
 
 var App = require('app');
 
+function getNamespaceUrl() {
+  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];
+    version = '';
+  }
+  var namespaceUrl = 'api/v1/views' + view + version + '/instances' + instance;
+  return namespaceUrl;
+}
+
 App.ApplicationAdapter = DS.RESTAdapter.extend({
-  namespace:'api/v1/views/PIG/instances/PIG_1',
+  namespace: getNamespaceUrl(),
   headers: {
    'X-Requested-By': 'ambari'
   }


Mime
View raw message