-
Notifications
You must be signed in to change notification settings - Fork 357
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
Make redirects after actions the way user would expect #1130
Make redirects after actions the way user would expect #1130
Conversation
0e6c19b
to
e95e7b5
Compare
:flash_error => @flash_array[0][:level] == :error | ||
if !@flash_array.nil? && params[:pressed].ends_with?("delete") && @display != "cloud_object_store_objects" | ||
session[:flash_msgs] = @flash_array.dup | ||
javascript_redirect previous_breadcrumb_url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@miha-plesko While this works perfectly when the Cloud Object Store Containers are accessed from the Storage Manager Summary screen because we have a valid previous_breadcrumb_url
, it does not work when I try to delete an item directly from cloud_object_store_container/show_list
.
----] F, [2017-04-24T14:38:50.130901 #40537:3fce76c292a8] FATAL -- : Error caught: [NoMethodError] undefined method `[]' for nil:NilClass
/Users/aparnakarve/rh/master/manageiq/plugins/manageiq-ui-classic/app/controllers/application_controller.rb:2061:in `previous_breadcrumb_url'
Note that there are no breadcrumbs on this (cloud_object_store_container/show_list
) screen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I don't know how this could have slipped through my testing. Fixed.
@AparnaKarve thank you for testing. I've fixed the annoying problem that you've found by rewriting the if statement so that one can easily read it now. It bases on observation that variable
I'm looking forward to your response. |
I'm not sure why Travis is failing, it doesn't seem related. |
Travis failures will be addressed with this: #1154 |
@miha-plesko Overall, LGTM. We have a mixin called def delete_action
if @display == "main"
session[:flash_msgs] = @flash_array.dup if @flash_array
javascript_redirect(previous_breadcrumb_url)
else
render_flash unless @flash_array.nil? || performed?
end
end And then delete_action if params[:pressed].ends_with?("delete") in the controller to call I think this should DRY things up and hopefully clear up those CC |
When user deleted an object/container, she was always redirected to the list of all containers, but this brings bad UX. Fixed by redirecting user to the parent page of the element that she just deleted - just like she would have expected. BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1444078 Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
Redirecting logic was more complex than needed so we simplify it. It is much more readable now. Also unit test is added for each case it covers. Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
4dbfe7a
to
044767e
Compare
Very similar redirecting logic was needed for Objects and Containers. To keep it DRY we extract that common logic into mixin. With Container, however, we must be careful to always render flash because some other operations are supported there besides `delete`, namely `clear`. Also added unit test that checks that flash is rendered for `clear` operation. Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
044767e
to
4646a1c
Compare
Checked commits miha-plesko/manageiq-ui-classic@bf62d8d~...4646a1c with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
I've pushed additional commit as an answer to Aparna's comments. I had to complicate things with additional IF statement otherwise @mzazrivec looking forward to your review. |
This PR is fixing this BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1444078 |
Make redirects after actions the way user would expect (cherry picked from commit 3febb8e) https://bugzilla.redhat.com/show_bug.cgi?id=1458899
Fine backport details:
|
When user deleted an object/container, she was always redirected to the list of all containers, but this brings bad UX. Fixed by redirecting user to the parent page of the element that she just deleted - just like she would have expected.
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1444078
@miq-bot assign @AparnaKarve
@miq-bot add_label bug