mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Render result tracebacks as stdout
This commit is contained in:
@@ -225,7 +225,7 @@ class JobOutput extends Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
contentError: null,
|
contentError: null,
|
||||||
deletionError: null,
|
deletionError: null,
|
||||||
hasContentLoading: true,
|
hasContentLoading: !props?.job?.result_traceback,
|
||||||
results: {},
|
results: {},
|
||||||
currentlyLoading: [],
|
currentlyLoading: [],
|
||||||
remoteRowCount: 0,
|
remoteRowCount: 0,
|
||||||
@@ -241,6 +241,7 @@ class JobOutput extends Component {
|
|||||||
|
|
||||||
this._isMounted = false;
|
this._isMounted = false;
|
||||||
this.loadJobEvents = this.loadJobEvents.bind(this);
|
this.loadJobEvents = this.loadJobEvents.bind(this);
|
||||||
|
this.loadTracebackEvents = this.loadTracebackEvents.bind(this);
|
||||||
this.handleDeleteJob = this.handleDeleteJob.bind(this);
|
this.handleDeleteJob = this.handleDeleteJob.bind(this);
|
||||||
this.rowRenderer = this.rowRenderer.bind(this);
|
this.rowRenderer = this.rowRenderer.bind(this);
|
||||||
this.handleHostEventClick = this.handleHostEventClick.bind(this);
|
this.handleHostEventClick = this.handleHostEventClick.bind(this);
|
||||||
@@ -261,6 +262,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;
|
||||||
@@ -308,8 +311,32 @@ class JobOutput extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadTracebackEvents() {
|
||||||
|
// When a job has traceback results, render it as a job event
|
||||||
|
// with the traceback as the stdout text
|
||||||
|
const { job } = this.props;
|
||||||
|
const remoteRowCount = 1;
|
||||||
|
const results = [
|
||||||
|
{
|
||||||
|
counter: -1,
|
||||||
|
created: null,
|
||||||
|
event: null,
|
||||||
|
type: null,
|
||||||
|
stdout: job?.result_traceback || '',
|
||||||
|
start_line: 0,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
this._isMounted && this.setState({ results, remoteRowCount });
|
||||||
|
}
|
||||||
|
|
||||||
async loadJobEvents() {
|
async loadJobEvents() {
|
||||||
const { job, type } = this.props;
|
const { job, type } = this.props;
|
||||||
|
if (job.result_traceback) {
|
||||||
|
// Jobs with tracebacks don't have actual job events to show,
|
||||||
|
// so just render the traceback as stdout
|
||||||
|
this.loadTracebackEvents();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const loadRange = range(1, 50);
|
const loadRange = range(1, 50);
|
||||||
this._isMounted &&
|
this._isMounted &&
|
||||||
|
|||||||
Reference in New Issue
Block a user