Skip to content

Commit

Permalink
Reload on stats when live updates are disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemcdermott authored and ryanpetrello committed Sep 22, 2020
1 parent bed2dea commit b6afc08
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions awx/ui/client/features/output/stream.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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;
}
Expand Down
8 changes: 7 additions & 1 deletion awx/ui/test/unit/components/stream.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit b6afc08

Please sign in to comment.