diff --git a/awx/ui/static/css/ansible-ui.css b/awx/ui/static/css/ansible-ui.css index e5e8b9cf63..64acfb83c0 100644 --- a/awx/ui/static/css/ansible-ui.css +++ b/awx/ui/static/css/ansible-ui.css @@ -12,7 +12,6 @@ } body { - //color: #171717; color: #171717; padding-top: 60px; } diff --git a/awx/ui/static/lib/ansible/rest-services.js b/awx/ui/static/lib/ansible/rest-services.js index 9a8d570699..8aa7fcf854 100644 --- a/awx/ui/static/lib/ansible/rest-services.js +++ b/awx/ui/static/lib/ansible/rest-services.js @@ -11,13 +11,7 @@ angular.module('RestServices',['ngCookies','AuthService']) setUrl: function (url) { this.url = url; }, - - //auth: { 'Authorization': 'Token ' + Authorization.getToken() }, - auth: function() { - var token = Authorization.getToken(); - return { 'Authorization': 'Token ' + token } - }, - + pReplace: function() { //in our url, replace :xx params with a value, assuming //we can find it in user supplied params. @@ -35,30 +29,53 @@ angular.module('RestServices',['ngCookies','AuthService']) args = (args) ? args : {}; this.params = (args.params) ? args.params : null; this.pReplace(); - return $http({method: 'GET', - url: this.url, - headers: this.auth(), - params: this.params - }); + var token = Authorization.getToken(); + if (token) { + return $http({method: 'GET', + url: this.url, + headers: { 'Authorization': 'Token ' + token }, + params: this.params + }); + } + else { + return false; + } }, post: function(data) { - return $http({method: 'POST', - url: this.url, - headers: this.auth(), - data: data }); + var token = Authorization.getToken(); + if (token) { + return $http({method: 'POST', + url: this.url, + headers: { 'Authorization': 'Token ' + token }, + data: data }); + } + else { + return false; + } }, put: function(data) { - return $http({method: 'PUT', - url: this.url, - headers: this.auth(), - data: data }); - + var token = Authorization.getToken(); + if (token) { + return $http({method: 'PUT', + url: this.url, + headers: { 'Authorization': 'Token ' + token }, + data: data }); + } + else { + return false; + } }, destroy: function(data) { - return $http({method: 'DELETE', - url: this.url, - headers: this.auth(), - data: data}); + var token = Authorization.getToken(); + if (token) { + return $http({method: 'DELETE', + url: this.url, + headers: { 'Authorization': 'Token ' + token }, + data: data}); + } + else { + return false; + } } } }]);