SoftwareBrothers / adminjs

AdminJS is an admin panel for apps written in node.js
https://adminjs.co
MIT License
8.15k stars 659 forks source link

[Bug]: Relations doesn't seem to work when you specify listPropertyies, editProperties, showProperties, etc... #1572

Closed JayNisbett closed 10 months ago

JayNisbett commented 10 months ago

Contact Details

No response

What happened?

I am unable to make the relations feature work unless I show all of the fields for the resource (using postgres adapter).

Bug prevalence

Every time, so far

AdminJS dependencies version

"@adminjs/express": "^6.0.1", "@adminjs/relations": "^1.0.0", "@adminjs/sql": "^2.2.1", "adminjs": "^7.3.0",

What browsers do you see the problem on?

No response

Relevant log output

No response

Relevant code that's giving you issues

No response

dziraf commented 10 months ago

Can you share your code? I've just tried to add listProperties and showProperties to the example from the docs and it worked fine for me.

Screenshot 2023-10-19 at 17 17 58

Make sure that if you modify showProperties of Organization (in this case), it should include relations property as it's what @adminjs/relations uses to show the tables:

    showProperties: ['name', 'relations'],

Since features are basically extensions to resource options, they're merged with your own resource options and your own options take precedence. When you set showProperties to just ['name'] it basically disables other fields.

JayNisbett commented 10 months ago

Ahh - it was the "relations" property... Thanks!