Trigger manual search from any History Item

This commit is contained in:
Qstick
2021-02-18 22:21:46 -05:00
parent 9c4ee28d50
commit 96cf058017
11 changed files with 239 additions and 46 deletions

View File

@@ -2,6 +2,8 @@ import { createAction } from 'redux-actions';
import { filterBuilderTypes, filterBuilderValueTypes, sortDirections } from 'Helpers/Props';
import { createThunk, handleThunks } from 'Store/thunks';
import createAjaxRequest from 'Utilities/createAjaxRequest';
import getSectionState from 'Utilities/State/getSectionState';
import updateSectionState from 'Utilities/State/updateSectionState';
import translate from 'Utilities/String/translate';
import createFetchHandler from './Creators/createFetchHandler';
import createHandleActions from './Creators/createHandleActions';
@@ -27,6 +29,12 @@ export const defaultState = {
sortKey: 'title',
sortDirection: sortDirections.ASCENDING,
defaults: {
searchQuery: '',
searchIndexerIds: [],
searchCategories: []
},
columns: [
{
name: 'protocol',
@@ -196,6 +204,7 @@ export const GRAB_RELEASE = 'releases/grabRelease';
export const UPDATE_RELEASE = 'releases/updateRelease';
export const SET_RELEASES_FILTER = 'releases/setReleasesFilter';
export const SET_RELEASES_TABLE_OPTION = 'releases/setReleasesTableOption';
export const SET_SEARCH_DEFAULT = 'releases/setSearchDefault';
//
// Action Creators
@@ -208,6 +217,7 @@ export const grabRelease = createThunk(GRAB_RELEASE);
export const updateRelease = createAction(UPDATE_RELEASE);
export const setReleasesFilter = createAction(SET_RELEASES_FILTER);
export const setReleasesTableOption = createAction(SET_RELEASES_TABLE_OPTION);
export const setSearchDefault = createAction(SET_SEARCH_DEFAULT);
//
// Helpers
@@ -291,6 +301,17 @@ export const reducers = createHandleActions({
return newState;
},
[SET_SEARCH_DEFAULT]: function(state, { payload }) {
const newState = getSectionState(state, section);
newState.defaults = {
...newState.defaults,
...payload
};
return updateSectionState(state, section, newState);
},
[SET_RELEASES_FILTER]: createSetClientSideCollectionFilterReducer(section),
[SET_RELEASES_SORT]: createSetClientSideCollectionSortReducer(section),