Merge pull request #2974 from jakemcdermott/fix-2968

delete text nodes when removing output lines
This commit is contained in:
Jake McDermott 2018-09-06 13:25:53 -04:00 committed by GitHub
commit b9b9fc1934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 3 deletions

View File

@ -838,6 +838,15 @@ function OutputIndexController (
return last();
});
$scope.$on('$destroy', () => {
stopListening();
render.clear();
render.el.remove();
slide.clear();
stream.bufferInit();
});
}
OutputIndexController.$inject = [

View File

@ -3,6 +3,7 @@ import Entities from 'html-entities';
import {
EVENT_START_PLAY,
EVENT_START_PLAYBOOK,
EVENT_STATS_PLAY,
EVENT_START_TASK,
OUTPUT_ANSI_COLORMAP,
@ -208,6 +209,10 @@ function JobRenderService ($q, $sce, $window) {
const lines = stdout.split('\r\n');
const record = this.createRecord(event, lines);
if (event.event === EVENT_START_PLAYBOOK) {
return { html: '', count: 0 };
}
let html = '';
let count = lines.length;
let ln = event.start_line;
@ -228,6 +233,10 @@ function JobRenderService ($q, $sce, $window) {
html += row;
}
if (this.records[event.uuid]) {
this.records[event.uuid].lineCount = count;
}
return { html, count };
};
@ -433,18 +442,24 @@ function JobRenderService ($q, $sce, $window) {
};
this.removeAll = () => {
const elements = this.el.children();
const elements = this.el.contents();
return this.remove(elements);
};
this.shift = lines => {
const elements = this.el.children().slice(0, lines);
// We multiply by two here under the assumption that one element and one text node
// is generated for each line of output.
const count = 2 * lines;
const elements = this.el.contents().slice(0, count);
return this.remove(elements);
};
this.pop = lines => {
const elements = this.el.children().slice(-lines);
// We multiply by two here under the assumption that one element and one text node
// is generated for each line of output.
const count = 2 * lines;
const elements = this.el.contents().slice(-count);
return this.remove(elements);
};

View File

@ -126,6 +126,13 @@ function SlidingWindowService ($q) {
return frames.filter(({ counter }) => counter > tail);
};
this.clear = () => {
this.buffer.events.length = 0;
this.buffer.min = 0;
this.buffer.max = 0;
this.buffer.count = 0;
};
this.getFrames = () => $q.resolve(this.buffer.events);
this.getMaxCounter = () => {