Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix opening incorrect tag page, opened for Ansible Playbooks navigated through Repository summary page #3721

Conversation

hstastna
Copy link

@hstastna hstastna commented Apr 5, 2018

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1560482


Problem:
Incorrect tag page was opened for tagging Playbooks navigated through Repository summary page (of some repo under Automation > Ansible > Repositories) because params[:pressed] was not properly set ("ansible_repository_tag" instead of "embedded_configuration_script_payload_tag") and then also wrong parameter went to tag method. This was caused by wrong choosing of toolbar for the page - this was caused here: https://github.com/hstastna/manageiq-ui-classic/blob/master/app/controllers/ansible_repository_controller.rb#L14

Solution:
The right toolbar for Playbooks has to be chosen, when navigating to Playbooks through Repository summary page.

Navigating to Playbooks through Repository summary page:
playbooks_nested

Navigating to Playbooks normally (Automation > Ansible > Playbooks), see the toolbar:
playbooks_normal

Note:
Original way of choosing toolbars for Ansible Playbooks/Repos/Credentials pages can cause more problems than mentioned in the BZ (link above). This is why this was changed for all of these pages, unified. Also another cases for params[:pressed] were added to button methods in appropriate controllers.

Done:

  • add new method center_toolbar_filename_embedded_ansible to toolbar chooser to choose toolbar for Ansible Playbooks/Repos/Credentials properly
  • add condition to toolbar chooser to center_toolbar_filename_classic method for proper choosing toolbar of Ansible Playbooks/Repos/Credentials pages if @display variable is set
  • remove unnecessary calling toolbar method from ansible playbook controller which was the original way of choosing toolbar, implemented in Add RBAC and Tagging Support to Ansible Playbooks #3522 (as the same way was already implemented in Ansible Credentials/Repositories pages)
  • remove unnecessary calling toolbar method from ansible repository controller because this did not work well and add new case to button method for tagging playbooks from nested list
  • remove unnecessary calling toolbar method from ansible credential controller because this did not work well and add new case to button method for tagging repositories displayed in a nested list (incl. small change https://github.com/ManageIQ/manageiq-ui-classic/pull/3721/files#diff-127a850b7d7b20173ad3fba88f8a25e3R238)
  • spec tests for the changes

Before:
playbooks_edit_tags_bad
playbooks_tag_bad

After:
playbooks_edit_tags_ok
playbooks_tag

@hstastna
Copy link
Author

hstastna commented Apr 5, 2018

@miq-bot add_label bug

@hstastna hstastna force-pushed the Tagging_Ansible_Incorrect_tag_page_playbooks_through_repo branch 9 times, most recently from 571f123 to 0412356 Compare April 6, 2018 12:40
@hstastna hstastna changed the title [WIP] Fix opening incorrect tag page, opened for Ansible Playbooks navigated through Repository summary page Fix opening incorrect tag page, opened for Ansible Playbooks navigated through Repository summary page Apr 6, 2018
@hstastna
Copy link
Author

hstastna commented Apr 6, 2018

@miq-bot remove_label wip

@miq-bot miq-bot removed the wip label Apr 6, 2018
@hstastna
Copy link
Author

@miq-bot add_label gaprindashvili/yes

@hstastna
Copy link
Author

@miq-bot add_label tagging

@@ -49,6 +48,8 @@ def button
end
when "ansible_repository_tag"
tag(self.class.model)
when "embedded_configuration_script_payload_tag" # playbooks from nested list
tag(model_string_to_constant(@display))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you pass a constant here? (rather than trusting whatever might be in @display)

@hstastna hstastna force-pushed the Tagging_Ansible_Incorrect_tag_page_playbooks_through_repo branch 2 times, most recently from 5e2e831 to 138b874 Compare April 10, 2018 13:58
@miq-bot
Copy link
Member

miq-bot commented Apr 26, 2018

This pull request is not mergeable. Please rebase and repush.

@hstastna hstastna force-pushed the Tagging_Ansible_Incorrect_tag_page_playbooks_through_repo branch 2 times, most recently from e2589cc to 8b496b4 Compare April 26, 2018 11:59
@hstastna
Copy link
Author

@skateman Some spec tests to revieew for you here, too! ;) 🙏

@hstastna
Copy link
Author

@miq-bot add_reviewer @skateman

