Skip to content

Commit

Permalink
Update LogViewerSearch.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
tevko authored Sep 26, 2024
1 parent 2079d99 commit 01c3e51
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/module/src/LogViewer/LogViewerSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<LogViewerSearchProps> = forwardRef(({
Expand Down Expand Up @@ -42,7 +44,9 @@ export const LogViewerSearch: React.FunctionComponent<LogViewerSearchProps> = 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 */
Expand Down Expand Up @@ -82,6 +86,9 @@ export const LogViewerSearch: React.FunctionComponent<LogViewerSearchProps> = fo
setCurrentSearchedItemCount(DEFAULT_INDEX);
setSearchedWordIndexes([]);
setRowInFocus(defaultRowInFocus);
if (props.parentSearchCB) {
props.parentSearchCB();
}
};

/* Moving focus over to next row containing searched word */
Expand Down

0 comments on commit 01c3e51

Please sign in to comment.