Sha256: 7a8483138d30cd5a262f4b5ef098fc797943b0863f6de0795ea048a72a45a631

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

import Immutable from 'seamless-immutable';

import {
  cloneDeep,
  findIndex,
  findLastIndex,
} from 'lodash';

import {
  APPLICATION_INSTANCE_DEPLOY_INIT,
  APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_REQUEST,
  APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_SUCCESS,
  APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_FAILURE,
} from './ApplicationInstanceReportConstants';

export const initialState = Immutable({
  name: false,
  error: { errorMsg: '', status: '', statusText: '' },
});

const applicationInstanceReport = (state = initialState, action) => {
  const { payload } = action;

  switch (action.type) {
    case APPLICATION_INSTANCE_DEPLOY_INIT: {
      return state.merge(payload);
    }
    case APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_REQUEST: {
      return state.merge({
        loading: true,
        activeHostId: payload.activeHostId,
      })
    }
    case APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_SUCCESS: {
      return state.merge({
        report: payload,
        loading: false,
      });
    }
    case APPLICATION_INSTANCE_DEPLOY_LOAD_REPORT_FAILURE: {
      return state.merge({
        error: payload.error,
        loading: false
      });
    }
    default: {
      return state;
    }
  }
};

export default applicationInstanceReport;

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_acd-0.5.0 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js
foreman_acd-0.4.0 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js
foreman_acd-0.3.0 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js
foreman_acd-0.2.1 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js