redwood icon indicating copy to clipboard operation
redwood copied to clipboard

[RFC]: Adapt scaffold to support new Byte format instead of [object object] rendering

Open matbgn opened this issue 3 months ago • 2 comments

Summary

Take into consideration that Bytes are now supported and should be treated accordingly on Form generated by scaffold like on the screenshot below:

image

The aim is that yarn rw g scaffold <...> will deal with a really basic mechanic of downloading and uploading bytes files instead of [object object] rendering.

Motivation

Based on feedback from @dthyresson I submit this RFC

https://community.redwoodjs.com/t/redwood-v7-0-0-upgrade-guide/5713/6

Detailed proposal

Basically, I would propose to adapt the scaffold CLI to use FileField instead of TextField within the CRUD Form for the uploading part.

For the rendering part, I would just say that a direct download is totally acceptable for a first step or maybe display it’s Base64/Raw equivalent like the dbStudio does.

Are you interested in working on this?

  • [ ] I'm interested in working on this

matbgn avatar Mar 24 '24 20:03 matbgn

Hi @matbgn and thanks for the RFC.

Have you tried to eject the scaffold generators via https://redwoodjs.com/docs/cli-commands#generate-scaffold to see if the template can simply be changed? Or might a new mapping for type and input component be needed here: https://github.com/redwoodjs/redwood/blob/0e8c0ec0afefa2dae53657011c6957dd183aff31/packages/cli/src/commands/generate/scaffold/scaffold.js#L309

If so, could you provide either some sample markup or a sample small app to reproduce and check that the form submits properly.

Question: on the view scaffolds, how should the Byte content be represented?

dthyresson avatar Mar 25 '24 21:03 dthyresson

I wasn't able to eject it properly, possibly due to misuse. Anyway, I suggest just downloading the byte and not trying to display it. This means that the contents of the byte must be displayed with a download logo.

matbgn avatar Apr 20 '24 16:04 matbgn