Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!branch || !pipeline) {
return null;
}
const { router, location } = this.context;
const openRunDetails = newUrl => {
// TODO: Move this out of this method
location.pathname = newUrl;
router.push(location);
};
const latestRun = branch.latestRun;
if (!latestRun) {
return noRun(branch, openRunDetails, t, this.context.store, columns);
}
const cleanBranchName = decodeURIComponent(branch.name);
const runDetailsUrl = UrlBuilder.buildRunUrl(branch.organization, pipeline.fullName, cleanBranchName, latestRun.id, 'pipeline');
const statusIndicator = (
);
const runMessage = ;
const completed = (
// early out
if (!this.context.params || !run) {
return null;
}
const { router, location, params } = this.context;
const { pipeline, setTitle, t, locale } = this.props;
const { isVisible } = this.state;
if (!run || !pipeline) {
this.props.setTitle(translate('common.pager.loading', { defaultValue: 'Loading...' }));
return null;
}
const baseUrl = UrlBuilder.buildRunUrl(params.organization, params.pipeline, params.branch, params.runId, null);
logger.debug('params', params.organization, params.pipeline, params.branch, params.runId);
const currentRun = new RunRecord(run);
const computedTitle = `${currentRun.organization} / ${pipeline.fullName} / ${params.pipeline === params.branch ? '' : `${params.branch} / `} #${
currentRun.id
}`;
setTitle(computedTitle);
const switchRunDetails = newUrl => {
location.pathname = newUrl;
router.push(location);
};
const base = { base: baseUrl };
const failureCount = Math.min(99, (testSummary && parseInt(testSummary.failed)) || 0);
const testsBadge = failureCount > 0 && <div>{failureCount}</div>;
render() {
const { run, pipeline, t, locale, getTimes, columns, isMultibranch } = this.props;
if (!run || !pipeline) {
return null;
}
const resultRun = run.result === 'UNKNOWN' ? run.state : run.result;
const runDetailsUrl = UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, decodeURIComponent(run.pipeline), run.id, 'pipeline');
const changesUrl = UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, decodeURIComponent(run.pipeline), run.id, 'changes');
const { durationInMillis, endTime, startTime } = getTimes({
result: resultRun,
durationInMillis: run.durationInMillis,
startTime: run.startTime,
endTime: run.endTime,
});
const isRunning = run.state === 'RUNNING' || run.state === 'PAUSED' || run.state === 'QUEUED';
const branchName = isMultibranch && decodeURIComponent(run.pipeline);
const dataProps = {
'data-pipeline': pipeline.name,
'data-runid': run.id,
};
if (isMultibranch) {
render() {
const { run, pipeline, branchName, t } = this.props;
const nextRunId = getRunId(run._links.nextRun) || '';
const prevRunId = getRunId(run._links.prevRun) || '';
const nextRunUrl = nextRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, nextRunId, 'pipeline') : '';
const prevRunUrl = prevRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, prevRunId, 'pipeline') : '';
return (
<span>
{prevRunUrl && (
)}
{nextRunUrl && (
)}
</span>
render() {
const { run, pipeline, branchName, t } = this.props;
const nextRunId = getRunId(run._links.nextRun) || '';
const prevRunId = getRunId(run._links.prevRun) || '';
const nextRunUrl = nextRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, nextRunId, 'pipeline') : '';
const prevRunUrl = prevRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, prevRunId, 'pipeline') : '';
return (
<span>
{prevRunUrl && (
)}
{nextRunUrl && (
)}
</span>
);
render() {
const { run, pipeline, branchName, t } = this.props;
const nextRunId = run._links.nextRun ? /[\/].*runs\/*([0-9]*)/g.exec(run._links.nextRun.href)[1] : '';
const prevRunId = run._links.prevRun ? /[\/].*runs\/*([0-9]*)/g.exec(run._links.prevRun.href)[1] : '';
const nextRunUrl = nextRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, nextRunId, 'pipeline') : '';
const prevRunUrl = prevRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, prevRunId, 'pipeline') : '';
return (
<span>
{prevRunUrl && (
)}
{nextRunUrl && (
)}
</span>
);
render() {
const { run, pipeline, branchName, t } = this.props;
const nextRunId = run._links.nextRun ? /[\/].*runs\/*([0-9]*)/g.exec(run._links.nextRun.href)[1] : '';
const prevRunId = run._links.prevRun ? /[\/].*runs\/*([0-9]*)/g.exec(run._links.prevRun.href)[1] : '';
const nextRunUrl = nextRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, nextRunId, 'pipeline') : '';
const prevRunUrl = prevRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, prevRunId, 'pipeline') : '';
return (
<span>
{prevRunUrl && (
)}
{nextRunUrl && (
)}
</span>
navigateToChanges = () => {
const {
location,
params: { organization, pipeline, branch, runId },
} = this.context;
const changesUrl = UrlBuilder.buildRunUrl(organization, pipeline, branch, runId, 'changes');
location.pathname = changesUrl;
this.context.router.push(location);
};
render() {
const { run, pipeline, t, locale, getTimes, columns, isMultibranch } = this.props;
if (!run || !pipeline) {
return null;
}
const resultRun = run.result === 'UNKNOWN' ? run.state : run.result;
const runDetailsUrl = UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, decodeURIComponent(run.pipeline), run.id, 'pipeline');
const changesUrl = UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, decodeURIComponent(run.pipeline), run.id, 'changes');
const { durationInMillis, endTime, startTime } = getTimes({
result: resultRun,
durationInMillis: run.durationInMillis,
startTime: run.startTime,
endTime: run.endTime,
});
const isRunning = run.state === 'RUNNING' || run.state === 'PAUSED' || run.state === 'QUEUED';
const branchName = isMultibranch && decodeURIComponent(run.pipeline);
const dataProps = {
'data-pipeline': pipeline.name,
'data-runid': run.id,
};
render() {
const { pr, t, locale, pipeline: contextPipeline, columns } = this.props;
if (!pr || !pr.pullRequest || !contextPipeline) {
return null;
}
const { latestRun, pullRequest, name } = pr;
if (!latestRun) {
return noRun(pr, this.openRunDetails, t, columns);
}
const result = latestRun.result === 'UNKNOWN' ? latestRun.state : latestRun.result;
const { fullName, organization } = contextPipeline;
const runDetailsUrl = UrlBuilder.buildRunUrl(organization, fullName, decodeURIComponent(latestRun.pipeline), latestRun.id, 'pipeline');
const statusIndicator = (
);
const completed = (