Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-04 03:09:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-04 03:09:55 +0300
commit73fd5a897364c6f91f86a0dd6d4b566c2574ca6e (patch)
tree0f77959883c969bf93ac6c8804e10d3dbeddc59a /app/assets/javascripts/jobs
parente701659ba316541833e50d68f14720d17be58f8c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/jobs')
-rw-r--r--app/assets/javascripts/jobs/store/actions.js21
-rw-r--r--app/assets/javascripts/jobs/store/mutations.js1
2 files changed, 19 insertions, 3 deletions
diff --git a/app/assets/javascripts/jobs/store/actions.js b/app/assets/javascripts/jobs/store/actions.js
index 1e4b5e986db..f8156dc2441 100644
--- a/app/assets/javascripts/jobs/store/actions.js
+++ b/app/assets/javascripts/jobs/store/actions.js
@@ -20,8 +20,7 @@ export const init = ({ dispatch }, { endpoint, logState, pagePath }) => {
logState,
pagePath,
});
-
- return Promise.all([dispatch('fetchJob'), dispatch('fetchTrace')]);
+ dispatch('fetchJob');
};
export const setJobEndpoint = ({ commit }, endpoint) => commit(types.SET_JOB_ENDPOINT, endpoint);
@@ -39,6 +38,7 @@ export const toggleSidebar = ({ dispatch, state }) => {
};
let eTagPoll;
+let isTraceReadyForRender;
export const clearEtagPoll = () => {
eTagPoll = null;
@@ -70,7 +70,14 @@ export const fetchJob = ({ state, dispatch }) => {
});
if (!Visibility.hidden()) {
- eTagPoll.makeRequest();
+ // eslint-disable-next-line promise/catch-or-return
+ eTagPoll.makeRequest().then(() => {
+ // if a job is canceled we still need to dispatch
+ // fetchTrace to get the trace so we check for has_trace
+ if (state.job.started || state.job.has_trace) {
+ dispatch('fetchTrace');
+ }
+ });
} else {
axios
.get(state.jobEndpoint)
@@ -80,9 +87,15 @@ export const fetchJob = ({ state, dispatch }) => {
Visibility.change(() => {
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');
} else {
dispatch('stopPolling');
+ dispatch('stopPollingTrace');
}
});
};
@@ -163,6 +176,8 @@ export const fetchTrace = ({ dispatch, state }) =>
params: { state: state.traceState },
})
.then(({ data }) => {
+ isTraceReadyForRender = data.complete;
+
dispatch('toggleScrollisInBottom', isScrolledToBottom());
dispatch('receiveTraceSuccess', data);
diff --git a/app/assets/javascripts/jobs/store/mutations.js b/app/assets/javascripts/jobs/store/mutations.js
index 924b811d0d6..dea53f715a7 100644
--- a/app/assets/javascripts/jobs/store/mutations.js
+++ b/app/assets/javascripts/jobs/store/mutations.js
@@ -49,6 +49,7 @@ export default {
[types.SET_TRACE_TIMEOUT](state, id) {
state.traceTimeout = id;
+ state.isTraceComplete = false;
},
/**