From c4a29ded1c63d41f0fb641c824643201070bde3c Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Tue, 4 Sep 2018 11:38:40 -0400 Subject: [PATCH 1/3] use el.contents() to remove lines --- awx/ui/client/features/output/render.service.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/features/output/render.service.js b/awx/ui/client/features/output/render.service.js index 7acb4119e0..20996eeb95 100644 --- a/awx/ui/client/features/output/render.service.js +++ b/awx/ui/client/features/output/render.service.js @@ -433,18 +433,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); }; From 0e696d05150c2845e513fad84f9a61a355f03814 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Tue, 4 Sep 2018 11:39:22 -0400 Subject: [PATCH 2/3] add destroy hook to index controller --- awx/ui/client/features/output/index.controller.js | 9 +++++++++ awx/ui/client/features/output/render.service.js | 4 ++++ awx/ui/client/features/output/slide.service.js | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/awx/ui/client/features/output/index.controller.js b/awx/ui/client/features/output/index.controller.js index 4e59735f24..40f66dbf1b 100644 --- a/awx/ui/client/features/output/index.controller.js +++ b/awx/ui/client/features/output/index.controller.js @@ -838,6 +838,15 @@ function OutputIndexController ( return last(); }); + + $scope.$on('$destroy', () => { + stopListening(); + + render.clear(); + render.el.remove(); + slide.clear(); + stream.bufferInit(); + }); } OutputIndexController.$inject = [ diff --git a/awx/ui/client/features/output/render.service.js b/awx/ui/client/features/output/render.service.js index 20996eeb95..5557a922bb 100644 --- a/awx/ui/client/features/output/render.service.js +++ b/awx/ui/client/features/output/render.service.js @@ -228,6 +228,10 @@ function JobRenderService ($q, $sce, $window) { html += row; } + if (this.records[event.uuid]) { + this.records[event.uuid].lineCount = count; + } + return { html, count }; }; diff --git a/awx/ui/client/features/output/slide.service.js b/awx/ui/client/features/output/slide.service.js index fd052cc8fc..e4f410b1b3 100644 --- a/awx/ui/client/features/output/slide.service.js +++ b/awx/ui/client/features/output/slide.service.js @@ -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 = () => { From 093f4530737b3e150f0083a5a7519fcd4dc87817 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Thu, 6 Sep 2018 11:53:25 -0400 Subject: [PATCH 3/3] don't render playbook_on_start events --- awx/ui/client/features/output/render.service.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/awx/ui/client/features/output/render.service.js b/awx/ui/client/features/output/render.service.js index 5557a922bb..6111cbbe8d 100644 --- a/awx/ui/client/features/output/render.service.js +++ b/awx/ui/client/features/output/render.service.js @@ -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;