[FE] Support explicit linking of work items with Merge Requests
## Context We want to give the user the manual ability to link work items to Merge requests. ![image__25_.png](/uploads/0ada70848c42ad6ffa54fb6caa90bd6f/image__25_.png){width="900" height="553"} As per the [discussion in the thread](https://gitlab.com/groups/gitlab-org/plan-stage/-/work_items/456#note_3357015702) 1. We will only be showing the search bar (by reference/name/id) 2. No autoclose checkbox 3. Manual Relationship types will be `Closes` and `Related` --- ## Scope of work ### Widget enhancements (`related_work_items.vue`) - Add a `+` icon affordance to the **Related work items** sidebar widget to open a manual-link form. - Migrate the widget query to read from the new `workItemRelations` field (`id`, `linkType`, `workItem`, `fromMrDescription`). - Add per-row remove (`×`) for manually-added rows (`fromMrDescription: false`). Description-derived rows remain read-only. ### New form component (`related_work_items_add_form.vue`) - Cross-namespace WI search via `~/work_items/components/shared/work_item_token_input.vue`. - Link type picker exposing `CLOSES` and `RELATED` only — `MENTIONED` is system-managed and not user-selectable. ### Mutations Wire `createMergeRequestWorkItemRelation` / `destroyMergeRequestWorkItemRelations` with Apollo cache updates following the same pattern as the work item relationships form. Also support for existing `createWorkItemMutation` to support MR relationship while creation ### Feature flag gating Every change is gated behind `explicit_mr_work_item_relations` (`glFeatures.explicitMrWorkItemRelations`). - **Flag on** → new `workItemRelations` field, `+` affordance, per-row remove. - **Flag off** → widget falls back to the deprecated `linkedWorkItems` field, read-only, no add/remove affordance. --- ## Steps to verify 1. Enable the flag: `Feature.enable(:explicit_mr_work_item_relations)`. 2. Open an MR page — confirm the `+` icon appears in the **Related work items** widget when `userPermissions.adminMergeRequest` is true. 3. Add a WI via the form -\> row appears optimistically and persists after refresh. 4. Cross-namespace: link a WI in a different project the user has read access to. 5. Remove a manual row -\> disappears optimistically and stays gone after refresh. 6. Disable the flag -\> confirm the widget reverts to read-only `linkedWorkItems` behavior with no add/remove affordance.
issue