[JENKINS-36674] fix bad encoding in REST URL by creating URL based off HAL link

This commit is contained in:
Cliff Meyers 2016-07-14 16:30:30 -04:00
parent 682860a358
commit 4dd4bdde04
2 changed files with 9 additions and 26 deletions

View File

@ -18,18 +18,9 @@ const EmptyState = () => (
*/
export class RunDetailsTests extends Component {
componentWillMount() {
if (this.context.config) {
this.props.fetchTestResults(
this.context.config,
{
isMultiBranch: this.props.isMultiBranch,
organization: this.props.params.organization,
pipeline: this.props.params.pipeline,
branch: this.props.params.branch,
runId: this.props.params.runId,
}
);
}
this.props.fetchTestResults(
this.props.result
);
}
componentWillUnmount() {

View File

@ -1,11 +1,10 @@
import keymirror from 'keymirror';
import fetch from 'isomorphic-fetch';
import { State } from '../components/records';
import UrlConfig from '../config';
import { getNodesInformation } from '../util/logDisplayHelper';
import { calculateStepsBaseUrl, calculateLogUrl, calculateNodeBaseUrl, buildUrl } from '../util/UrlUtils';
import { calculateStepsBaseUrl, calculateLogUrl, calculateNodeBaseUrl } from '../util/UrlUtils';
// main actin logic
export const ACTION_TYPES = keymirror({
@ -798,17 +797,10 @@ export const actions = {
};
},
fetchTestResults(config, runDetails) {
fetchTestResults(run) {
return (dispatch) => {
const baseUrl = `${config.getAppURLBase()}/rest/organizations/`;
let url;
if (runDetails.isMultiBranch) {
// eslint-disable-next-line max-len
url = `${baseUrl}${buildUrl(runDetails.organization, 'pipelines', runDetails.pipeline, 'branches', runDetails.branch, 'runs', runDetails.runId)}/testReport/result`;
} else {
// eslint-disable-next-line max-len
url = `${baseUrl}${buildUrl(runDetails.organization, 'pipelines', runDetails.branch, 'runs', runDetails.runId)}/testReport/result`;
}
const baseUrl = UrlConfig.jenkinsRootURL;
const url = `${baseUrl}${run._links.self.href}testReport/result`;
return dispatch(actions.generateData(
url,