Repository navigation
Issue #1472: feat: edit an association's Name and Array in the MDR UI - #1509
Conversation
…gh the MDR API The entity and attribute association DTOs carry Name and Array. Create stores a sent value, or the rule's when it's not sent or null. Update keeps a sent value through Relationship/Placement/child edits in the same request, and a sent null resets it to the rule's. A blank Name is refused, and so is setting either one across data models or on an association with ExtendedByDataModelId. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Edit Association shows the association's Name and a "List under this parent" switch. Clearing Name sends null, which resets it to the default key. The dialog title shows the association's Name instead of the tree label. In a model's own create dialog, picking the child starts the switch at the child's Array (single for a Reference); an overlay's create dialog leaves Array to the API, since its cross-model and ExtendedBy associations can't set it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@cbeach47, a heads-up on how this fits with your #1507. This PR lets a user set an association's The two PRs share no files. This one changes This PR is stacked on #1508 (the API half), so it's based on that branch until #1508 merges. |
bjagg
left a comment
There was a problem hiding this comment.
Thanks, Dereck. I checked it at 8d331d2. It's stacked on #1508, so CI hasn't run on it; I ran its checks locally.
- Frontend checks:
npx vitest runpasses (62);tsc -bis clean;- eslint gives no errors on the changed files;
npm run buildsucceeds.
- Red against #1508: all 8 new tests in
associationKeyFields.test.tsfail with #1508'sCreateOptFields.tsx. - The edit dialog sends only changed fields (
Dialog.tsx,newValue !== originalValue). So an unchangedName/Arrayisn't sent, and it keeps following the rule after aRelationshiporPlacementedit. The association it edits comes from the association list, which carriesNameandArraysince #1508. - Edge case, not blocking: the dialog starts a boolean field at
!!value. So a row whoseArrayis still NULL shows "off", and any edit to that row sendsArray: false. That's rows from older images, until V1.9 fills them. Dev has none: 0 of 2,260 entity associations and 0 of 24,749 attribute associations have a NULLNameorArray.
Approving. Once #1508 merges, retarget this to main so CI runs before it merges.
…anch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Description of Change
Problem. PR #1508 (the API half of #1472) lets the MDR API read and set an association's
NameandArray, but the MDR UI can't edit them yet.Solution. This is the UI half of #1472. It's stacked on #1508, so the diff shrinks to this PR's commit once that merges.
null, which the API resets to the default key.ExtendedByDataModelIdrefusals show the same way.Name, the key the child appears under. Before this PR,handleEditAssocoverwroteitemToEdit.Namewith the tree label "for display". WithNamenow a field, that override would make every save send aName.Array, or off for a Reference (MDR portability: decide whether a Reference association can be a list #1471), so the user sees the list setting and can change it. This follows the decision on MDR portability: generate an element's cardinality from its association's Array #1429/MDR portability: edit an association's Name and Array through the API and UI #1472: after Issue #1429: feat: generate an element's cardinality from its association's Array (backend) #1498, an imported list element is stored as single, so the old default (the rule) is wrong for imported models.SelectDialoggets an optionalonSelectedhook for this. Value sets don't pass it, so they're unchanged.withCreateArray). Otherwise an unticked switch would be dropped.ExtendedByDataModelId, which the API refuses to give anArray, so sending one would break every plain create there.Limitations.
Nameis edit-only, as decided.Arrayedit can still overwrite a value set here (MDR portability: show and edit an element's Array only on a root entity #1478), and a clone recomputesName(MDR portability: a clone keeps each association's Name instead of recomputing it #1500).ActivationDate, because of the dialog's minute-precision round trip. That's unchanged here.Overlap with #1507 (cbeach47, the frontend half of #1429): #1507 makes the UI's own schema and sample records read the association's
Array, and this PR is where a user sets it. The two share no files (#1507 changesmodelService.tsandtypes.ts), so either can merge first. Once both are in, a switch flipped here should show up in #1507's schema and samples after the dialog's refetch.Related Issues
Closes #1472 (with #1508)
Refs #1429, #1471, #1478, #1500, #913
Type of Change
Project Area(s) Affected
Checklist
ty-checkandpytestwere skipped, since this diff is frontend-only and the Python tree is Issue #1472: feat: read and set an association's Name and Array through the MDR API #1508's, which ran the full suite)Testing
associationKeyFields.test.ts).npm run build(tsc -b + vite) passes; eslint reports 0 errors.person → employment: Namejobs, list on →PUT {"Name":"jobs","Array":true}(200; reopening showsjobs, on);PUT {"Name":null}, final row(employment, t);" "→ 400, and the dialog stays open with "Name can't be blank: …";preferences.preferred_org_types, list off →PUT {"Array":false}, final rowf;preferred_org_types(a list) onperson: the switch starts on →POST … "Array":true, final rowt;id(single) onemployment: starts off, ticked →POST … "Array":true, final rowt;preferences(single) underperson, untouched →POST … "Array":false, final rowf;🤖 Generated with Claude Code