Add Toggle to control showing full search history instead of filtered list
Summary: This diff adds a new menu option to the Logs plugin which allows for enabling/disabling the automatic filtering of search terms in the search history as user types. Additionally, fixed bug regarding the search term that's used is not actually showing correctly. This is caused by the search value being set in the input search bar instead of the autoComplete component level Differential Revision: D37555209 fbshipit-source-id: 8a76299f7e1a4b0a3adfa6a4dd883d17f1e7a442
This commit is contained in:
committed by
Facebook GitHub Bot
parent
551d0389ae
commit
53b89f485a
@@ -39,6 +39,7 @@ type PersistedState = {
|
||||
/** Active search value */
|
||||
search: string;
|
||||
useRegex: boolean;
|
||||
filterSearchHistory: boolean;
|
||||
/** current selection, describes the index index in the datasources's current output (not window!) */
|
||||
selection: {current: number; items: number[]};
|
||||
/** The currently applicable sorting, if any */
|
||||
@@ -108,7 +109,8 @@ type DataManagerActions<T> =
|
||||
| Action<'toggleSearchValue'>
|
||||
| Action<'clearSearchHistory'>
|
||||
| Action<'toggleHighlightSearch'>
|
||||
| Action<'setSearchHighlightColor', {color: string}>;
|
||||
| Action<'setSearchHighlightColor', {color: string}>
|
||||
| Action<'toggleFilterSearchHistory'>;
|
||||
|
||||
type DataManagerConfig<T> = {
|
||||
dataSource: DataSource<T, T[keyof T]>;
|
||||
@@ -129,6 +131,7 @@ export type DataManagerState<T> = {
|
||||
sorting: Sorting<T> | undefined;
|
||||
selection: Selection;
|
||||
useRegex: boolean;
|
||||
filterSearchHistory: boolean;
|
||||
autoScroll: boolean;
|
||||
searchValue: string;
|
||||
/** Used to remember the record entry to lookup when user presses ctrl */
|
||||
@@ -218,6 +221,10 @@ export const dataTableManagerReducer = produce<
|
||||
draft.useRegex = !draft.useRegex;
|
||||
break;
|
||||
}
|
||||
case 'toggleFilterSearchHistory': {
|
||||
draft.filterSearchHistory = !draft.filterSearchHistory;
|
||||
break;
|
||||
}
|
||||
case 'selectItem': {
|
||||
const {nextIndex, addToSelection, allowUnselect} = action;
|
||||
draft.selection = castDraft(
|
||||
@@ -449,6 +456,7 @@ export function createInitialState<T>(
|
||||
previousSearchValue: '',
|
||||
searchHistory: prefs?.searchHistory ?? [],
|
||||
useRegex: prefs?.useRegex ?? false,
|
||||
filterSearchHistory: prefs?.filterSearchHistory ?? true,
|
||||
autoScroll: prefs?.autoScroll ?? config.autoScroll ?? false,
|
||||
highlightSearchSetting: prefs?.highlightSearchSetting ?? {
|
||||
highlightEnabled: false,
|
||||
@@ -517,6 +525,7 @@ export function savePreferences(
|
||||
const prefs: PersistedState = {
|
||||
search: state.searchValue,
|
||||
useRegex: state.useRegex,
|
||||
filterSearchHistory: state.filterSearchHistory,
|
||||
selection: {
|
||||
current: state.selection.current,
|
||||
items: Array.from(state.selection.items),
|
||||
|
||||
Reference in New Issue
Block a user