Skip to content

Auto create predefined tags for update mutation

What does this MR do and why?

This MR address a bug mentioned in !105859 (comment 1209658287)

Earlier, when we created a timeline event, we auto-created 2 pre-defined tags which were Start time and End time.

Now, we apply the same logic to updating a timeline event. If any of the 2 pre-defined tags are passed to edit an event, we auto-create them on the fly if they don't exist in a project.

Screenshots or screen recordings

NA

Mutation

Sample mutation

mutation UpdateTimelineEvent($input: TimelineEventUpdateInput!) {
  timelineEventUpdate(input: $input) {
    timelineEvent {
      id
      note
      timelineEventTags {
        nodes {
          name
        }
      }
    }
    errors
  }
}

Sample input

{
  "input": {
    "id": "<global id of the incident>",
    "note":"<strong>Updated note</strong>",
    "occurredAt": "2022-01-25T11:38:05Z",
    "timelineEventTagNames": ['start time', 'end time']
  }
}

How to set up and validate locally

  1. Make sure you have maintainer access to a project.
  2. Create a timeline event using the UI by following the steps mentioned in the docs.
  3. Get the global id of the above timeline event from the console using IncidentManagement::TimelineEvent.last.to_global_id.
  4. Follow the update mutation above with the above sample input to update the event with any of the tags mentioned in the input.
  5. As they do not exist, they will be auto-created and you will receive them in the output of the update mutation.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #373854 (closed)

Edited by Rajendra Kadam

Merge request reports