Dialog field loading/refresh refactor to fix automate delays #17329
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.
This PR is intended to fix an issue where the automate methods for dialog fields were running multiple times for seemingly no reason. Upon loading of a dialog (via custom button click or service catalog order, for example), sometimes dialog fields would also run in a seemingly random order. We figured out that due to the way the
#value
method was written for some of the dialog field types, those would call the automate method first, before the method#initialize_with_values
was called.However,
#initialize_with_values
was kind of misnamed, as it was really more about just establishing values for the context in theResourceActionWorkflow
. So, I've renamed that method and adjusted the logic around when it gets called.Another large change is that the
DialogFieldSerializer
was making a call to the automate methods because if a field was dynamic it would try to get the values for that field. However, I don't think this should be the job of the serializer, it should simply serialize what it's given. So if something needs to update, it now does so before calling into the serializer.For a refresh,
#initialize_with_values
was closer to the correct name of describing what needed to be done, but I also added#load_values_into_fields
for when the dialog needs to refresh. Note that the logic to go into this method depends upon an option that gets passed in from this API PR.This PR touches all of the
DialogField
types and theDialog
model itself, as well as theResourceActionWorkflow
, which are (obviously) how every single dialog do their thing. Therefore, this PR should undergo a much more rigorous test before merging. QE is involved in helping test this PR as well.Needs ManageIQ/manageiq-api#365 to be merged first.
https://bugzilla.redhat.com/show_bug.cgi?id=1559757
https://bugzilla.redhat.com/show_bug.cgi?id=1571000