github.com/replicatedhq/ship@v0.55.0/web/init/src/redux/data/determineSteps/reducer.js (about)

     1  import { constants } from "./actions";
     2  import { constants as phaseConstants } from "../appRoutes/actions";
     3  
     4  const stepsDataState = {
     5    step: {},
     6    phase: "loading",
     7    progress: {},
     8    stepError: "",
     9    actions: [],
    10    kustomizeFlow: false,
    11    isPolling: false,
    12  };
    13  
    14  export function stepsData(state = stepsDataState, action) {
    15    switch (action.type) {
    16    case constants.RECEIVE_CURRENT_STEP:
    17      const { currentStep } =  action.payload;
    18      const isKustomize = currentStep.helmIntro || currentStep.helmValues || currentStep.kustomize;
    19      return Object.assign({}, state, {
    20        step: currentStep,
    21        phase: action.payload.phase,
    22        progress: action.payload.progress || action.payload.status,
    23        actions: action.payload.actions,
    24        kustomizeFlow: isKustomize,
    25      });
    26    case phaseConstants.SET_PHASE:
    27      return Object.assign({}, state, {
    28        phase: action.payload
    29      })
    30    case constants.SET_STEP_ERROR:
    31      return Object.assign({}, state, {
    32        stepError: action.payload
    33      });
    34    case phaseConstants.SET_PROGRESS:
    35      return {
    36        ...state,
    37        progress: action.payload,
    38      };
    39    case phaseConstants.POLLING:
    40      return {
    41        ...state,
    42        isPolling: action.payload,
    43      };
    44    default:
    45      return state;
    46    }
    47  }