Sha256: 7237e9d5d32922369d726857ff86b3519ec6e6f272bebb54b221cbd6b0e6325f
Contents?: true
Size: 1.21 KB
Versions: 15
Compression:
Stored size: 1.21 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, } = {}, } = action; switch (action.type) { case INVENTORY_ACCOUNT_STATUS_POLLING: return state.merge({ ...state, accounts, 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
15 entries across 15 versions & 2 rubygems