Allow create Service Dialog from Template on Ansible/Templates screen, depending on navigation steps #6412
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.
Issue: #6375
Relatively recently the Configuration toolbar button was added to Ansible Tower Templates screen, with possibility to create Service Dialog from a selected Template in the list. However, this button appeared also on the screen with the list of Templates related to selected node in accordion, for example related to Ansible Tower Automation Manager. While being in such a screen, creating Service Dialog did not work, nothing happened in the UI, and error occurred.
The problem is exactly here. It's easy to achieve the situation when both
params[:id]
andparams[:miq_grid_checks]
are set, so we are trying to find the selected item using the id which is inparams[:id]
becauseparams[:id]
is present, but we are not successful, obviously. We don't have proper id in this situation. The proper id we want to find the selected item is always inparams[:miq_grid_checks]
ifparams[:miq_grid_checks]
is present. If this was not true, then the fix wouldn't work.I've made change the way that it checks
params[:miq_grid_checks]
first. And if it is not present, we can find the selected item as originally - by id set inparams[:id]
. This works well in all the kinds of lists or in details pages of Templates underAutomation > Ansible Tower > Explorer
. Looks likeparams[:miq_grid_checks]
is never present if we are in a details page or in a list view with the All Ansible Tower Templates node selected in accordion.Related PR: #5968
Before: (nothing happens in the UI)
![template_before](https://user-images.githubusercontent.com/13417815/68787347-a048fc00-0641-11ea-89de-78b2f627fe8d.png)
After:
![template_after](https://user-images.githubusercontent.com/13417815/68787212-64159b80-0641-11ea-9865-dd15956cf2ae.png)