Commit 65c4e95e authored by pburdette's avatar pburdette Committed by Stan Hu

Poll if tab is not visible

Continually poll for job trace
if tab is not visible in the FE.
parent 2810dfd7
...@@ -40,7 +40,6 @@ export const toggleSidebar = ({ dispatch, state }) => { ...@@ -40,7 +40,6 @@ export const toggleSidebar = ({ dispatch, state }) => {
}; };
let eTagPoll; let eTagPoll;
let isTraceReadyForRender;
export const clearEtagPoll = () => { export const clearEtagPoll = () => {
eTagPoll = null; eTagPoll = null;
...@@ -82,15 +81,9 @@ export const fetchJob = ({ state, dispatch }) => { ...@@ -82,15 +81,9 @@ export const fetchJob = ({ state, dispatch }) => {
Visibility.change(() => { Visibility.change(() => {
if (!Visibility.hidden()) { if (!Visibility.hidden()) {
// This check is needed to ensure the loading icon
// is not shown for a finished job during a visibility change
if (!isTraceReadyForRender) {
dispatch('startPollingTrace');
}
dispatch('restartPolling'); dispatch('restartPolling');
} else { } else {
dispatch('stopPolling'); dispatch('stopPolling');
dispatch('stopPollingTrace');
} }
}); });
}; };
...@@ -171,8 +164,6 @@ export const fetchTrace = ({ dispatch, state }) => ...@@ -171,8 +164,6 @@ export const fetchTrace = ({ dispatch, state }) =>
params: { state: state.traceState }, params: { state: state.traceState },
}) })
.then(({ data }) => { .then(({ data }) => {
isTraceReadyForRender = data.complete;
dispatch('toggleScrollisInBottom', isScrolledToBottom()); dispatch('toggleScrollisInBottom', isScrolledToBottom());
dispatch('receiveTraceSuccess', data); dispatch('receiveTraceSuccess', data);
......
...@@ -49,7 +49,6 @@ export default { ...@@ -49,7 +49,6 @@ export default {
[types.SET_TRACE_TIMEOUT](state, id) { [types.SET_TRACE_TIMEOUT](state, id) {
state.traceTimeout = id; state.traceTimeout = id;
state.isTraceComplete = false;
}, },
/** /**
......
...@@ -153,7 +153,6 @@ describe('Jobs Store Mutations', () => { ...@@ -153,7 +153,6 @@ describe('Jobs Store Mutations', () => {
mutations[types.SET_TRACE_TIMEOUT](stateCopy, id); mutations[types.SET_TRACE_TIMEOUT](stateCopy, id);
expect(stateCopy.traceTimeout).toEqual(id); expect(stateCopy.traceTimeout).toEqual(id);
expect(stateCopy.isTraceComplete).toBe(false);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment