+ client: modify added filters

This commit is contained in:
Ildar Kamalov
2020-01-20 15:47:10 +03:00
committed by Simon Zolin
parent 0b8cba7384
commit b3bca39de4
8 changed files with 235 additions and 90 deletions

View File

@@ -37,7 +37,17 @@ const filtering = handleActions(
isFilterAdded: true,
}),
[actions.toggleFilteringModal]: (state) => {
[actions.toggleFilteringModal]: (state, { payload }) => {
if (payload) {
const newState = {
...state,
isModalOpen: !state.isModalOpen,
isFilterAdded: false,
modalType: payload.type || '',
modalFilterUrl: payload.url || '',
};
return newState;
}
const newState = {
...state,
isModalOpen: !state.isModalOpen,
@@ -50,6 +60,10 @@ const filtering = handleActions(
[actions.toggleFilterFailure]: state => ({ ...state, processingConfigFilter: false }),
[actions.toggleFilterSuccess]: state => ({ ...state, processingConfigFilter: false }),
[actions.editFilterRequest]: state => ({ ...state, processingConfigFilter: true }),
[actions.editFilterFailure]: state => ({ ...state, processingConfigFilter: false }),
[actions.editFilterSuccess]: state => ({ ...state, processingConfigFilter: false }),
[actions.refreshFiltersRequest]: state => ({ ...state, processingRefreshFilters: true }),
[actions.refreshFiltersFailure]: state => ({ ...state, processingRefreshFilters: false }),
[actions.refreshFiltersSuccess]: state => ({ ...state, processingRefreshFilters: false }),
@@ -80,6 +94,8 @@ const filtering = handleActions(
userRules: '',
interval: 24,
enabled: true,
modalType: '',
modalFilterUrl: '',
},
);