Skip to content

Update alert when trying to create an issue for a vulnerability which already has an issue linked to it

Overview

When creating an issue from a vulnerability which already has an issue linked to it an alert is rendered:

gdk.test_3000_security-reports_dependency-list-test_-_issues_22

As an UX improvement the alert should be changed to this:

Alert

Copy:

Unable to create link to vulnerability

Manually link this issue by adding it to the linked issue section of the originating vulnerability.

How to replicate this

  1. Go to the details page of any vulnerability
  2. Create issue via the button at the bottom
  3. Click the browser's "back" button to get back to the vulnerability's detail page
  4. Repeat step 2. to create another issue

Related disscussions

The following discussion from !47528 (merged) should be addressed:

Make the issue link creation failure to look more like this alert. Specifically, add the Copy URL to clipboard button.

Implementation Plan

The template that renders the alert can be found at ee/app/views/vulnerabilities/_unable_to_link_vulnerability.html.haml.

There is an existing haml helper to render a copy-to-clipboard button:

= clipboard_button(text: local_variable_holding_the_url_to_the_issue, button_text: _("Copy issue URL to clipboard"), hide_button_icon: true, hide_tooltip: true, class: "gl-button btn btn-default")
  • Add clipboard button to template
  • Add local partial-variable to provide the clipboard-button text that will be copied to the clipboard - eg.: #{request.original_url}/#{@issue.iid}
  • Add styling
  • Add specs
Edited by David Pisek