Redux changes and refactoring
This commit is contained in:
@@ -1,10 +1,27 @@
|
||||
import * as Constants from '../../constants';
|
||||
import {createReducer} from 'redux-starter-kit';
|
||||
import {displayConfiguration, setAutoMountProcessed, setBusy} from '../actions/mount_actions';
|
||||
import {displayConfiguration, setAutoMountProcessed, setBusy, SET_PROVIDER_STATE} from '../actions/mount_actions';
|
||||
|
||||
const providerState = Constants.PROVIDER_LIST.map(p=> {
|
||||
return {
|
||||
[p]: {
|
||||
AutoMount: false,
|
||||
AutoRestart: false,
|
||||
MountLocation: '',
|
||||
}
|
||||
}
|
||||
}).reduce((map, obj) => {
|
||||
return {
|
||||
...map,
|
||||
...obj
|
||||
}
|
||||
});
|
||||
|
||||
export const mountReducer = createReducer({
|
||||
AutoMountProcessed: false,
|
||||
DisplayConfiguration: null,
|
||||
MountsBusy: false,
|
||||
ProviderState: providerState,
|
||||
}, {
|
||||
[displayConfiguration]: (state, action) => {
|
||||
return {...state, DisplayConfiguration: action.payload};
|
||||
@@ -14,5 +31,14 @@ export const mountReducer = createReducer({
|
||||
},
|
||||
[setBusy]: (state, action) => {
|
||||
return {...state, MountsBusy: action.payload};
|
||||
},
|
||||
[SET_PROVIDER_STATE]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
ProviderState: {
|
||||
...state.ProviderState,
|
||||
[action.payload.provider]: action.payload.state,
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user