Merge pull request #8726 from jakemcdermott/fix-8709

Show job traceback stdout and error details

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2021-02-03 19:42:09 +00:00 committed by GitHub
commit 54d63ee437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 3 deletions

View File

@ -133,13 +133,15 @@ function JobDetail({ job, i18n }) {
return (
<CardBody>
<DetailList>
{/* TODO: hookup status to websockets */}
<Detail
fullWidth={Boolean(job.job_explanation)}
label={i18n._(t`Status`)}
value={
<StatusDetailValue>
{job.status && <StatusIcon status={job.status} />}
{toTitleCase(job.status)}
{job.job_explanation
? job.job_explanation
: toTitleCase(job.status)}
</StatusDetailValue>
}
/>

View File

@ -261,6 +261,8 @@ class JobOutput extends Component {
this._isMounted = true;
this.loadJobEvents();
if (job.result_traceback) return;
connectJobSocket(job, data => {
if (data.counter && data.counter > this.jobSocketCounter) {
this.jobSocketCounter = data.counter;
@ -326,10 +328,32 @@ class JobOutput extends Component {
});
this._isMounted &&
this.setState(({ results }) => {
let countOffset = 1;
if (job?.result_traceback) {
const tracebackEvent = {
counter: -1,
created: null,
event: null,
type: null,
stdout: job?.result_traceback,
start_line: 0,
};
const firstIndex = newResults.findIndex(
jobEvent => jobEvent.counter === 1
);
if (firstIndex) {
const stdoutLines = newResults[firstIndex].stdout.split('\r\n');
stdoutLines[0] = tracebackEvent.stdout;
newResults[firstIndex].stdout = stdoutLines.join('\r\n');
} else {
countOffset += 1;
newResults.unshift(tracebackEvent);
}
}
newResults.forEach(jobEvent => {
results[jobEvent.counter] = jobEvent;
});
return { results, remoteRowCount: count + 1 };
return { results, remoteRowCount: count + countOffset };
});
} catch (err) {
this.setState({ contentError: err });