Sha256: 7abac1583809c5b03419b17932a35541ff9addc3c319667688a445a0773903c0

Contents?: true

Size: 1.26 KB

Versions: 82

Compression:

Stored size: 1.26 KB

Contents

import Immutable from 'seamless-immutable';
import {
  INVENTORY_ACCOUNT_STATUS_POLLING,
  INVENTORY_ACCOUNT_STATUS_POLLING_ERROR,
  INVENTORY_ACCOUNT_STATUS_POLLING_START,
  INVENTORY_PROCESS_RESTART,
} from './AccountListConstants';

const initialState = Immutable({
  accounts: {},
  pollingProcessID: 0,
  error: null,
});

export default (state = initialState, action) => {
  const {
    payload: {
      pollingProcessID,
      error,
      accounts,
      accountID,
      processStatusName,
      CloudConnectorStatus,
    } = {},
  } = action;

  switch (action.type) {
    case INVENTORY_ACCOUNT_STATUS_POLLING:
      return state.merge({
        ...state,
        accounts,
        CloudConnectorStatus,
        error: null,
      });
    case INVENTORY_ACCOUNT_STATUS_POLLING_ERROR:
      return state.merge({
        ...state,
        accounts: {},
        error,
      });
    case INVENTORY_ACCOUNT_STATUS_POLLING_START:
      return state.merge({
        ...state,
        pollingProcessID,
      });
    case INVENTORY_PROCESS_RESTART:
      return state.setIn(['accounts'], {
        ...state.accounts,
        [accountID]: {
          ...state.accounts[accountID],
          [processStatusName]: 'Restarting...',
        },
      });
    default:
      return state;
  }
};

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
foreman_rh_cloud-5.0.41 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.39 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.38 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-4.0.35 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.37 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.36 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.35 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.34 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.33 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-3.0.32 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-4.0.32 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.32 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-4.0.31 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.31 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.30 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-4.0.30 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-3.0.29 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-4.0.29 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.29 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-3.0.28 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js