Skip to content

Add GraphQL API to add issuable resource links

Rajendra Kadam requested to merge 363338-links-widget-gql-api into master

What does this MR do and why?

This MR adds a GraphQL API to add resource links to an incident. Currently, there is no frontend development for this, this MR adds the base classes for mutation and service. This change is behind a feature flag.

This MR is big because it also adds some base classes and services to lay the foundation for delete GraphQL API.

Screenshots or screen recordings

Mutation Result
Screenshot_2022-06-10_at_1.36.50_PM Screenshot_2022-06-10_at_1.38.49_PM

Mutation

mutation CreateIssuableResourceLink($input: IssuableResourceLinkCreateInput!) {
  issuableResourceLinkCreate(input: $input) {
    issuableResourceLink {
      id
      issue { id title }
      link
      linkText
      linkType
    }
    errors
  }
}

Query variables

{
  "input": {
    "id": "<global id of the incident>",
    "link": "http://docs.gitlab.com/incident-info",
    "linkText": "Doclink for incident",
    "linkType": "general"
  }
}

How to set up and validate locally

  1. Enable the feature flag incident_resource_links_widget using Feature.enable(:incident_resource_links_widget)
  2. Make sure you have the premium+ license installed.
  3. Make sure you have at least reporter permissions.
  4. Create an incident manually by navigating to Monitor > Incidents from the left sidebar menu of your GitLab project.
  5. Find the global id of the incident and pass in the input parameters of the GraphQL query.
  6. Run the above GraphQL query inside http://localhost:3000/-/graphql-explorer.
  7. Check IncidentManagement::IssuableResourceLink.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.

Related to #363338 (closed)

Edited by Rajendra Kadam

Merge request reports