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.
This commit is contained in:
Jake McDermott 2019-10-18 18:44:06 -04:00
parent c6033399d0
commit 312cf13777
No known key found for this signature in database
GPG Key ID: 0E56ED990CDFCB4F

View File

@ -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 };
}