From 0e696d05150c2845e513fad84f9a61a355f03814 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Tue, 4 Sep 2018 11:39:22 -0400 Subject: [PATCH] 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 = () => {