Closed mb8z closed 4 years ago
Hmm. you can open a chrome terminal and check out what is in the ReduxStore. There is a global variable REDUX_STATE which holds all the values. Then navigate to resources and see which editProperties are assigned for an Offer and whether the coupon_id is among them (but remove options.properties.coupon_id from your ResourceOptions first).
If not - probably admin-bro-mongoose has problem with parsing your entity. Maybe you forgot to run the migrations? - hard to tell.
You can write also a before hook for edit action and see what is in context.resource.properties() (3rd parameter).
Please let me know what was the result.
Regarding the "manual reference field" it is not possible this way. You have to create new property and then write custom component which will handle that. But if AdminBro doesn't have your property you will have to populate the database manually (== lots of work).
So please try debug this in the way I suggested and let me know what was the result. And we will try to move it from there.
Thanks for the fast response – just to clarify – I'm using admin-bro-sequelizejs
, not the mongoose one.
I've checked the REDUX_STATE
and the Cart
has e.g. the coupon_id
in the listProperties
object, but the Offer
does not. I've also checked how my database and its structure to confirm the migrations were run and this is the structure I got for the Offer
:
And that's the one I got for the Cart
:
Is there maybe any cache of the resources that I can clean? I guess the params are parsed with parseParams
method of the adapter – any idea how can I maybe track what is parsed and what's not? The only difference I see is that the coupon_id
for the Offer
property was added in new migration.
Ok, got this figure out – the admin-bro
was not the fault. The boilerplate I'm using was having async function that associated models, and the async/await is not needed at all there. I removed it and it started to work. Hard-to-track issue as the whole app worked perfectly 😞
Maybe it will help someone! Closing this – once again, thanks for your fast response!
I have few one to many relationships defined and AdminBro is pretty good at rendering the reference fields for those, but today I created another model called
Offer
and it belongs toCoupon
(whileCoupon
has manyOffer
). TheCOUPON ID
field is not rendered when I try to add theOffer
in the admin-bro dashboard.I have another relationship like this (
Cart
belongs toCoupon
andCoupon
has manyCart
) and theCOUPON ID
field is visible when I try to addCart
in the dashboard. I checked my database and the columns seem to be the same etc.My first question – why is this happening? My second question – how can I manually add the reference field? I have tried adding it manually but am stucked: