mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 11:50:42 -03:30
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:
commit
54d63ee437
@ -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>
|
||||
}
|
||||
/>
|
||||
|
||||
@ -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 });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user