Commit fe225fd9 authored by Filipa Lacerda's avatar Filipa Lacerda

Set up mock data for stages

parent 4ae71c2b
...@@ -122,11 +122,13 @@ export default { ...@@ -122,11 +122,13 @@ export default {
// fetch the stages for the dropdown on the sidebar // fetch the stages for the dropdown on the sidebar
job(newVal, oldVal) { job(newVal, oldVal) {
if (_.isEmpty(oldVal) && !_.isEmpty(newVal.pipeline)) { if (_.isEmpty(oldVal) && !_.isEmpty(newVal.pipeline)) {
this.fetchJobsForStage( const stages = this.job.pipeline.details.stages || [];
this.job.pipeline.details.stages.find(
stage => stage && stage.name === this.selectedStage, const defaultStage = stages.find(stage => stage && stage.name === this.selectedStage);
),
); if (defaultStage) {
this.fetchJobsForStage(defaultStage);
}
} }
if (newVal.archived) { if (newVal.archived) {
...@@ -274,7 +276,6 @@ export default { ...@@ -274,7 +276,6 @@ export default {
:class="{ 'sticky-top border-bottom-0': hasTrace }" :class="{ 'sticky-top border-bottom-0': hasTrace }"
> >
<icon name="lock" class="align-text-bottom" /> <icon name="lock" class="align-text-bottom" />
{{ __('This job is archived. Only the complete pipeline can be retried.') }} {{ __('This job is archived. Only the complete pipeline can be retried.') }}
</div> </div>
<!-- job log --> <!-- job log -->
......
...@@ -185,7 +185,7 @@ export const requestJobsForStage = ({ commit }, stage) => ...@@ -185,7 +185,7 @@ export const requestJobsForStage = ({ commit }, stage) =>
commit(types.REQUEST_JOBS_FOR_STAGE, stage); commit(types.REQUEST_JOBS_FOR_STAGE, stage);
// On stage click, set selected stage + fetch job // On stage click, set selected stage + fetch job
export const fetchJobsForStage = ({ dispatch }, stage) => { export const fetchJobsForStage = ({ dispatch }, stage = {}) => {
dispatch('requestJobsForStage', stage); dispatch('requestJobsForStage', stage);
axios axios
......
...@@ -65,7 +65,10 @@ export default { ...@@ -65,7 +65,10 @@ export default {
state.isLoading = false; state.isLoading = false;
state.job = job; 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 * We only update it on the first request
...@@ -103,7 +106,7 @@ export default { ...@@ -103,7 +106,7 @@ export default {
state.isScrolledToBottomBeforeReceivingTrace = toggle; state.isScrolledToBottomBeforeReceivingTrace = toggle;
}, },
[types.REQUEST_JOBS_FOR_STAGE](state, stage) { [types.REQUEST_JOBS_FOR_STAGE](state, stage = {}) {
state.isLoadingJobs = true; state.isLoadingJobs = true;
state.selectedStage = stage.name; state.selectedStage = stage.name;
}, },
......
...@@ -874,9 +874,6 @@ msgstr "" ...@@ -874,9 +874,6 @@ msgstr ""
msgid "An error occurred while fetching sidebar data" msgid "An error occurred while fetching sidebar data"
msgstr "" msgstr ""
msgid "An error occurred while fetching stages."
msgstr ""
msgid "An error occurred while fetching the board lists. Please try again." msgid "An error occurred while fetching the board lists. Please try again."
msgstr "" msgstr ""
......
...@@ -995,7 +995,33 @@ export default { ...@@ -995,7 +995,33 @@ export default {
}, },
duration: 6, duration: 6,
finished_at: '2017-06-01T17:32:00.042Z', finished_at: '2017-06-01T17:32:00.042Z',
stages, stages: [
{
dropdown_path: '/jashkenas/underscore/pipelines/16/stage.json?stage=build',
name: 'build',
path: '/jashkenas/underscore/pipelines/16#build',
status: {
icon: 'status_success',
text: 'passed',
label: 'passed',
group: 'success',
tooltip: 'passed',
},
title: 'build: passed',
},
{
dropdown_path: '/jashkenas/underscore/pipelines/16/stage.json?stage=test',
name: 'test',
path: '/jashkenas/underscore/pipelines/16#test',
status: {
icon: 'status_warning',
text: 'passed',
label: 'passed with warnings',
group: 'success-with-warnings',
},
title: 'test: passed with warnings',
},
],
}, },
ref: { ref: {
name: 'abc', name: 'abc',
......
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