From b6afc085a78e053e7216c2642df3479d81bae56f Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Mon, 21 Sep 2020 18:10:55 -0400 Subject: [PATCH] Reload on stats when live updates are disabled --- awx/ui/client/features/output/stream.service.js | 8 ++++++++ awx/ui/test/unit/components/stream.unit.js | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/awx/ui/client/features/output/stream.service.js b/awx/ui/client/features/output/stream.service.js index 11198e07527f..c3cfa10622f1 100644 --- a/awx/ui/client/features/output/stream.service.js +++ b/awx/ui/client/features/output/stream.service.js @@ -119,6 +119,10 @@ function OutputStream ($q) { this.counters.ready = ready; this.counters.used = used; this.counters.missing = missing; + + if (!window.liveUpdates) { + this.counters.ready = event.counter; + } }; this.bufferEmpty = threshold => { @@ -141,6 +145,10 @@ function OutputStream ($q) { const { total } = this.counters; const readyCount = this.getReadyCount(); + if (!window.liveUpdates) { + return true; + } + if (readyCount <= 0) { return false; } diff --git a/awx/ui/test/unit/components/stream.unit.js b/awx/ui/test/unit/components/stream.unit.js index c4343d59b7f0..5d979592be74 100644 --- a/awx/ui/test/unit/components/stream.unit.js +++ b/awx/ui/test/unit/components/stream.unit.js @@ -51,7 +51,13 @@ describe('Output | StreamService', () => { }); describe('isReadyToRender', () => { - it("it's never ready to render unless the result of getReadyCount is greater than 0", () => { + it("it's never ready to render when live updates are enabled unless the result of getReadyCount is greater than 0", () => { + delete window.liveUpdates; + Object.defineProperty(window, 'liveUpdates', { + value: true, + writable: false + }); + const params = [ [-1, false], [0, false],