Skip to content

Commit

Permalink
Merge pull request #8726 from jakemcdermott/fix-8709
Browse files Browse the repository at this point in the history
Show job traceback stdout and error details

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
  • Loading branch information
2 parents 40cf4ff + e7719e3 commit 54d63ee
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
6 changes: 4 additions & 2 deletions awx/ui_next/src/screens/Job/JobDetail/JobDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
}
/>
Expand Down
26 changes: 25 additions & 1 deletion awx/ui_next/src/screens/Job/JobOutput/JobOutput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 });
Expand Down

0 comments on commit 54d63ee

Please sign in to comment.