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

Fixes #11452 - Asset Restore routes/buttons also asset models/users restore as well #11453

Merged
merged 5 commits into from
Jul 2, 2022

Conversation

mikeroq
Copy link
Contributor

@mikeroq mikeroq commented Jul 2, 2022

Description

Fixes #11452

The restore asset button is a POST form, while the route was a GET. Changed the route to be POST.

I would probably do that as a PATCH, and/or use the API route instead since they are basically duplicates but this would at least get it working for now.

Had to modify the genericActionsFormatter to use a POST form instead of a link. This also affected some other restores. Fixing the formatter got the asset model restore working from the table. This time the route was POST and the button was a link since it came from that formatter. Modifying the genericActionsFormatter also effected the users restore from the deleted users table.

Changes:

Bootstrap tables partial view:
Change genericActionsFormatter to have a POST form instead of link for restore.

Asset Routes:
Changed restore route to POST

User Routes:
Changed restore route to POST.
Removed duplicate routes.

Users view:
Updated the user view to use a POST form a well.
Removed the link in the alert since it just duplicated the action button on the ride side. If you want I can add that back as a form.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Asset can be restored from it's view
Asset can be restored from deleted assets table

Asset model can be restored from show deleted table

User can be restored from it's view
User can be restored from show deleted table

Test Configuration:

  • PHP version: 8.0.20
  • MySQL version 8.0.29
  • Webserver version Apache 2.4.1
  • OS version Ubuntu 20.4.04

Checklist:

@mikeroq mikeroq requested a review from snipe as a code owner July 2, 2022 16:10
@mikeroq mikeroq changed the title Change restore route to POST instead of GET Fixes #11452 Change asset restore route to POST instead of GET Jul 2, 2022
@mikeroq mikeroq changed the base branch from master to develop July 2, 2022 16:12
@mikeroq
Copy link
Contributor Author

mikeroq commented Jul 2, 2022

Ugh I don't know how these other commits keep getting in there.

@mikeroq mikeroq force-pushed the fixes/asset_restore_not_working branch from 0db0403 to 90567ea Compare July 2, 2022 16:17
@mikeroq mikeroq force-pushed the fixes/asset_restore_not_working branch from 90567ea to 0a5ca6e Compare July 2, 2022 19:35
@mikeroq
Copy link
Contributor Author

mikeroq commented Jul 2, 2022

Whoops I missed that deleted assets table was also using the genericActionsFormatter. So I closed my other PR and moved those commits into this since it's connected.

@mikeroq mikeroq changed the title Fixes #11452 Change asset restore route to POST instead of GET Fixes #11452 - Asset Restore routes/buttons also asset models and users Jul 2, 2022
@mikeroq mikeroq changed the title Fixes #11452 - Asset Restore routes/buttons also asset models and users Fixes #11452 - Asset Restore routes/buttons also asset models/users restore as well Jul 2, 2022
@snipe snipe merged commit af14ee0 into snipe:develop Jul 2, 2022
@snipe
Copy link
Owner

snipe commented Jul 2, 2022

Thanks! I was just working on this fix when your PR came through!

@mikeroq mikeroq deleted the fixes/asset_restore_not_working branch July 2, 2022 20:13
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.

"405 Method Not Allowed" error message shows when try to restore delete assets
2 participants