atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suma...@apache.org
Subject incubator-atlas git commit: HDPDGI-232 [ATLAS-318] - Config file conatining API endpoint + all api calls to be centralized
Date Thu, 18 Feb 2016 01:24:55 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 64bda5a41 -> a2cc01c43


HDPDGI-232 [ATLAS-318] - Config file conatining API endpoint + all api calls to be centralized

Signed-off-by: Suma Shivaprasad <sumasai.shivaprasad@gmail.com>


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

Branch: refs/heads/master
Commit: a2cc01c4342ace7f7a3e3e254d7ede781f990318
Parents: 64bda5a
Author: Sanjay Patel <sanjayp@mprglobalsolutions.com>
Authored: Mon Dec 14 23:55:18 2015 +0530
Committer: Suma Shivaprasad <sumasai.shivaprasad@gmail.com>
Committed: Wed Feb 17 17:24:40 2016 -0800

----------------------------------------------------------------------
 dashboard/.jshintrc                             |  3 +-
 dashboard/gruntfile.js                          |  1 +
 dashboard/public/js/app.js                      |  4 +--
 dashboard/public/js/config.js                   | 36 ++++++++++++++++++++
 dashboard/public/modules/about/aboutResource.js |  4 +--
 .../public/modules/details/detailsResource.js   | 12 +++----
 .../public/modules/lineage/lineageResource.js   |  4 +--
 .../modules/navigation/navigationController.js  |  8 ++---
 .../modules/navigation/navigationResource.js    |  4 +--
 .../public/modules/search/searchResource.js     |  4 +--
 .../tags/definition/definitionTagsController.js |  8 ++---
 dashboard/public/modules/tags/tagsResource.js   |  4 +--
 12 files changed, 65 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/a2cc01c4/dashboard/.jshintrc
