Use 'vulnerabilityExternalIssueLinkCreate' mutation for creating a Jira issue on vulnerability details page

Why are we doing this?

Currently we are using a link, provided by the backend, to create new Jira issues:

Create Jira Issue
Screen_Shot_2021-03-03_at_4.38.49_pm

In order to move the vulnerability detail page to GraphQL we need to use the vulnerabilityExternalIssueLinkCreate mutation to create the Jira issue.

Create external issue - mutation example
mutation vulnerabilityExternalIssueLinkCreate($input:VulnerabilityExternalIssueLinkCreateInput!) {
  vulnerabilityExternalIssueLinkCreate(input:$input) {
    errors,
    externalIssueLink {
      externalIssue {
        webUrl
      }
    }
  }
}
{
  "input": {
    "externalTracker": "JIRA",
    "linkType": "CREATED",
    "id": "gid://gitlab/Vulnerability/158"
  }
}

Designs

Here are the states when a jira issue is created from a vulnerability from a modal. Designs C1 - C4

Issue not created Issue creation triggered Issue creation success
c1-details-modal-jira-enabled c2-details-modal-jira-enabled_issue-creation-state c3-details-modal-jira-enabled_issue-created
Issue creation error Flow diagram
---------------------- --------------
c4-details-modal-jira-enabled_error-state z01-issue-creation-flow

Relevant links

Epic &4969 (closed)
Design issue #8942 (closed)

Non-functional requirements

  • Documentation: screenshots need to be updated and text modified if necessary
  • Testing: tests need to be updated

Implementation Plan

  • Change ee/app/assets/javascripts/security_dashboard/components/vulnerability_action_buttons.vue to use the mutation from the example above
  • Display a loading state on the button
  • Reload related Jira issues once finished
  • In case of error show a error-banner
Edited by David Pisek