Skip to content

feat(search-bar): Add string filter wildcard operators #92570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jun 4, 2025

Conversation

nsdeschenes
Copy link
Contributor

@nsdeschenes nsdeschenes commented May 30, 2025

This PR focuses on updating the FilterOperator component to display some upcoming wildcard operators options "contains", "does not contain", "starts with", "ends with".

To accomplish this, I added in a new enum with the new term operators as they aren't actual operators with related symbols (e.g. >=), instead they will detect wildcard (*) characters and their location and depending on those wildcards it will determine which operator to display. Currently if you select one of the operators it will break. The underlying work to update the value with the respective wildcards will come in a follow up PR.

Example:
Screenshot 2025-05-30 at 15 20 38

@nsdeschenes nsdeschenes requested a review from malwilley May 30, 2025 18:26
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 30, 2025
@nsdeschenes nsdeschenes requested a review from a team May 30, 2025 18:27
@nsdeschenes nsdeschenes marked this pull request as ready for review May 30, 2025 18:27
Comment on lines 245 to 268
if (token.value.type === Token.VALUE_TEXT && hasWildcardOperators) {
if (token.negated) {
isDoesNotContain = token.value.wildcard === WildcardOperators.SURROUNDED;
} else {
isContains = token.value.wildcard === WildcardOperators.SURROUNDED;
isStartsWith = token.value.wildcard === WildcardOperators.LEADING;
isEndsWith = token.value.wildcard === WildcardOperators.TRAILING;
}
} else if (token.value.type === Token.VALUE_TEXT_LIST && hasWildcardOperators) {
if (token.negated) {
isDoesNotContain = token.value.items.every(
entry => entry.value?.wildcard === WildcardOperators.SURROUNDED
);
} else {
isContains = token.value.items.every(
entry => entry.value?.wildcard === WildcardOperators.SURROUNDED
);
isStartsWith = token.value.items.every(
entry => entry.value?.wildcard === WildcardOperators.LEADING
);
isEndsWith = token.value.items.every(
entry => entry.value?.wildcard === WildcardOperators.TRAILING
);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed that starts with and ends with here are backwards 🤦

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These have been fixed

@nsdeschenes nsdeschenes merged commit 1374b0f into master Jun 4, 2025
41 checks passed
@nsdeschenes nsdeschenes deleted the nd/feat-search-bar-add-wildcard-operators branch June 4, 2025 17:33
Copy link

codecov bot commented Jun 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #92570      +/-   ##
==========================================
- Coverage   86.66%   81.72%   -4.95%     
==========================================
  Files       10268    10268              
  Lines      589513   589493      -20     
  Branches    22926    22923       -3     
==========================================
- Hits       510884   481735   -29149     
- Misses      78183   106501   +28318     
- Partials      446     1257     +811     

andrewshie-sentry pushed a commit that referenced this pull request Jun 4, 2025
This PR focuses on updating the `FilterOperator` component to display
some upcoming wildcard operators options `"contains", "does not
contain", "starts with", "ends with"`.

To accomplish this, I added in a new enum with the new term operators as
they aren't actual operators with related symbols (e.g. `>=`), instead
they will detect wildcard (`*`) characters and their location and
depending on those wildcards it will determine which operator to
display. Currently if you select one of the operators it will break. The
underlying work to update the value with the respective wildcards will
come in a follow up PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants