Skip to content

Time Tracking widget

Alexandru Croitor requested to merge add_time_tracking_widget into master

What does this MR do and why?

This MR add the Time Tracking Widget definition to the DB. Also adds the capability of setting adn removing time estimate and time spend through quick actions when editing a work item's 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.

re #438575 (closed)

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

  1. 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

  2. Update work item time tracking data using the time tracking related quick actions. There are 4 main quick actions for time tracking with several aliases each: /estimate - to set a time estimate. This is NOT additive and just sets a given value overwriting previous one. remove_estimate - the opposite of estimate, it would just remove any estimate being set, basically having an estimate of 0. /spend - adds a record of time spent. This is additive, calling it again would add another record, that would add up in the total_time_spent value. /remove_time_spent - This would remove all time spent records, resulting in a 0 total_time_spent.

    1. You can test the above quick actions through UI, by editing an WorkItem's description and using the quick actions
    2. Or you can use a GraphQL mutation. Eg.
      mutation {
        workItemUpdate(input: {
          id:"gid://gitlab/WorkItem/95",
          descriptionWidget: { description: "some description with quick actions on time tracking\n\n/estimate 12h\n/spend 1h" }
          
        }) {
          workItem {
            id
            iid
            title
            description
            widgets {
              ... on WorkItemWidgetTimeTracking {
                timeEstimate
                totalTimeSpent
                timelogs {
                  nodes {
                    timeSpent
                  }
                }
              }
            }
          }
        }
      }

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

Edited by Alexandru Croitor

Merge request reports