Open ogupte opened 2 years ago
Pinging @elastic/apm-ui (Team:apm)
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.
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 withisValid
) 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'sonChange
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 theDURATION_APM_SETTINGS_VARS
constants.