+ client: handle logs configuration
This commit is contained in:
committed by
Simon Zolin
parent
27f895cf46
commit
a753ae86cc
49
client/src/reducers/queryLogs.js
Normal file
49
client/src/reducers/queryLogs.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import { handleActions } from 'redux-actions';
|
||||
|
||||
import * as actions from '../actions/queryLogs';
|
||||
|
||||
const queryLogs = handleActions(
|
||||
{
|
||||
[actions.getLogsRequest]: state => ({ ...state, processingGetLogs: true }),
|
||||
[actions.getLogsFailure]: state => ({ ...state, processingGetLogs: false }),
|
||||
[actions.getLogsSuccess]: (state, { payload }) => {
|
||||
const newState = { ...state, logs: payload, processingGetLogs: false };
|
||||
return newState;
|
||||
},
|
||||
|
||||
[actions.clearLogsRequest]: state => ({ ...state, processingClear: true }),
|
||||
[actions.clearLogsFailure]: state => ({ ...state, processingClear: false }),
|
||||
[actions.clearLogsSuccess]: state => ({
|
||||
...state,
|
||||
logs: [],
|
||||
processingClear: false,
|
||||
}),
|
||||
|
||||
[actions.getLogsConfigRequest]: state => ({ ...state, processingGetConfig: true }),
|
||||
[actions.getLogsConfigFailure]: state => ({ ...state, processingGetConfig: false }),
|
||||
[actions.getLogsConfigSuccess]: (state, { payload }) => ({
|
||||
...state,
|
||||
...payload,
|
||||
processingGetConfig: false,
|
||||
}),
|
||||
|
||||
[actions.setLogsConfigRequest]: state => ({ ...state, processingSetConfig: true }),
|
||||
[actions.setLogsConfigFailure]: state => ({ ...state, processingSetConfig: false }),
|
||||
[actions.setLogsConfigSuccess]: (state, { payload }) => ({
|
||||
...state,
|
||||
...payload,
|
||||
processingSetConfig: false,
|
||||
}),
|
||||
},
|
||||
{
|
||||
processingGetLogs: true,
|
||||
processingClear: false,
|
||||
processingGetConfig: false,
|
||||
processingSetConfig: false,
|
||||
logs: [],
|
||||
interval: 1,
|
||||
enabled: true,
|
||||
},
|
||||
);
|
||||
|
||||
export default queryLogs;
|
||||
Reference in New Issue
Block a user