mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02: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:
@@ -133,13 +133,15 @@ function JobDetail({ job, i18n }) {
|
|||||||
return (
|
return (
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<DetailList>
|
<DetailList>
|
||||||
{/* TODO: hookup status to websockets */}
|
|
||||||
<Detail
|
<Detail
|
||||||
|
fullWidth={Boolean(job.job_explanation)}
|
||||||
label={i18n._(t`Status`)}
|
label={i18n._(t`Status`)}
|
||||||
value={
|
value={
|
||||||
<StatusDetailValue>
|
<StatusDetailValue>
|
||||||
{job.status && <StatusIcon status={job.status} />}
|
{job.status && <StatusIcon status={job.status} />}
|
||||||
{toTitleCase(job.status)}
|
{job.job_explanation
|
||||||
|
? job.job_explanation
|
||||||
|
: toTitleCase(job.status)}
|
||||||
</StatusDetailValue>
|
</StatusDetailValue>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -261,6 +261,8 @@ class JobOutput extends Component {
|
|||||||
this._isMounted = true;
|
this._isMounted = true;
|
||||||
this.loadJobEvents();
|
this.loadJobEvents();
|
||||||
|
|
||||||
|
if (job.result_traceback) return;
|
||||||
|
|
||||||
connectJobSocket(job, data => {
|
connectJobSocket(job, data => {
|
||||||
if (data.counter && data.counter > this.jobSocketCounter) {
|
if (data.counter && data.counter > this.jobSocketCounter) {
|
||||||
this.jobSocketCounter = data.counter;
|
this.jobSocketCounter = data.counter;
|
||||||
@@ -326,10 +328,32 @@ class JobOutput extends Component {
|
|||||||
});
|
});
|
||||||
this._isMounted &&
|
this._isMounted &&
|
||||||
this.setState(({ results }) => {
|
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 => {
|
newResults.forEach(jobEvent => {
|
||||||
results[jobEvent.counter] = jobEvent;
|
results[jobEvent.counter] = jobEvent;
|
||||||
});
|
});
|
||||||
return { results, remoteRowCount: count + 1 };
|
return { results, remoteRowCount: count + countOffset };
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.setState({ contentError: err });
|
this.setState({ contentError: err });
|
||||||
|
|||||||
Reference in New Issue
Block a user