Trust resource URLs in health-api for various environments
This commit makes resource the URLs in health-api.js for various environments such as in local development environments, downstream environments. The URLs should be trusted because the apiRoot value comes from the config. If you'd like to know more details of $scedelegateprovider, you can see the documents at angularjs site[1]. [1] https://docs.angularjs.org/api/ng/provider/$sceDelegateProvider Change-Id: Iec67c1a5236c9c8febfc83188db71754f895bff6
This commit is contained in:
parent
14bfbbfc09
commit
8bcc93b690
@ -57,91 +57,101 @@ servicesModule.config(httpProviderInterceptor);
|
|||||||
/**
|
/**
|
||||||
* @ngInject
|
* @ngInject
|
||||||
*/
|
*/
|
||||||
function HealthService($http, config) {
|
function HealthService($http, config, $sce) {
|
||||||
var service = {};
|
var service = {};
|
||||||
|
|
||||||
service.getRunsFromBuildName = function(buildName) {
|
service.getRunsFromBuildName = function(buildName) {
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/build_name/' + buildName + '/runs', {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
params: {
|
config.apiRoot + '/build_name/' + buildName + '/runs'), {
|
||||||
}
|
params: {
|
||||||
});
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
service.getTestsFromBuildName = function(buildName, options) {
|
service.getTestsFromBuildName = function(buildName, options) {
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/build_name/' + buildName + '/test_runs', {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
cache: true,
|
config.apiRoot + '/build_name/' + buildName + '/test_runs'), {
|
||||||
params: angular.extend(options)
|
cache: true,
|
||||||
});
|
params: angular.extend(options)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
service.getRunsGroupedByMetadataPerDatetime = function(key, options) {
|
service.getRunsGroupedByMetadataPerDatetime = function(key, options) {
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/runs/group_by/' + key, {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
cache: true,
|
config.apiRoot + '/runs/group_by/' + key), {
|
||||||
params: angular.extend(options)
|
cache: true,
|
||||||
});
|
params: angular.extend(options)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
service.getRuns = function(options) {
|
service.getRuns = function(options) {
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/runs', {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
params: angular.extend(options)
|
config.apiRoot + '/runs'), {
|
||||||
});
|
params: angular.extend(options)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
service.getRunsForRunMetadataKey = function(runMetadataKey, value, options) {
|
service.getRunsForRunMetadataKey = function(runMetadataKey, value, options) {
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/runs/key/' + runMetadataKey + '/' + value, {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
params: angular.extend(options)
|
config.apiRoot + '/runs/key/' + runMetadataKey + '/' + value), {
|
||||||
});
|
params: angular.extend(options)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
service.getTestsFromRun = function(runId) {
|
service.getTestsFromRun = function(runId) {
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/run/' + runId + '/tests', {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
params: {}
|
config.apiRoot + '/run/' + runId + '/tests'), {
|
||||||
});
|
params: {}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
service.getRunTestRuns = function(runId) {
|
service.getRunTestRuns = function(runId) {
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/run/' + runId + '/test_runs', {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
params: {}
|
config.apiRoot + '/run/' + runId + '/test_runs'), {
|
||||||
});
|
params: {}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
service.getTests = function() {
|
service.getTests = function() {
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/tests', {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
cache: true,
|
config.apiRoot + '/tests'), {
|
||||||
params: {}
|
cache: true,
|
||||||
});
|
params: {}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
service.getRunMetadataKeys = function() {
|
service.getRunMetadataKeys = function() {
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/runs/metadata/keys', {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
cache: true,
|
config.apiRoot + '/runs/metadata/keys'), {
|
||||||
params: {}
|
cache: true,
|
||||||
});
|
params: {}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
service.getTestRunList = function(testId, options) {
|
service.getTestRunList = function(testId, options) {
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/test_runs/' + testId, {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
params: angular.extend(options)
|
config.apiRoot + '/test_runs/' + testId), {
|
||||||
});
|
params: angular.extend(options)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -149,30 +159,32 @@ function HealthService($http, config) {
|
|||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/runs/key/' + runMetadataKey + '/' + value + '/recent', {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
cache: true,
|
config.apiRoot + '/runs/key/' + runMetadataKey + '/' + value + '/recent'), {
|
||||||
params: angular.extend(options)
|
cache: true,
|
||||||
});
|
params: angular.extend(options)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
service.getRecentFailedTests = function(options) {
|
service.getRecentFailedTests = function(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/tests/recent/fail', {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
cache: true,
|
config.apiRoot + '/tests/recent/fail'), {
|
||||||
params: angular.extend(options)
|
cache: true,
|
||||||
});
|
params: angular.extend(options)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
service.getTestPrefixes = function() {
|
service.getTestPrefixes = function() {
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/tests/prefix', {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
cache: true,
|
config.apiRoot + '/tests/prefix'), {
|
||||||
params: {}
|
cache: true,
|
||||||
});
|
params: {}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -180,10 +192,11 @@ function HealthService($http, config) {
|
|||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
return config.get().then(function(config) {
|
return config.get().then(function(config) {
|
||||||
return $http.jsonp(config.apiRoot + '/tests/prefix/' + prefix, {
|
return $http.jsonp($sce.trustAsResourceUrl(
|
||||||
cache: true,
|
config.apiRoot + '/tests/prefix/' + prefix), {
|
||||||
params: angular.extend(options)
|
cache: true,
|
||||||
});
|
params: angular.extend(options)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user