From 01c3e51bb9cbdc026a22936320ceaf4d47a71b00 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 25 Sep 2024 21:11:51 -0500 Subject: [PATCH] Update LogViewerSearch.tsx --- packages/module/src/LogViewer/LogViewerSearch.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/module/src/LogViewer/LogViewerSearch.tsx b/packages/module/src/LogViewer/LogViewerSearch.tsx index 6c7b763..3d61950 100644 --- a/packages/module/src/LogViewer/LogViewerSearch.tsx +++ b/packages/module/src/LogViewer/LogViewerSearch.tsx @@ -15,6 +15,8 @@ export interface LogViewerSearchProps extends SearchInputProps { placeholder: string; /** Minimum number of characters required for searching */ minSearchChars: number; + ref: any; + parentSearchCB: any; } export const LogViewerSearch: React.FunctionComponent = forwardRef(({ @@ -42,7 +44,9 @@ export const LogViewerSearch: React.FunctionComponent = fo useImperativeHandle(ref, () => ({ setSearchedInputExternal(input: string) { setSearchedInput(input) - } + }, + hasFoundResults: searchedWordIndexes?.length > 0 && searchedWordIndexes[0]?.rowIndex !== -1, + })); /* Defaulting the first focused row that contain searched keywords */ @@ -82,6 +86,9 @@ export const LogViewerSearch: React.FunctionComponent = fo setCurrentSearchedItemCount(DEFAULT_INDEX); setSearchedWordIndexes([]); setRowInFocus(defaultRowInFocus); + if (props.parentSearchCB) { + props.parentSearchCB(); + } }; /* Moving focus over to next row containing searched word */