----------------------------------------------------------------------
diff --git a/dashboard/.jshintrc b/dashboard/.jshintrc
index f42738e..d0c794d 100644
--- a/dashboard/.jshintrc
+++ b/dashboard/.jshintrc
@@ -40,7 +40,8 @@
     "unused": true, // Warn unused variables.
     "globals": { // Globals variables.
         "angular": true,
-        "$": false
+        "$": false,
+        "baseUrl":true
     },
     "predef": [ // Extra globals.
         "define",

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/a2cc01c4/dashboard/gruntfile.js
----------------------------------------------------------------------
diff --git a/dashboard/gruntfile.js b/dashboard/gruntfile.js
index ef91408..ffe4767 100644
--- a/dashboard/gruntfile.js
+++ b/dashboard/gruntfile.js
@@ -95,6 +95,7 @@ module.exports = function(grunt) {
         dist: distPath + '/js/app.min.js',
         modules: grunt.file.expand(
             modulesPath + 'js/app.js',
+            modulesPath + 'js/config.js',
             modulesPath + 'js/routes.js',
             modulesPath + 'modules/**/*Module.js',
             modulesPath + 'modules/**/*.js',

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/a2cc01c4/dashboard/public/js/app.js
----------------------------------------------------------------------
diff --git a/dashboard/public/js/app.js b/dashboard/public/js/app.js
index b128ff1..d7b8ee5 100644
--- a/dashboard/public/js/app.js
+++ b/dashboard/public/js/app.js
@@ -51,8 +51,8 @@ angular.module('dgc').factory('lodash', ['$window',
     }
 ]).factory('HttpInterceptor', ['Global', function(Global) {
     return {
-        'request': function(config) {
-            if (config.url && (config.url.indexOf('api/atlas/') === 0 || config.url.indexOf('/api/atlas/')
=== 0)) {
+        'request': function(config) { 
+            if (config.url && (config.url.indexOf(baseUrl) === 0 || config.url.indexOf(baseUrl)
=== 0)) {
                 config.params = config.params || {};
                 config.params['user.name'] = Global.user;
             }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/a2cc01c4/dashboard/public/js/config.js
----------------------------------------------------------------------
diff --git a/dashboard/public/js/config.js b/dashboard/public/js/config.js
new file mode 100644
index 0000000..b09c5e4
--- /dev/null
+++ b/dashboard/public/js/config.js
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+var host = '',
+    port = '',
+    baseUrl = '/api/atlas/',
+    apiHost = (host!=='') ? host + ':' + port + baseUrl : baseUrl ;
+
+angular.module('dgc').constant('AtlasConfig', { 
+    API_ENDPOINTS: {
+        ABOUT: apiHost + 'admin/version',
+        GET_ENTITY: apiHost + 'entities',
+        ATTACH_DETACH_TRAITS:   'traits',
+        SCHEMA_LINEAGE_PREPEND: apiHost + 'lineage/hive/table',
+        SCHEMA_APPEND: 'schema',
+        GRAPH:  'graph',
+        TRAITS_LIST: apiHost + 'types?type=TRAIT',
+        SEARCH: apiHost + 'discovery/search/',
+        CREATE_TRAIT: apiHost + 'types'
+    }
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/a2cc01c4/dashboard/public/modules/about/aboutResource.js
----------------------------------------------------------------------
diff --git a/dashboard/public/modules/about/aboutResource.js b/dashboard/public/modules/about/aboutResource.js
index 44d97fa..8e12583 100644
--- a/dashboard/public/modules/about/aboutResource.js
+++ b/dashboard/public/modules/about/aboutResource.js
@@ -18,6 +18,6 @@
 
 'use strict';
 
-angular.module('dgc.about').factory('AboutResource', ['$resource', function($resource) {
-    return $resource('/api/atlas/admin/version', {});
+angular.module('dgc.about').factory('AboutResource', ['$resource', 'AtlasConfig', function($resource,
AtlasConfig) {
+    return $resource(AtlasConfig.API_ENDPOINTS.ABOUT, {});
 }]);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/a2cc01c4/dashboard/public/modules/details/detailsResource.js
----------------------------------------------------------------------
diff --git a/dashboard/public/modules/details/detailsResource.js b/dashboard/public/modules/details/detailsResource.js
index 651ffd5..445640e 100644
--- a/dashboard/public/modules/details/detailsResource.js
+++ b/dashboard/public/modules/details/detailsResource.js
@@ -18,8 +18,8 @@
 
 'use strict';
 
-angular.module('dgc.details').factory('DetailsResource', ['$resource', function($resource)
{
-    return $resource('/api/atlas/entities/:id', {}, {
+angular.module('dgc.details').factory('DetailsResource', ['$resource', 'AtlasConfig', function($resource,
AtlasConfig) {
+    return $resource(AtlasConfig.API_ENDPOINTS.GET_ENTITY +'/:id', {}, {
         get: {
             method: 'GET',
             transformResponse: function(data) {
@@ -31,16 +31,16 @@ angular.module('dgc.details').factory('DetailsResource', ['$resource',
function(
         },
         saveTag: {
             method: 'POST',
-            url: '/api/atlas/entities/:id/traits'
+            url : AtlasConfig.API_ENDPOINTS.GET_ENTITY + '/:id/' + AtlasConfig.API_ENDPOINTS.ATTACH_DETACH_TRAITS
         },
         detachTag : {
             method: 'DELETE',
-            url: '/api/atlas/entities/:id/traits/:tagName'
+            url : AtlasConfig.API_ENDPOINTS.GET_ENTITY + '/:id/' + AtlasConfig.API_ENDPOINTS.ATTACH_DETACH_TRAITS
+ '/:tagName'
         }
      });
 
-}]).factory('SchemaResource', ['$resource', function($resource) {
-    return $resource('/api/atlas/lineage/hive/table/:tableName/schema', {}, {
+}]).factory('SchemaResource', ['$resource','AtlasConfig', function($resource, AtlasConfig)
{
+    return $resource(AtlasConfig.API_ENDPOINTS.SCHEMA_LINEAGE_PREPEND + '/:tableName/' +
AtlasConfig.API_ENDPOINTS.SCHEMA_APPEND, {}, {
         get: {
             method: 'GET',
             transformResponse: function(data) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/a2cc01c4/dashboard/public/modules/lineage/lineageResource.js
----------------------------------------------------------------------
diff --git a/dashboard/public/modules/lineage/lineageResource.js b/dashboard/public/modules/lineage/lineageResource.js
index e729a35..3d93c23 100644
--- a/dashboard/public/modules/lineage/lineageResource.js
+++ b/dashboard/public/modules/lineage/lineageResource.js
@@ -18,6 +18,6 @@
 
 'use strict';
 
-angular.module('dgc.lineage').factory('LineageResource', ['$resource', function($resource)
{
-    return $resource('/api/atlas/lineage/hive/table/:tableName/:type/graph', {});
+angular.module('dgc.lineage').factory('LineageResource', ['$resource','AtlasConfig', function($resource,
AtlasConfig) {
+    return $resource(AtlasConfig.API_ENDPOINTS.SCHEMA_LINEAGE_PREPEND+'/:tableName/:type/'+AtlasConfig.API_ENDPOINTS.GRAPH,
{});
 }]);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/a2cc01c4/dashboard/public/modules/navigation/navigationController.js
----------------------------------------------------------------------
diff --git a/dashboard/public/modules/navigation/navigationController.js b/dashboard/public/modules/navigation/navigationController.js
index e21fd7e..55a2826 100644
--- a/dashboard/public/modules/navigation/navigationController.js
+++ b/dashboard/public/modules/navigation/navigationController.js
@@ -17,8 +17,8 @@
  */
 'use strict';
 
-angular.module('dgc.navigation').controller('NavigationController', ['$scope', 'NavigationResource',
'$cacheFactory',
-    function($scope, NavigationResource, $cacheFactory) {
+angular.module('dgc.navigation').controller('NavigationController', ['$scope', 'NavigationResource',
'$cacheFactory','AtlasConfig',
+    function($scope, NavigationResource, $cacheFactory,AtlasConfig) {
 
         $scope.updateVar = function(event) {
             $scope.$$prevSibling.query = angular.element(event.target).text();
@@ -31,12 +31,12 @@ angular.module('dgc.navigation').controller('NavigationController', ['$scope',
'
 
         setTimeout(function() {
          	var httpDefaultCache = $cacheFactory.get('$http');
-            httpDefaultCache.remove('/api/atlas/types?type=TRAIT');
+            httpDefaultCache.remove(AtlasConfig.API_ENDPOINTS.TRAITS_LIST);
         }, 3600000);
 
         $scope.refreshTags = function(){
         	var httpDefaultCache = $cacheFactory.get('$http');
-        	httpDefaultCache.remove('/api/atlas/types?type=TRAIT');
+        	httpDefaultCache.remove(AtlasConfig.API_ENDPOINTS.TRAITS_LIST);
         	$scope.leftnav = NavigationResource.get();
         }; 
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/a2cc01c4/dashboard/public/modules/navigation/navigationResource.js
----------------------------------------------------------------------
diff --git a/dashboard/public/modules/navigation/navigationResource.js b/dashboard/public/modules/navigation/navigationResource.js
index 65fe150..95afaa3 100644
--- a/dashboard/public/modules/navigation/navigationResource.js
+++ b/dashboard/public/modules/navigation/navigationResource.js
@@ -18,8 +18,8 @@
 
 'use strict';
 
-angular.module('dgc.navigation').factory('NavigationResource', ['$resource', function($resource)
{
-    return $resource('/api/atlas/types?type=TRAIT', {}, {
+angular.module('dgc.navigation').factory('NavigationResource', ['$resource','AtlasConfig',
function($resource, AtlasConfig) {
+    return $resource(AtlasConfig.API_ENDPOINTS.TRAITS_LIST, {}, {
         get: {
             'method': 'GET',
             'responseType': 'json',

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/a2cc01c4/dashboard/public/modules/search/searchResource.js
----------------------------------------------------------------------
diff --git a/dashboard/public/modules/search/searchResource.js b/dashboard/public/modules/search/searchResource.js
index 19de021..c5b80d5 100644
--- a/dashboard/public/modules/search/searchResource.js
+++ b/dashboard/public/modules/search/searchResource.js
@@ -18,8 +18,8 @@
 
 'use strict';
 
-angular.module('dgc.search').factory('SearchResource', ['$resource', function($resource)
{
-    return $resource('/api/atlas/discovery/search/', {}, {
+angular.module('dgc.search').factory('SearchResource', ['$resource', 'AtlasConfig', function($resource,
AtlasConfig) {
+    return $resource(AtlasConfig.API_ENDPOINTS.SEARCH, {}, {
         search: {
             'method': 'GET',
             'responseType': 'json',

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/a2cc01c4/dashboard/public/modules/tags/definition/definitionTagsController.js
----------------------------------------------------------------------
diff --git a/dashboard/public/modules/tags/definition/definitionTagsController.js b/dashboard/public/modules/tags/definition/definitionTagsController.js
index 39b256b..44e5375 100755
--- a/dashboard/public/modules/tags/definition/definitionTagsController.js
+++ b/dashboard/public/modules/tags/definition/definitionTagsController.js
@@ -17,8 +17,8 @@
  */
 'use strict';
 
-angular.module('dgc.tags.definition').controller('DefinitionTagsController', ['$scope', '$resource',
'$state', '$stateParams', 'lodash', 'AttributeDefinition', 'TagClasses', 'TagsResource', 'NotificationService',
'NavigationResource', '$cacheFactory',
-    function($scope, $resource, $state, $stateParams, _, AttributeDefinition, Categories,
TagsResource, NotificationService, NavigationResource, $cacheFactory) {
+angular.module('dgc.tags.definition').controller('DefinitionTagsController', ['$scope', '$resource',
'$state', '$stateParams', 'lodash', 'AttributeDefinition', 'TagClasses', 'TagsResource', 'NotificationService',
'NavigationResource', '$cacheFactory','AtlasConfig',
+    function($scope, $resource, $state, $stateParams, _, AttributeDefinition, Categories,
TagsResource, NotificationService, NavigationResource, $cacheFactory,AtlasConfig) {
         $scope.categoryList = Categories;
         $scope.category = 'TRAIT';
         $scope.tagModel = {
@@ -47,7 +47,7 @@ angular.module('dgc.tags.definition').controller('DefinitionTagsController',
['$
 
         $scope.refreshTags = function(){
             var httpDefaultCache = $cacheFactory.get('$http');
-            httpDefaultCache.remove('/api/atlas/types?type=TRAIT');
+            httpDefaultCache.remove(AtlasConfig.API_ENDPOINTS.TRAITS_LIST);
             $scope.typesList = NavigationResource.get();
         }; 
 
@@ -65,7 +65,7 @@ angular.module('dgc.tags.definition').controller('DefinitionTagsController',
['$
                     .then(function TagCreateSuccess() {
                         NotificationService.info('"' + $scope.tagModel.typeName + '" has
been created', false);
                         var httpDefaultCache = $cacheFactory.get('$http');
-                        httpDefaultCache.remove('/api/atlas/types?type=TRAIT');
+                        httpDefaultCache.remove(AtlasConfig.API_ENDPOINTS.TRAITS_LIST);
                         $scope.typesList = NavigationResource.get();
                         $scope.reset();
                     }).catch(function TagCreateFailed(error) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/a2cc01c4/dashboard/public/modules/tags/tagsResource.js
----------------------------------------------------------------------
diff --git a/dashboard/public/modules/tags/tagsResource.js b/dashboard/public/modules/tags/tagsResource.js
index 3434034..98a636b 100755
--- a/dashboard/public/modules/tags/tagsResource.js
+++ b/dashboard/public/modules/tags/tagsResource.js
@@ -18,8 +18,8 @@
 
 'use strict';
 
-angular.module('dgc.tags').factory('TagsResource', ['$resource', function($resource) {
-    return $resource('/api/atlas/types/:id', {}, {
+angular.module('dgc.tags').factory('TagsResource', ['$resource', 'AtlasConfig', function($resource,
AtlasConfig) {
+    return $resource(AtlasConfig.API_ENDPOINTS.CREATE_TRAIT + '/:id', {}, {
         query: {
             method: 'GET',
             transformResponse: function(data) {


Mime
View raw message