diff --git a/desktop/flipper-plugin/src/ui/data-table/DataTableWithPowerSearch.tsx b/desktop/flipper-plugin/src/ui/data-table/DataTableWithPowerSearch.tsx index 1a9943a9f..fbdbb97a5 100644 --- a/desktop/flipper-plugin/src/ui/data-table/DataTableWithPowerSearch.tsx +++ b/desktop/flipper-plugin/src/ui/data-table/DataTableWithPowerSearch.tsx @@ -99,6 +99,11 @@ type DataTableBaseProps = { | null | ((dataView?: _DataSourceView) => React.ReactElement); powerSearchInitialState?: SearchExpressionTerm[]; + /** + * Adds a special power search entry to search through the entire row (mathching a substring in it after stringifying it as a JSON) + * @default true + */ + enablePowerSearchWholeRowSearch?: boolean; }; export type ItemRenderer = ( @@ -249,6 +254,20 @@ export function DataTable( const powerSearchConfig: PowerSearchConfig = useMemo(() => { const res: PowerSearchConfig = {fields: {}}; + if (props.enablePowerSearchWholeRowSearch) { + res.fields.entireRow = { + label: 'Row', + key: 'entireRow', + operators: { + searializable_object_contains: + dataTablePowerSearchOperators.searializable_object_contains(), + searializable_object_not_contains: + dataTablePowerSearchOperators.searializable_object_not_contains(), + }, + useWholeRow: true, + }; + } + for (const column of columns) { if (column.powerSearchConfig === false) { continue; @@ -268,7 +287,7 @@ export function DataTable( columnPowerSearchOperators = column.powerSearchConfig; } else { columnPowerSearchOperators = column.powerSearchConfig.operators; - useWholeRow = true; + useWholeRow = !!column.powerSearchConfig.useWholeRow; } const columnFieldConfig: FieldConfig = { @@ -284,7 +303,7 @@ export function DataTable( } return res; - }, [columns]); + }, [columns, props.enablePowerSearchWholeRowSearch]); const renderingConfig = useMemo>(() => { let startIndex = 0; @@ -787,6 +806,7 @@ DataTable.defaultProps = { enableContextMenu: true, enablePersistSettings: true, onRenderEmpty: undefined, + enablePowerSearchWholeRowSearch: true, } as Partial>; /* eslint-disable react-hooks/rules-of-hooks */