ahmedkandel / nova-s3-multipart-upload

A Laravel Nova resource tool to upload files directly to Amazon S3. You can (upload | download | delete) single, multiple, small or big files.
MIT License
22 stars 22 forks source link

Refresh resource after file is uploaded #14

Closed matthewswallace closed 3 years ago

matthewswallace commented 3 years ago

My resource has a File::make("Asset) field so that I can show a thumbnail of the image after it is uploaded and also I use this to show a thumbnail on the details view of the resource.

After I use the uploader I'd like to know if there is a callback or something that I can use in order to refresh the detail view of the resource so that the File:: field will show the thumbnail of the image that was just uploaded?

If not I would like to suggest an enhancement to add this as a feature for if the plugin could act more like the rest of the Nova fields and have a "detail and index view that would render the thumbnail of the file that is attached.

ahmedkandel commented 3 years ago

Unfortunately, Nova doesn't expose any API that we can use to refresh the "detail view" data "Vue props" without hard refresh the whole page that will break any files that are still being uploaded.

So using Nova native File field to view a file or its thumbnail is a good approach but in detail view, it is not needed as this package already views the file or its thumbnail inside the uploader so no need for the detail view.

As explained in the README Notes this package is a tool, not a field so it has no index o form views it only shows in the detail view. So for the index view use Nova native File field while for the other views it is not needed.