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-8.0.50 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-8.0.49 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-8.0.48 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-8.0.47 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-8.0.46 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-6.0.45 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.46 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.45 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-7.0.46 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.44 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-7.0.45 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-6.0.44 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.43 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-4.0.36 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-3.0.33 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-6.0.42.2 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-6.0.42.1 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-6.0.43 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-5.0.42 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-6.0.42 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js