Skip to content

Create API for Timeline Event

Rajendra Kadam requested to merge add-timeline-event into master

What does this MR do and why?

Contributes to #344059 (closed)

Adds a GraphQL mutation to create timeline events.

Screenshots or screen recordings

Mutation Result
Screenshot_2022-02-02_at_4.54.50_PM Screenshot_2022-01-27_at_3.56.35_PM

Mutation

Mutation GraphQL query
mutation CreateTimelineEvent($input: TimelineEventCreateInput!) {
  timelineEventCreate(input: $input) {
    timelineEvent {
      id
      author { id username }
      updatedByUser { id username }
      incident { id title }
      note
      noteHtml
      editable
      promotedFromNote { id body }
      action
      occurredAt
      createdAt
      updatedAt
    }
    errors
  }
}

Query variables

{
  "input": {
    "incident_id": "gid://gitlab/Issue/509",
    "note": "Note",
    "occurredAt": "2022-01-19T12:22:42Z"
  }
}

How to set up and validate locally

  1. Make sure you have the license installed.

  2. Create an incident manually by navigating to Monitor > Incidents from the left sidebar menu of your GitLab project.

  3. Find the global id of the Issue and pass in the input params of the GraphQL query.

  4. Run the above GraphQL query inside http://localhost:3000/-/graphql-explorer

  5. Check IncidentManagement::TimelineEvent.find(<ID>) in the rails console

MR acceptance checklist

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

Edited by Rajendra Kadam

Merge request reports

Loading