diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2019-05-23 14:27:54 +0100 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-05-24 10:04:42 +0100 |
commit | fe225fd9289acb8d50157703849363de39046bca (patch) | |
tree | 2760fb2f4fa80a20257966a9ad6dcc0519b00e4f /app | |
parent | 4ae71c2b4fe8e6731fceadc3426cd70491398fe0 (diff) | |
download | gitlab-ce-fe225fd9289acb8d50157703849363de39046bca.tar.gz |
Set up mock data for stages
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/jobs/components/job_app.vue | 13 | ||||
-rw-r--r-- | app/assets/javascripts/jobs/store/actions.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/jobs/store/mutations.js | 7 |
3 files changed, 13 insertions, 9 deletions
diff --git a/app/assets/javascripts/jobs/components/job_app.vue b/app/assets/javascripts/jobs/components/job_app.vue index 4bc8fa53554..79fb67d38cd 100644 --- a/app/assets/javascripts/jobs/components/job_app.vue +++ b/app/assets/javascripts/jobs/components/job_app.vue @@ -122,11 +122,13 @@ export default { // fetch the stages for the dropdown on the sidebar job(newVal, oldVal) { if (_.isEmpty(oldVal) && !_.isEmpty(newVal.pipeline)) { - this.fetchJobsForStage( - this.job.pipeline.details.stages.find( - stage => stage && stage.name === this.selectedStage, - ), - ); + const stages = this.job.pipeline.details.stages || []; + + const defaultStage = stages.find(stage => stage && stage.name === this.selectedStage); + + if (defaultStage) { + this.fetchJobsForStage(defaultStage); + } } if (newVal.archived) { @@ -274,7 +276,6 @@ export default { :class="{ 'sticky-top border-bottom-0': hasTrace }" > <icon name="lock" class="align-text-bottom" /> - {{ __('This job is archived. Only the complete pipeline can be retried.') }} </div> <!-- job log --> diff --git a/app/assets/javascripts/jobs/store/actions.js b/app/assets/javascripts/jobs/store/actions.js index 8b47092ef94..12d67a43599 100644 --- a/app/assets/javascripts/jobs/store/actions.js +++ b/app/assets/javascripts/jobs/store/actions.js @@ -185,7 +185,7 @@ export const requestJobsForStage = ({ commit }, stage) => commit(types.REQUEST_JOBS_FOR_STAGE, stage); // On stage click, set selected stage + fetch job -export const fetchJobsForStage = ({ dispatch }, stage) => { +export const fetchJobsForStage = ({ dispatch }, stage = {}) => { dispatch('requestJobsForStage', stage); axios diff --git a/app/assets/javascripts/jobs/store/mutations.js b/app/assets/javascripts/jobs/store/mutations.js index 714a8dec4b2..ad08f27b147 100644 --- a/app/assets/javascripts/jobs/store/mutations.js +++ b/app/assets/javascripts/jobs/store/mutations.js @@ -65,7 +65,10 @@ export default { state.isLoading = false; state.job = job; - state.stages = ((job.pipeline || {}).details || {}).stages || []; + state.stages = + job.pipeline && job.pipeline.details && job.pipeline.details.stages + ? job.pipeline.details.stages + : []; /** * We only update it on the first request @@ -103,7 +106,7 @@ export default { state.isScrolledToBottomBeforeReceivingTrace = toggle; }, - [types.REQUEST_JOBS_FOR_STAGE](state, stage) { + [types.REQUEST_JOBS_FOR_STAGE](state, stage = {}) { state.isLoadingJobs = true; state.selectedStage = stage.name; }, |