motor-admin / motor-admin-rails

Low-code Admin panel and Business intelligence Rails engine. No DSL - configurable from the UI. Rails Admin, Active Admin, Blazer modern alternative.
https://app.getmotoradmin.com/demo/
MIT License
752 stars 76 forks source link

Active Storage Direct Upload #135

Closed kevin-dapps closed 11 months ago

kevin-dapps commented 11 months ago

Description

This PR adds Direct Uploads functionality to Motor Admin. It allows a user to opt-in to enabled it globally throughout their Admin interface. It will perform small and large uploads using the direct upload behavior.

To configure your Active Storage provider correctly to use Direct Uploads, please see the Rails documentation on setting up the correct CORS policies.

Adds environment variable MOTOR_ACTIVE_STORAGE_DIRECT_UPLOADS_ENABLED that controls global direct upload functionality.

kevin-dapps commented 11 months ago

I think an improvement that could be made if I add a progress bar or percentage since for large uploads the current loading icon does not give the user much feedback on how much is left. They may think it is broken.

omohokcoj commented 11 months ago

@kevin-dapps the PR looks good to me so far - but does it actually work? Seems like we also need to adjust rails backend to accept signed_id of blob when creating active storage attachment?

kevin-dapps commented 11 months ago

@omohokcoj I've tested this and it is working correctly if CORS is setup on the bucket. The rails active storage methods can handle a signed_id being passed to the model update call and associates the proper ActiveRecord attachment and blob record

omohokcoj commented 11 months ago

@kevin-dapps thanks, it has been released in 0.4.22