-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution][Exceptions] - Updates autocomplete validation for numbers and boolean #74561
[Security Solution][Exceptions] - Updates autocomplete validation for numbers and boolean #74561
Conversation
Pinging @elastic/siem (Team:SIEM) |
@elasticmachine merge upstream |
Just a bounds nit (so no need to fix here), but seems the field is truncated and displayed in scientific notation and the number picker no longer functions. This doesn't appear to cause any issues though, as modifying & re-saving the exception keeps the original value. Also note, number validation doesn't take effect for |
x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.tsx
Outdated
Show resolved
Hide resolved
...ck/plugins/security_solution/public/common/components/autocomplete/field_value_match_any.tsx
Outdated
Show resolved
Hide resolved
...ty_solution/public/common/components/autocomplete/hooks/use_field_value_autocomplete.test.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked out locally and desk tested, and performed code review. Great cleanup here @yctercero, and even more tests to boot! 🎉 Left a couple nits and notes about some behaviors I was seeing (address if you'd like), but this LJLTM (Looks Just Lovely To Me :)! 👍
a442647
to
d31743f
Compare
@spong Thanks so much for the 👀 . I went back and fixed the various things you noted. I made the input for boolean types into a select so now user can't even type anything in there. I also added validation for numbers when operator is |
x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.tsx
Outdated
Show resolved
Hide resolved
...ck/plugins/security_solution/public/common/components/autocomplete/field_value_match_any.tsx
Outdated
Show resolved
Hide resolved
We're in super-nit territory at this point so feel free to ignore.... 😅 When changing focus the validation error will bounce between I could see this going either way, but when a validation error is displayed it increases the height of the exception entry and will move the trash icon down to keep it vertically centered. May want to keep vertically centered with the value input field |
@@ -110,8 +110,11 @@ export const EditExceptionModal = memo(function EditExceptionModal({ | |||
>([]); | |||
const { addError, addSuccess } = useAppToasts(); | |||
const { loading: isSignalIndexLoading, signalIndexName } = useSignalIndex(); | |||
const memoSignalIndexName = useMemo(() => (signalIndexName !== null ? [signalIndexName] : []), [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is working for me, good find 👍
💚 Build SucceededMetrics [docs]async chunks size
History
To update your PR or re-run it, just comment with: |
… numbers and boolean (elastic#74561) ## Summary This PR chips a bit at some stricter value validations that have been discussed. Further validation is needed, but this adds some more basic validation. - **Current:** if selected field is of type `boolean` users can add custom values in combo box - **Now:** if selected field is of type `boolean` users can only select `true` or `false` - **Current:** if selected field is of type `number` (that is kibana type number) user can input any values - **Now:** if selected field is of type `number` and no autocomplete suggestions are available, number input is used to restrict users - **Current:** for operator `match_any` it's conducting an autocomplete search after each selection resulting in some jumpy/weird behavior - **Now:** only conducts autocomplete search on initial field selection and if user enters value to search - **Current:** only validations on type date - **Now:** validation on type (Kibana type) date, number - **Current:** input would show red when there was an error but user could still submit - **Now:** submit button is disabled if error exists
… numbers and boolean (#74561) (#79808) ## Summary This PR chips a bit at some stricter value validations that have been discussed. Further validation is needed, but this adds some more basic validation. - **Current:** if selected field is of type `boolean` users can add custom values in combo box - **Now:** if selected field is of type `boolean` users can only select `true` or `false` - **Current:** if selected field is of type `number` (that is kibana type number) user can input any values - **Now:** if selected field is of type `number` and no autocomplete suggestions are available, number input is used to restrict users - **Current:** for operator `match_any` it's conducting an autocomplete search after each selection resulting in some jumpy/weird behavior - **Now:** only conducts autocomplete search on initial field selection and if user enters value to search - **Current:** only validations on type date - **Now:** validation on type (Kibana type) date, number - **Current:** input would show red when there was an error but user could still submit - **Now:** submit button is disabled if error exists
Pinging @elastic/security-solution (Team: SecuritySolution) |
Summary
This PR chips ⛏️ a bit at some stricter value validations that have been discussed. Further validation is needed, but this adds some more basic validation.
boolean
users can add custom values in combo boxboolean
users can only selecttrue
orfalse
number
(that is kibana type number) user can input any valuesnumber
and no autocomplete suggestions are available, number input is used to restrict usersmatch_any
it's conducting an autocomplete search after each selection resulting in some jumpy/weird behaviorTODO
Boolean
Number w/ autocomplete values available
Number w/o autocomplete values available
Match any jitter
Before
After
Validation (disabling submit)
Checklist
Delete any items that are not applicable to this PR.