Configure front-end to supply create source

What does this MR do and why?

Part of the implementation of Draft: All plan instrumentation (!210502)

In Extend work item create mutation to accept opti... (!211309 - merged) we extended the work item create mutation to accept an optional create_source param to be used for instrumentation. The idea is that the FE would populate this string accordingly, and then when the mutation is triggered, we can track specifically where the creation was triggered, but keep instrumentation centralized in the backend. This MR accomplishes this by:

Adding a computable createSource prop to the createWorkItem component which allows us to track specific entry points such as whether it was created from a board, the global_nav, the child_items_widget, work_item_list, or vulnerability.

Note for now the new argument to the mutation is a no op, as a follow up to this MR, the instrumentation will be added in the backend to emit the correct event based on the provided arg.

References

Screenshots or screen recordings

Before After

How to set up and validate locally

There are 6 different flows to check locally. For 4 of them, we are only observing that the createSource prop has been injected properly. For 2 of them (boards), we are observing this, AND that the mutation has been migrated from Epic/Issue create to WorkItemCreate with the appropriate work item type

  1. In some project, create a vulnerability, you can use the identifier code CWE-89 and URL https://cwe.mitre.org/data/definitions/89.html. On your new vulnerability, hit create issue and fill out the form, in the Network tab, make sure that the createWorkItem mutation included createSource: "vulnerability"

  2. Create an epic in some group. On that epic, use the child items widget to add a new child issue. Make sure that the mutation includes createSource: "child_items_widget"

  3. Create any work item from the work items list page, make sure that createSource: "work_items_list" is included in the mutation

  4. From within a group http://localhost:3000/twitter, use the "global nav" (the + button at the top, to the right of the search bar and to the left of the assigned issues/MRs/todo widgets) and select New work item from In this group sub menu. Fill out the form and make sure that global_nav was included as the create source in the mutation

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #572016

Edited by Nasser Zahrani

Merge request reports

Loading