feat: Add description support for PropertyFilter free text operators#4816
Draft
ernst-dev wants to merge 3 commits into
Draft
feat: Add description support for PropertyFilter free text operators#4816ernst-dev wants to merge 3 commits into
ernst-dev wants to merge 3 commits into
Conversation
InternalFreeTextFiltering now requires getOperatorDescription, so the freeTextFiltering literal in the editor-permutations page defaultProps failed buildPagesStatic with TS2741. Add getOperatorDescription: () => null to match the other filtering objects on this page.
The free-text operator description feature updated the public operators doc string and added PropertyFilterTextOperatorExtended.description; refresh the documenter snapshot to match. Previously masked by the editor-permutations dev-page compile fast-fail.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4816 +/- ##
=======================================
Coverage 97.61% 97.61%
=======================================
Files 952 952
Lines 30816 30822 +6
Branches 11318 11320 +2
=======================================
+ Hits 30081 30087 +6
- Misses 688 728 +40
+ Partials 47 7 -40 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Let consumers control the operator used for free-text filtering in
PropertyFilter, and expose it for custom handling.The base
freeTextFilteringAPI (operators,defaultOperator) already lets consumers pick which operators are available for free text and which is the default (for examplecontainsvsequalsvsstarts-with). However, free-text operators could not carry a consumer-provided description the way property operators can (PropertyFilterProps.FilteringPropertyoperators acceptdescription). As a result:~) showed an empty description in the operator dropdown.This PR adds an opt-in
descriptionfield to the free-text extended operator object and wires it through the token editor operator dropdown, mirroring the existing property-operatordescriptionpattern.What changed
PropertyFilterTextOperatorExtendednow accepts an optionaldescriptionstring.InternalFreeTextFilteringgains agetOperatorDescription(operator)resolver, built from the extended free-text operators ininternal.tsx(same pattern asInternalFilteringProperty.getOperatorDescription).OperatorInput(token editor) prefers the explicit free-text description, then falls back to the previous property-reuse heuristic, then to the built-in i18n string — so existing behavior is preserved.Backward compatibility: fully backward compatible —
descriptionis a new optional field; when omitted, the built-in i18n descriptions are used exactly as before.Related links, issue #: SIM AWSUI-61808.
How has this been tested?
src/property-filter/__tests__/property-filter-token-editor.test.tsx):uses custom descriptions provided for free text operators— verifies the free-text operator dropdown (and token trigger) shows consumer-provided descriptions, including for a custom~operator with no built-in i18n fallback.falls back to the built-in description when no custom free text description is provided— verifies mixed operators (custom description + built-in) resolve correctly.src/property-filterunit suite: 349 passed / 17 suites.quick-build(TypeScript + styles): green.eslinton all changed files: no errors.pages/property-filter/property-filter-freetext-operator.page.tsxdemonstratesdefaultOperator: '=', custom descriptions on=/:/^, and a custom~free-text operator with amatchfunction and description.Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
freeTextFiltering.operatorsand the newdescriptionfield.Security
checkSafeUrlfunction. — N/A (no URL handling).Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.