diff --git a/awx/ui/client/features/output/index.controller.js b/awx/ui/client/features/output/index.controller.js index 4b44fc2c0f..76047c1078 100644 --- a/awx/ui/client/features/output/index.controller.js +++ b/awx/ui/client/features/output/index.controller.js @@ -25,11 +25,11 @@ const TIME_EVENTS = [ ]; function JobsIndexController (job, _$sce_, _$timeout_, _$scope_, _$compile_) { - ansi = new Ansi(); $timeout = _$timeout_; $sce = _$sce_; $compile = _$compile_; $scope = _$scope_; + ansi = new Ansi(); const vm = this || {}; const events = job.get('related.job_events.results'); @@ -73,103 +73,104 @@ function parseLine (event) { const { stdout } = event; const lines = stdout.split('\r\n'); - let eventLn = event.start_line; - let ln = event.start_line + 1; + let eventLine = event.start_line; + let displayLine = event.start_line + 1; if (lines[0] === '') { - ln++; + displayLine++; } - record[ln] = { - line: ln, + record[displayLine] = { + line: displayLine, id: event.id, uuid: event.uuid, level: event.event_level, start: event.start_line, end: event.end_line, - isTruncated: (event.end_line - event.start_line) > lines.length + isTruncated: (event.end_line - event.start_line) > lines.length, }; - if (record[ln].isTruncated) { - record[ln].truncatedAt = event.start_line + lines.length; + if (record[displayLine].isTruncated) { + record[displayLine].truncatedAt = event.start_line + lines.length; } if (EVENT_GROUPS.includes(event.event)) { - record[ln].parent = true; + record[displayLine].isParent = true; } - const current = record[ln]; + if (TIME_EVENTS.includes(event.event)) { + record[displayLine].time = getTime(event.created); + } + + const current = record[displayLine]; return lines.reduce((html, line, i) => { - eventLn++; + eventLine++; - const time = getTime(event, i); - const group = getGroup(event, i); const isLastLine = i === lines.length - 1; + let append = createRow(eventLine, line, current); if (current.isTruncated && isLastLine) { - return `${html}${createRow(eventLn, line, time, group)}${createTruncatedRow(event.id)}`; + append += createRow(); } - return `${html}${createRow(eventLn, line, time, group)}`; + return `${html}${append}`; }, ''); } -function createTruncatedRow (id) { - return ` -