summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/stores/modules/pipelines/mutations.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-05-25 14:13:59 +0100
committerPhil Hughes <me@iamphill.com>2018-05-25 14:13:59 +0100
commita83dd6642104faf4c8764283f5b7252a8ecd9590 (patch)
tree66cabf49dfb6049bb5e4a4c0135f9fd86b4cf62e /app/assets/javascripts/ide/stores/modules/pipelines/mutations.js
parent0c0a779f4c97622ad2359a94d1c870b75a8b0e6d (diff)
downloadgitlab-ce-a83dd6642104faf4c8764283f5b7252a8ecd9590.tar.gz
refactored to use data we already have
this required moving some data store actions & mutations around
Diffstat (limited to 'app/assets/javascripts/ide/stores/modules/pipelines/mutations.js')
-rw-r--r--app/assets/javascripts/ide/stores/modules/pipelines/mutations.js35
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) =>