Sha256: fdc2ae4188d59ed5c9c40b9a7b0637f71e7948ce92de934256b5c612573d9ae4
Contents?: true
Size: 1.56 KB
Versions: 148
Compression:
Stored size: 1.56 KB
Contents
import Immutable from 'seamless-immutable'; import { INVENTORY_POLLING_START, INVENTORY_POLLING, INVENTORY_TAB_CHANGED, INVENTORY_POLLING_ERROR, INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN, } from './DashboardConstants'; const initialState = Immutable({}); export default (state = initialState, action) => { const { payload: { accountID, pollingProcessID, logs, error, activeTab, scheduled, } = {}, } = action; const getTabState = () => state[accountID] ? state[accountID][activeTab] : {}; switch (action.type) { case INVENTORY_POLLING_START: return state.setIn([accountID], { ...state[accountID], pollingProcessID, activeTab: 'generating', }); case INVENTORY_POLLING: return state.setIn([accountID], { ...state[accountID], [activeTab]: { ...getTabState(), logs, scheduled, error: null, }, }); case INVENTORY_TAB_CHANGED: return state.setIn([accountID], { ...state[accountID], activeTab, }); case INVENTORY_POLLING_ERROR: return state.setIn([accountID], { ...state[accountID], [activeTab]: { ...getTabState(), error, }, }); case INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN: return state.setIn([accountID], { ...state[accountID], [activeTab]: { ...getTabState(), showFullScreen: !state[accountID][activeTab].showFullScreen, }, }); default: return state; } };
Version data entries
148 entries across 148 versions & 2 rubygems