Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dsg) admin ui added m2m relation #2456

Merged
merged 1 commit into from
Mar 22, 2022

Conversation

abrl91
Copy link
Member

@abrl91 abrl91 commented Mar 19, 2022

fix #2225
we should delete #2354

On admin UI, added the ability to make a reference between two entities in a form of many to many (one to many from the entity perspective).
For example, an order can have many products and a product can be in many orders.

An order with its products
image

A product with its orders
image

To make it works I added the following block code on the edit entity and create entity files (post and tag for the example):

<ReferenceArrayInput
          source="tags"
          reference="Tag"
          parse={(value: any) => value && value.map((v: any) => ({ id: v }))}
          format={(value: any) => value && value.map((v: any) => v.id)}
        >
          <SelectArrayInput optionText={TagTitle} />
 </ReferenceArrayInput>

PR Checklist

  • Tests for the changes have been added
  • npm test doesn't throw any error

@yuval-hazaz
Copy link
Member

@abrl91 great work!

@abrl91 abrl91 added the 0.12.2 label Mar 20, 2022
@abrl91 abrl91 added this to the 0.12.2 milestone Mar 20, 2022
@abrl91
Copy link
Member Author

abrl91 commented Mar 20, 2022

deploy to staging completed successfully 🔥

@mshidlov mshidlov merged commit 8a35e81 into release/0.12.2 Mar 22, 2022
@mshidlov mshidlov deleted the fix/2225-many-to-many-admin-ui branch March 22, 2022 17:03
@mshidlov mshidlov linked an issue Mar 24, 2022 that may be closed by this pull request
@mshidlov mshidlov removed this from the 0.12.2 milestone Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: many-to-many relation is not support in the admin UI
3 participants