The field can now be used to add & remove links:
- Add "Unlink" in the table for existing links
- Allow to link:
- without type ("is linked to")
- or "is child of" (to allow parent selection)
- Warning: there can be only one selected parent so the "is child of" option can't be selected twice
- "Add link" adds links one by one. Added links:
- are appended at the bottom of the list with a green background
- can be removed directly using the "Remove" button
- Selector allow to pick-up
- Link to an id : the picker returns as a result the artifact corresponding to the id (GET request triggered after delay). If no artifact is returned, the picker shows a "No result found message"
- Possible parents, either by filtering on their name or their id. The possible parents list is loaded when "is child of" is selected and the picker is open
Given there was already an existing link (not marked for removal) to artifact A or a newly added link to artifact A, when artifact A is listed in the artifact picker, it will be disabled and cannot be added again. This prevents situations where user links twice artifact A : the last link "wins" and erases the type of the previous link, which is probably unexpected by the user. This also prevents link "cycles" where artifact A ⇄ artifact B, for example artifact A is child of artifact B who is child of artifact A. If such situations are desirable, we need to gather use-cases before allowing them. See mockups below
At this stage, the field replace the existing "artifact link field" in the modal by default for everyone
Mockups
Artifact picker mockup for this story is available in this figma: https://www.figma.com/file/f8zfcbUP4bpqqs7MB2IsqQ/New-Artifact-Links?node-id=0%3A1
Links list mockup for this story is available in this codepen : https://cdpn.io/pen/debug/eYReNXM/29d1a2e6760a69e567af62c783f2f8de
Figma mockup for the disabled option (to prevent linking twice): https://www.figma.com/file/f8zfcbUP4bpqqs7MB2IsqQ/New-Artifact-Links?node-id=34%3A599
Codepen live mockup for the "already linked" dropdown options (to show ellipsis of title): https://codepen.io/enalean/pen/bGLwwXx/45aea0c272a0fc15eb3ab045a65f5785