You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2014/05/10 00:27:59 UTC
git commit: AMBARI-5719. View: Files should not hardcode REST API
with view name + instance name. (jaimin)
Repository: ambari
Updated Branches:
refs/heads/trunk d2265d00b -> d329dbcc6
AMBARI-5719. View: Files 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/d329dbcc
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d329dbcc
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d329dbcc
Branch: refs/heads/trunk
Commit: d329dbcc6a1dc92e7dadfd6d4619b9acc4794128
Parents: d2265d0
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Fri May 9 15:27:44 2014 -0700
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Fri May 9 15:27:44 2014 -0700
----------------------------------------------------------------------
.../views/files/src/main/resources/ui/app/adapter.js | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d329dbcc/contrib/views/files/src/main/resources/ui/app/adapter.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/adapter.js b/contrib/views/files/src/main/resources/ui/app/adapter.js
index 26be40b..9f7ca65 100644
--- a/contrib/views/files/src/main/resources/ui/app/adapter.js
+++ b/contrib/views/files/src/main/resources/ui/app/adapter.js
@@ -147,9 +147,22 @@ Ember.Inflector.inflector.uncountable('fileops');
Ember.Inflector.inflector.uncountable('download');
Ember.Inflector.inflector.uncountable('upload');
+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.Store = DS.Store.extend({
adapter: DS.RESTAdapter.extend({
- namespace:'api/v1/views/FILES/instances/FILES_1/resources/files',
+ namespace: getNamespaceUrl() + 'resources/files',
headers: {
'X-Requested-By': 'ambari'
},