atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From venkat...@apache.org
Subject [2/8] incubator-atlas git commit: HDPDGI-85: Vishal: Pass user.name for each backend api when available from incoming request
Date Mon, 22 Jun 2015 21:47:57 GMT
HDPDGI-85: Vishal: Pass user.name for each backend api when available from incoming request


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/5da40182
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/5da40182
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/5da40182

Branch: refs/heads/master
Commit: 5da401828aa983e84e99bec06075934e45046d9e
Parents: 970115d
Author: Vishal Kadam <vishal.4kadam@gmail.com>
Authored: Thu Jun 18 18:59:42 2015 -0400
Committer: Vishal Kadam <vishal.4kadam@gmail.com>
Committed: Thu Jun 18 19:10:19 2015 -0400

----------------------------------------------------------------------
 dashboard/v2/public/js/app.js                   | 20 ++++++++++++++++----
 .../modules/navigation/navigationResource.js    |  2 +-
 2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/5da40182/dashboard/v2/public/js/app.js
----------------------------------------------------------------------
diff --git a/dashboard/v2/public/js/app.js b/dashboard/v2/public/js/app.js
index 9ab6519..1bdb316 100755
--- a/dashboard/v2/public/js/app.js
+++ b/dashboard/v2/public/js/app.js
@@ -38,15 +38,27 @@ angular.module('dgc').factory('lodash', ['$window',
     function($window) {
         return $window.d3;
     }
-]).factory('Global', ['$window',
-    function($window) {
+]).factory('Global', ['$window', '$location',
+    function($window, $location) {
         return {
-            user: $window.user,
+            user: $location.search()['user.name'],
             authenticated: !!$window.user,
             renderErrors: $window.renderErrors
         };
     }
-]).run(['$rootScope', 'Global', 'NotificationService', 'lodash', 'd3', function($rootScope,
Global, NotificationService, lodash, d3) {
+]).factory('HttpInterceptor', ['Global', function(Global) {
+    return {
+        'request': function(config) {
+            if (config.url && (config.url.indexOf('api/atlas/') === 0 || config.url.indexOf('/api/atlas/')
=== 0)) {
+                config.params = config.params || {};
+                config.params['user.name'] = Global.user;
+            }
+            return config;
+        }
+    };
+}]).config(['$httpProvider', function($httpProvider) {
+    $httpProvider.interceptors.push('HttpInterceptor');
+}]).run(['$rootScope', 'Global', 'NotificationService', 'lodash', 'd3', function($rootScope,
Global, NotificationService, lodash, d3) {
     var errors = Global.renderErrors;
     if (angular.isArray(errors) || angular.isObject(errors)) {
         lodash.forEach(errors, function(err) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/5da40182/dashboard/v2/public/modules/navigation/navigationResource.js
----------------------------------------------------------------------
diff --git a/dashboard/v2/public/modules/navigation/navigationResource.js b/dashboard/v2/public/modules/navigation/navigationResource.js
index 67f510f..3d9797d 100644
--- a/dashboard/v2/public/modules/navigation/navigationResource.js
+++ b/dashboard/v2/public/modules/navigation/navigationResource.js
@@ -19,7 +19,7 @@
 'use strict';
 
 angular.module('dgc.navigation').factory('NavigationResource', ['$resource', function($resource)
{
-    return $resource('api/atlas/types?type=TRAIT', {}, {
+    return $resource('/api/atlas/types?type=TRAIT', {}, {
         get: {
             'method': 'GET',
             'responseType': 'json',


Mime
View raw message