Display user info after clicking on Lookup while provisioning VM #6391
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.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1765691
After clicking on Lookup button, the LDAP user's info was not displayed in the form as expected, while provisioning VM. The page was not properly updated, after clicking on the button. A simple change in
retrieve_email
method fixes the problem.While going to the other tab and going back (as mentioned in the BZ),
prov_field_changed
method was called. In this method,render
is called to update the page according to the changes on the provision form, and it works fine. This is why going to the other tab and going back 'solves' the missing info in the fields, after clicking on Lookup. The page is updated properly especially because of this line, comparing to the situation when it is not properly updated. Focus especially on thedialog_name
variable. And now check the changes in my PR.When the content of the page is generated, _prov_wf.html.haml is rendered. In this haml,
miq_tab_content
is called. These are dialog names as arguments formiq_tab_content
method in our situation (when first time in, after clicking on Provision VMs in the toolbar):Now see this - in this line a html block with the type
:div
with the idid
(and some other content) is returned,"_div"
is not added to the id of appropriate div, there's nothing like that.And if we call
render_html
, only appropriate divs are updated. We need to use"requester"
as a name of the div if we are in the Request tab, instead of"requester_div"
, to achieve that appropriate parts of the page will be updated.Before: (nothing happens after clicking on Lookup)
After: (user's info is displayed in the fields)
Note:
You will not be able to reproduce the bug always, especially if the email will not be the same as user principal name. See the BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1769517