Add time tracking on create work item
What does this MR do and why?
This MR adds the capability of setting time estimate and time spend through quick actions when creating a work item through its description. It also adds the descriptionWidget as an argument to work item create mutation as up until this MR the description was added through a simple argument rather than the descriptionWidget, which allows for some edge cases, like not checking if the WIT actually supports the description.
This MR addresses the MVC1 of the time tracking widget, described in #438575 (closed). There will be a couple follow-up MRs that will be updating the update work item GraphQl mutation to handle the Time Tracking Widget, handling time reports as well as time data roll-ups.
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.
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
Prerequisites
In order to work with work items and work items widgets we need following FFs to be enabled: work_items
, work_items_mvc
, work_items_mvc_2
. Note also that some Work Item Types are only available under Ultimate tier, e.g. Objective
and Key Result
, so make sure to run GitLab as EE and with Ultimate license if you want to use the above mentioned Work Item Types.
For work items that support time tracking
-
Create a work item that supports time tracking, e.g Issue, Task, incident, etc you can see the list of model that support time tracking in the migration file. To do that use the following Grapqhl mutation:
mutation { workItemCreate(input: { namespacePath: "toolbox", title: "Some title", workItemTypeId: "gid://gitlab/WorkItems::Type/1", description: "some description with quick actions on time tracking\n\n/estimate 12h\n/spend 2h" }) { workItem { id iid title } } }
- Note that this should work for project level and group level work items that support time tracking
-
For work items that do not support time tracking this should not set time tracking data. You can query the data in the DB for those.
For work items that do not support time tracking
Follow the same instructions as for work items that support time tracking but create one of the two work items that do not support time tracking: Objective
or Key Result