elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.65k stars 8.23k forks source link

[APM] Move APM-specific validations from Fleet UI to APM settings form #125542

Open ogupte opened 2 years ago

ogupte commented 2 years ago

In #124336, we fixed validation errors related to duration fields by appending the duration unit (s for seconds) to values after those values are already passed to the Fleet custom UI extension onChange handler.

Currently, we assume loaded values are already valid, which is not always the case. This results in validation error being raised to the user immediately upon changing any settings value. Also we save all values, even intermediate values to the updatedPolicy object (along with isValid) as our staging area for edited values on every keystroke. Instead we should have our own staging area for these values and only call Fleet's onChange handler after a field is done being edited (onBlur or debounced onChange).

When these patterns are updated, the helper fixApmDurationVars can be moved to APM along with the DURATION_APM_SETTINGS_VARS constants.

elasticmachine commented 2 years ago

Pinging @elastic/apm-ui (Team:apm)

joshdover commented 2 years ago

Thanks for the explanation and for filing this, @ogupte. When this is re-visited, please consider any feedback/changes to the Fleet UI extension API that could make this simpler. I'd like to see us collaborate on how to make the integration points between Fleet and other Kibana plugins easier to consume and improve it's design to avoid "foot-guns" like this one.