Skip to content

Commit

Permalink
Events table search queries regular expressions as well as substrings
Browse files Browse the repository at this point in the history
fixes #410

Signed-off-by: hriday-panchasara <hriday.panchasara@ericsson.com>
  • Loading branch information
hriday-panchasara authored and bhufmann committed Nov 4, 2021
1 parent 962cd44 commit 5e822e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ export class TableOutputComponent extends AbstractOutputComponent<TableOutputPro
this.gridApi.forEachNode(rowNode => {
let isMatched = true;
this.filterModel.forEach((value, key) => {
if (!rowNode.data[key].includes(value)) {
if ((rowNode.data[key].search(new RegExp(value)) === -1)) {
isMatched = false;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ export class CellRenderer extends React.Component<CellRendererProps> {
if (this.props.filterModel.size > 0) {
if (isMatched) {
cellElement = <>
{currFieldVal.split(searchTerm).map((tag: string, index: number, array: string[]) =>
{currFieldVal.split(new RegExp(searchTerm)).map((tag: string, index: number, array: string[]) =>
<span key={index.toString()}>
<>
{tag}
</>
<>
{
index < array.length - 1 ?
<span style={{ backgroundColor: this.props.searchResultsColor }}>{searchTerm}</span>
<span style={{ backgroundColor: this.props.searchResultsColor }}>{currFieldVal.match(new RegExp(searchTerm))[0]}</span>
: <></>
}
</>
Expand Down

0 comments on commit 5e822e9

Please sign in to comment.