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

Advanced Search Save: don't create unnecessary flash message #5220

Conversation

mzazrivec
Copy link
Contributor

  1. Advanced search
  2. Commit search expression
  3. Hit Save button
  4. Watch log/evm.log

Before:

ERROR -- : MIQ(vm_infra_controller-adv_search_button): Search Name is required

After: no unnecessary error log

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

@@ -45,7 +45,7 @@ def adv_search_build(model)

def adv_search_button_saveid
if @edit[:new_search_name].nil? || @edit[:new_search_name] == ""
add_flash(_("Search Name is required"), :error)
add_flash(_("Search Name is required"), :error) if params[:button] == 'saveit'
Copy link
Contributor

Choose a reason for hiding this comment

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

@mzazrivec not sure i understand the purpose of this check, this method is called when save/saveit buttons are pressed, don't we need to show flash message in both cases?

case params[:button]
when "save", "saveit"
if adv_search_button_saveid

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIRC, save button is that Save button, which takes you from expression editor to the filter save form. saveit does the actual filter save.

So in the first case, we don't render any flash message. The above code would just cause the flash message to show in app's log. We want to render flash only in the second case, hence the fix above. Although I'm not 100% sure this is the best fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

@mzazrivec makes sense now, thx for explanation 👍

@miq-bot
Copy link
Member

miq-bot commented Feb 12, 2019

Checked commit mzazrivec@d6028b8 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🍪

@h-kataria h-kataria self-assigned this Feb 28, 2019
@h-kataria h-kataria added this to the Sprint 106 Ending Mar 4, 2019 milestone Feb 28, 2019
@h-kataria h-kataria merged commit 278033d into ManageIQ:master Feb 28, 2019
@mzazrivec mzazrivec deleted the adv_search_save_dont_create_unnecessary_flash_msg branch February 28, 2019 16:43
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.

3 participants