Merge "Trust resource URLs in health-api for various environments"

This commit is contained in:
Zuul 2017-11-16 09:21:10 +00:00 committed by Gerrit Code Review
commit 33e5902a47
1 changed files with 66 additions and 53 deletions

View File

@ -57,12 +57,13 @@ servicesModule.config(httpProviderInterceptor);
/**
* @ngInject
*/
function HealthService($http, config) {
function HealthService($http, config, $sce) {
var service = {};
service.getRunsFromBuildName = function(buildName) {
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/build_name/' + buildName + '/runs', {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/build_name/' + buildName + '/runs'), {
params: {
}
});
@ -71,7 +72,8 @@ function HealthService($http, config) {
service.getTestsFromBuildName = function(buildName, options) {
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/build_name/' + buildName + '/test_runs', {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/build_name/' + buildName + '/test_runs'), {
cache: true,
params: angular.extend(options)
});
@ -80,7 +82,8 @@ function HealthService($http, config) {
service.getRunsGroupedByMetadataPerDatetime = function(key, options) {
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/runs/group_by/' + key, {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/runs/group_by/' + key), {
cache: true,
params: angular.extend(options)
});
@ -89,7 +92,8 @@ function HealthService($http, config) {
service.getRuns = function(options) {
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/runs', {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/runs'), {
params: angular.extend(options)
});
});
@ -97,7 +101,8 @@ function HealthService($http, config) {
service.getRunsForRunMetadataKey = function(runMetadataKey, value, options) {
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/runs/key/' + runMetadataKey + '/' + value, {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/runs/key/' + runMetadataKey + '/' + value), {
params: angular.extend(options)
});
});
@ -105,7 +110,8 @@ function HealthService($http, config) {
service.getTestsFromRun = function(runId) {
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/run/' + runId + '/tests', {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/run/' + runId + '/tests'), {
params: {}
});
});
@ -113,7 +119,8 @@ function HealthService($http, config) {
service.getRunTestRuns = function(runId) {
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/run/' + runId + '/test_runs', {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/run/' + runId + '/test_runs'), {
params: {}
});
});
@ -121,7 +128,8 @@ function HealthService($http, config) {
service.getTests = function() {
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/tests', {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/tests'), {
cache: true,
params: {}
});
@ -130,7 +138,8 @@ function HealthService($http, config) {
service.getRunMetadataKeys = function() {
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/runs/metadata/keys', {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/runs/metadata/keys'), {
cache: true,
params: {}
});
@ -139,7 +148,8 @@ function HealthService($http, config) {
service.getTestRunList = function(testId, options) {
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/test_runs/' + testId, {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/test_runs/' + testId), {
params: angular.extend(options)
});
});
@ -149,7 +159,8 @@ function HealthService($http, config) {
options = options || {};
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/runs/key/' + runMetadataKey + '/' + value + '/recent', {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/runs/key/' + runMetadataKey + '/' + value + '/recent'), {
cache: true,
params: angular.extend(options)
});
@ -158,9 +169,9 @@ function HealthService($http, config) {
service.getRecentFailedTests = function(options) {
options = options || {};
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/tests/recent/fail', {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/tests/recent/fail'), {
cache: true,
params: angular.extend(options)
});
@ -169,7 +180,8 @@ function HealthService($http, config) {
service.getTestPrefixes = function() {
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/tests/prefix', {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/tests/prefix'), {
cache: true,
params: {}
});
@ -180,7 +192,8 @@ function HealthService($http, config) {
options = options || {};
return config.get().then(function(config) {
return $http.jsonp(config.apiRoot + '/tests/prefix/' + prefix, {
return $http.jsonp($sce.trustAsResourceUrl(
config.apiRoot + '/tests/prefix/' + prefix), {
cache: true,
params: angular.extend(options)
});