Sha256: b2576b4b55570b923ad04808aacc5039b29f130ec5c24e19ebbb021f66fe41cb

Contents?: true

Size: 1.56 KB

Versions: 10

Compression:

Stored size: 1.56 KB

Contents

import Immutable from 'seamless-immutable';

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

import {
  APPLICATION_INSTANCE_REPORT_INIT,
  APPLICATION_INSTANCE_REPORT_SET_ACTIVE_HOST,
  APPLICATION_INSTANCE_REPORT_LOAD_REPORT_REQUEST,
  APPLICATION_INSTANCE_REPORT_LOAD_REPORT_SUCCESS,
  APPLICATION_INSTANCE_REPORT_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_REPORT_INIT: {
      return state.merge(payload);
    }
    case APPLICATION_INSTANCE_REPORT_SET_ACTIVE_HOST: {
      return state.merge({
        loading: true,
        activeHostId: payload.activeHostId,
      })
    }
    case APPLICATION_INSTANCE_REPORT_LOAD_REPORT_REQUEST: {
      // Nothing to do
      return state;
    }
    case APPLICATION_INSTANCE_REPORT_LOAD_REPORT_SUCCESS: {
      return state.merge({
        deploymentState: payload.deploymentState,
        initialConfigureState: payload.initialConfigureState,
        initialConfigureJobUrl: payload.initialConfigureJobUrl,
        hosts: payload.hosts,
      });
    }
    case APPLICATION_INSTANCE_REPORT_LOAD_REPORT_FAILURE: {
      console.log("Error while loading report data: "+ payload.error);
      return state.merge({ error: payload.error});
    }
    default: {
      return state;
    }
  }
};

export default applicationInstanceReport;

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
foreman_acd-0.9.7 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js
foreman_acd-0.9.5 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js
foreman_acd-0.9.4 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js
foreman_acd-0.9.3 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js
foreman_acd-0.9.2.3 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js
foreman_acd-0.9.2.2 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js
foreman_acd-0.9.2.1 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js
foreman_acd-0.9.2 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js
foreman_acd-0.9.1 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js
foreman_acd-0.9.0 webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js