keystonejs-contrib / k6-contrib

Keyston-6 contrib
MIT License
35 stars 18 forks source link

fields-azure: add support for preserve in storage config #42

Closed sfodor closed 1 year ago

sfodor commented 1 year ago

The implementation of the github issue #41

gautamsi commented 1 year ago

there is a major difference in the revamped keystone storage and one here, I am still keeping the old one which uses ref to point to same image, perhaps that will be difficult with this. can you make changes to component so that the ref feature can not be used if preserve is used?

sfodor commented 1 year ago

Can you explain the role of the ref feature? Do we know that an item is uploaded with a ref to point to same image? Shall I just update the createInputResolver functions with a condition like this?

if (data.ref && !config.preserve) {
   throw new Error('Only ref can not be passed to ImageFieldInput / FileFieldInput when preserve is not enabled');
}
gautamsi commented 1 year ago

ref feature was in original keystone6 storage adapter (pre s3). it used to be a button right of image, you could copy the ref or paste ref, this used to point to same image in storage. this means you are using same image without even uploading new one.

with Ref it was easy to reuse same image and I have seen people creating custom gallery and pick item from the gallery.

azure and s3 fields in this repo is based on that UI, so if you use preserve = false by default, it is going to affect everyone and especially ref feature breaks all the other images using same ref,

sfodor commented 1 year ago

Hi Gautam, I've updated the default and the usage of ref is not allowed when preserve is disabled. Do you recommend any further changes?