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-10.0.3 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-11.0.3 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-9.0.59 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-11.0.2 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-11.0.1 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-11.0.0 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-9.0.58 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-10.0.2 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-9.0.57 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-10.0.1 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-9.0.56 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-9.0.55 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-9.0.54 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-9.0.53 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-9.0.52 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-8.0.52 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-9.0.51 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-8.0.51 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-7.0.48 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
foreman_rh_cloud-7.0.47 webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js