@miq-bot miq-bot requested a review from skateman April 26, 2018 12:13
Hilda Stastna added 6 commits May 18, 2018 14:03
Remove calling toolbar method from ansible repository controller
because this did not work well; add new case to button method for
tagging playbooks from nested list.
Remove calling toolbar method from ansible credential controller
because this did not work well; add new case to button method for
tagging repositories displayed in a nested list.
Add a spec test for changes, related to tagging Ansible Repositories
from a nested list, in ansible credential controller.
Add a spec test for changes, related to tagging Ansible Playbooks
from a nested list, in ansible repository controller.
Add spec test for changes related to Ansible Playbooks/Repositories/Credentials pages.
Add spec tests to check rendering correct toolbars for Ansible
Credentials,Repositories or Playbooks list screens.
@hstastna hstastna force-pushed the Tagging_Ansible_Incorrect_tag_page_playbooks_through_repo branch from 09ade7d to 8e188db Compare May 18, 2018 12:04
@miq-bot
Copy link
Member

miq-bot commented May 18, 2018

Checked commits hstastna/manageiq-ui-classic@0d1ddab~...8e188db with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
8 files checked, 0 offenses detected
Everything looks fine. 👍

@hstastna
Copy link
Author

@martinpovolny I've added some simple tests. Do you think that it is enough or should I add anything else? Thanks! :)

@martinpovolny
Copy link
Member

@skateman : did you test this in the UI?

Thx!

Copy link
Member

@skateman skateman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Seal of Approval

@hstastna
Copy link
Author

@martinpovolny Can this PR be merged? It looks like fixing that BZ is important, as another BZ for the same problem was created: https://bugzilla.redhat.com/show_bug.cgi?id=1581635 (I have marked it as a dup).

@martinpovolny martinpovolny merged commit 09a453a into ManageIQ:master May 23, 2018
@martinpovolny martinpovolny added this to the Sprint 87 Ending Jun 4, 2018 milestone May 23, 2018
simaishi pushed a commit that referenced this pull request May 29, 2018
…page_playbooks_through_repo

Fix opening incorrect tag page, opened for Ansible Playbooks navigated through Repository summary page
(cherry picked from commit 09a453a)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1583779
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit 8680d2f0660cb155940789c668bfbc835285e695
Author: Martin Povolny <mpovolny@redhat.com>
Date:   Wed May 23 17:17:19 2018 +0200

    Merge pull request #3721 from hstastna/Tagging_Ansible_Incorrect_tag_page_playbooks_through_repo
    
    Fix opening incorrect tag page, opened for Ansible Playbooks navigated through Repository summary page
    (cherry picked from commit 09a453a95bf7a68ff5f5d3d4e868cfcdfe04a118)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1583779

@himdel
Copy link
Contributor

himdel commented Jun 13, 2018

@martinpovolny @hstastna was this really necessary?

The whole point of that toolbar helper was so that we could specify this in the controller, and not in a maze of twisty little methods elsewhere.

I would have thought that extending the helper to take a Proc that decides would have been more in line with that goal...

(And if not, setting @center_toolbar in the action where it's supposed to be different should also work.)

@martinpovolny
Copy link
Member

@himdel : Right. I did not realize that this was an opportunity to move forward in that direction.

@hstastna : can you look into that in a follow up PR, please?

@hstastna
Copy link
Author

@himdel @martinpovolny Yes, of course, I can look into that in a follow up PR. Thanks!

hstastna pushed a commit to hstastna/manageiq-ui-classic that referenced this pull request Jun 21, 2018
related PR: ManageIQ#3721

Move setting toolbar filename to Ansible Playbook/Credential/Repository controllers
by defining new toolbar method which takes care also about setting toolbar name while
displaying nested lists from summary pages.
hstastna pushed a commit to hstastna/manageiq-ui-classic that referenced this pull request Jun 21, 2018
related PR: ManageIQ#3721

Move setting toolbar filename to Ansible Playbook/Credential/Repository controllers
by defining new toolbar method which takes care also about setting toolbar name while
displaying nested lists from summary pages.
hstastna pushed a commit to hstastna/manageiq-ui-classic that referenced this pull request Jun 21, 2018
related PR: ManageIQ#3721

Move setting toolbar filename to Ansible Playbook/Credential/Repository controllers
by defining new toolbar method which takes care also about setting toolbar name while
displaying nested lists from summary pages.
hstastna pushed a commit to hstastna/manageiq-ui-classic that referenced this pull request Jun 21, 2018
related PR: ManageIQ#3721

Move setting toolbar filename to Ansible Playbook/Credential/Repository controllers
by defining new toolbar method which takes care also about setting toolbar name while
displaying nested lists from summary pages.
hstastna pushed a commit to hstastna/manageiq-ui-classic that referenced this pull request Jun 28, 2018
related PR: ManageIQ#3721

Move setting toolbar filename to Ansible Playbook/Credential/Repository controllers
by defining new toolbar method which takes care also about setting toolbar name while
displaying nested lists from summary pages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants