From cf5d3d55f05cab224013a3cdc90be4b6f22d92b7 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Fri, 18 Oct 2019 18:44:06 -0400 Subject: [PATCH] Set omitted runner event line lengths to 0 runner_on_start events have zero-length strings for their stdout fields. We don't want to display these in the ui so we omit them. Although the stdout field is an empty string, it still has a recorded line length of 1 that we must account for. Since we're not rendering the blank line, we must also go back and set the event record's line length to 0 in order to avoid deleting too many lines when we pop or shift events off of the view while scrolling. --- awx/ui/client/features/output/render.service.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/awx/ui/client/features/output/render.service.js b/awx/ui/client/features/output/render.service.js index 11d7108cd0..3dad042aa4 100644 --- a/awx/ui/client/features/output/render.service.js +++ b/awx/ui/client/features/output/render.service.js @@ -213,6 +213,18 @@ function JobRenderService ($q, $compile, $sce, $window) { const record = this.createRecord(event, lines); if (lines.length === 1 && lines[0] === '') { + // Some events, mainly runner_on_start events, have an actual line count of 1 + // (stdout = '') and a claimed line count of 0 (end_line - start_line = 0). + // Since a zero-length string has an actual line count of 1, they'll still get + // rendered as blank lines unless we intercept them and add some special + // handling to remove them. + // + // Although we're not going to render the blank line, the actual line count of + // the zero-length stdout string, which is 1, has already been recorded at this + // point so we must also go back and set the event's recorded line length to 0 + // in order to avoid deleting too many lines when we need to pop or shift a + // page that contains this event off of the view. + this.records[record.uuid].lineCount = 0; return { html: '', count: 0 }; }