-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
[5.x] Improve feedback when action fails #10264
Merged
jasonvarga
merged 16 commits into
statamic:5.x
from
simonerd:improve-action-response-when-save-fails
Sep 23, 2024
Merged
[5.x] Improve feedback when action fails #10264
jasonvarga
merged 16 commits into
statamic:5.x
from
simonerd:improve-action-response-when-save-fails
Sep 23, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We just realised in a different case that this also applies to the 'delete' action. I have extended the code to also cover that. |
simonerd
changed the title
[5.x] Improve action feedback when save fails
[5.x] Improve feedback when action fails
Jun 6, 2024
# Conflicts: # resources/lang/de.json # resources/lang/de_CH.json # resources/lang/fr.json # resources/lang/nl.json
jasonvarga
approved these changes
Sep 23, 2024
duncanmcclean
added a commit
to statamic-rad-pack/runway
that referenced
this pull request
Sep 27, 2024
This should mean that the built assets include the changes from statamic/cms#10264. Fixes #614.
caseydwyer
added a commit
to caseydwyer/statamic-cms
that referenced
this pull request
Sep 27, 2024
mirrors the `data-list\HasActions.js` approach, as updated in statamic#10264.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
replaces concerned parts of #10191
requires changes in Revisable from #10263
With the changes in #10263 the
publishWorkingCopy
andunpublishWorkingCopy
returnfalse
when save fails (e. g. because an entrySaving listener returnsfalse
). When working on this I realised that the publish/unpublish actions don't show any errors if saving fails. In this PR I added a way of letting an action fail and optionally add a message that will be shown in the error toast.// edit: extended to also cover the 'delete' action
Additionally, I was not quite happy with the handling of the action modal. So far, if the action was not successful, the confirmation modal would still be shown and an error toast would pop up. This kind of suggests that something went technically wrong, as the interface is stuck – similar to when an ajax error occurres.
I felt like it would be more appropriate if the modal closes, but the error toast doesn't just give you a generic "action failed" answer. To get there, I introduced a status information to the ActionController response, and adjusted the modal handling based on that status. Errors because of missing auth or something else still leave the modal open, while unsuccessful publish/unpublish actions close the modal and show an error toast.