diff options
Diffstat (limited to 'app/assets/javascripts/ide/stores/modules/pipelines/mutations.js')
-rw-r--r-- | app/assets/javascripts/ide/stores/modules/pipelines/mutations.js | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/app/assets/javascripts/ide/stores/modules/pipelines/mutations.js b/app/assets/javascripts/ide/stores/modules/pipelines/mutations.js index 0713aa4a3f5..9f418069db4 100644 --- a/app/assets/javascripts/ide/stores/modules/pipelines/mutations.js +++ b/app/assets/javascripts/ide/stores/modules/pipelines/mutations.js @@ -12,32 +12,19 @@ export default { state.isLoadingPipeline = false; if (pipeline) { - state.latestPipeline = { - id: pipeline.id, - status: pipeline.status, - }; + state.latestPipeline = pipeline; + state.stages = pipeline.details.stages.map((stage, i) => { + const foundStage = state.stages.find(s => s.id === i); + return { + ...stage, + id: i, + isCollapsed: foundStage ? foundStage.isCollapsed : false, + isLoading: foundStage ? foundStage.isLoading : false, + jobs: foundStage ? foundStage.jobs : [], + }; + }); } }, - [types.REQUEST_STAGES](state) { - state.isLoadingJobs = true; - }, - [types.RECEIVE_STAGES_ERROR](state) { - state.isLoadingJobs = false; - }, - [types.RECEIVE_STAGES_SUCCESS](state, stages) { - state.isLoadingJobs = false; - - state.stages = stages.map((stage, i) => { - const foundStage = state.stages.find(s => s.id === i); - return { - ...stage, - id: i, - isCollapsed: foundStage ? foundStage.isCollapsed : false, - isLoading: foundStage ? foundStage.isLoading : false, - jobs: foundStage ? foundStage.jobs : [], - }; - }); - }, [types.REQUEST_JOBS](state, id) { state.stages = state.stages.reduce( (acc, stage) => |