Add CRM contacts widget to work items
What does this MR do and why?
Add the CRM Contacts work item widget (backend)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
DB Migration
explain INSERT INTO "work_item_widget_definitions" (
"work_item_type_id", "name", "widget_type"
)
VALUES
(1, 'CrmContacts', 24),
(2, 'CrmContacts', 24),
(5, 'CrmContacts', 24)
ON CONFLICT ("work_item_type_id", "name")
WHERE
(namespace_id IS NULL) DO
UPDATE
SET
"widget_type" = excluded."widget_type" RETURNING "id"
Execution plan:
ModifyTable on public.work_item_widget_definitions (cost=0.00..0.05 rows=3 width=91) (actual time=1.153..1.240 rows=3 loops=1)
Buffers: shared hit=67 read=1 dirtied=1
I/O Timings: read=0.733 write=0.000
-> Values Scan on "*VALUES*" (cost=0.00..0.05 rows=3 width=91) (actual time=0.112..0.123 rows=3 loops=1)
Buffers: shared hit=16
I/O Timings: read=0.000 write=0.000
Timings:
Time: 3.594 ms
- planning: 0.350 ms
- execution: 3.244 ms
- I/O read: 0.733 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 67 (~536.00 KiB) from the buffer pool
- reads: 1 (~8.00 KiB) from the OS file cache, including disk I/O
- dirtied: 1 (~8.00 KiB)
- writes: 0
Screenshots or screen recordings
How to set up and validate locally
Read the CRM docs if you need to understand where to create/find crm contacts etc https://docs.gitlab.com/ee/user/crm/
- Use GraphQL Explorer to add/remove/replace crm contacts on a work item:
mutation m { workItemUpdate(input: { id: "gid://gitlab/WorkItem/499", crmContactsWidget: { contactIds: ["gid://gitlab/CustomerRelations::Contact/228"] operationMode: APPEND } }) { errors } } query q { workItem(id: "gid://gitlab/WorkItem/499") { title widgets { type ... on WorkItemWidgetCrmContacts { contacts { nodes { id firstName lastName email } } } } } }
Related to #464589 (closed)
Edited by Lee Tickett