graylog2-server icon indicating copy to clipboard operation
graylog2-server copied to clipboard

Decouple keyword time range validation from keyword time range preview in time range picker. `6.0`

Open linuspahl opened this issue 1 year ago • 0 comments

Please note: This is a backport of https://github.com/Graylog2/graylog2-server/pull/18879 for 6.0

Description

Motivation and Context

With this PR we are separating the time range validation from time range preview in time keyword tab of the range picker.

This approach has multiple advantages

  • We are no longer using the validate prop of the keyword formik field and have all the validation in the form validate function
  • We no longer need to maintain the validatingKeyword state to disable the submit button while the keyword is being validated
  • The keyword preview and validation logic is a lot simpler and less error-prone

The main disadvantage:

  • we are currently doing two requests to test the keyword time range in the date time picker, on change. One for the validation and one for the preview.

This restructuring is fixing three bugs:

  • the problem described in https://github.com/Graylog2/graylog2-server/issues/18809. We are now always including the user time zone when defining a keyword time range.
  • before it often happened that the submit button stayed disabled after switching between the keyword tab and the other tabs
  • before this change the keyword time range preview was empty when opening the keyword tab while it contained the default keyword time range.

Fixes https://github.com/Graylog2/graylog2-server/issues/18809

linuspahl avatar Apr 24 '24 08:04 linuspahl