JIRA Integration - On a project's vulnerability report, show count of related Jira issues within a rows activity column
requested to merge 300143-jira-integration-fe-on-a-project-s-vulnerability-report-show-count-of-related-jira-issues into master
What does this MR do?
It adds counts and links for related Jira issues to the items of the Vulnerabilities Report when the Jira integration is enabled for a project.
Screenshots (strongly suggested)
How to test this
- Walk through on how to enable the Jira integration for a project: https://www.youtube.com/watch?v=MLl4lndKiYs
- I was not able to get the GraphQL endpoint returning any data locally (it does work on Production) so I used the following patch to get around it:
diff --git a/ee/app/assets/javascripts/security_dashboard/graphql/provider.js b/ee/app/assets/javascripts/security_dashboard/graphql/provider.js
index 125b92677d5..24322aac0c6 100644
--- a/ee/app/assets/javascripts/security_dashboard/graphql/provider.js
+++ b/ee/app/assets/javascripts/security_dashboard/graphql/provider.js
@@ -1,6 +1,7 @@
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import { IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
+import { uniqueId } from 'lodash';
import createDefaultClient from '~/lib/graphql';
import introspectionQueryResultData from './fragmentTypes.json';
@@ -12,15 +13,50 @@ const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData,
});
-const defaultClient = createDefaultClient(
- {},
- {
- cacheConfig: {
- fragmentMatcher,
+const resolvers = {
+ Vulnerability: {
+ externalIssueLinks: () => {
+ return {
+ __typename: 'VulnerabilityExternalIssueLinkConnection',
+ nodes: [
+ {
+ __typename: 'VulnerabilityExternalIssueLink',
+ id: uniqueId(),
+ externalIssue: {
+ __typename: 'ExternalIssue',
+ externalTracker: 'jira',
+ webUrl: 'https://mparuszewski-gitlab.atlassian.net/browse/GV-11',
+ title: 'jira',
+ createdAt: `${Date.now()}`,
+ relativeReference: uniqueId('JIRA-'),
+ },
+ linkType: 'CREATED',
+ },
+ {
+ __typename: 'VulnerabilityExternalIssueLink',
+ id: uniqueId(),
+ externalIssue: {
+ __typename: 'ExternalIssue',
+ externalTracker: 'jira',
+ webUrl: 'https://mparuszewski-gitlab.atlassian.net/browse/GV-11',
+ title: 'jira',
+ createdAt: `${Date.now()}`,
+ relativeReference: uniqueId('JIRA-'),
+ },
+ linkType: 'CREATED',
+ },
+ ],
+ };
},
- assumeImmutableResults: true,
},
-);
+};
+
+const defaultClient = createDefaultClient(resolvers, {
+ cacheConfig: {
+ fragmentMatcher,
+ },
+ assumeImmutableResults: true,
+});
export default new VueApollo({
defaultClient,
diff --git a/ee/app/assets/javascripts/security_dashboard/graphql/queries/project_vulnerabilities.query.graphql b/ee/app/assets/javascripts/security_dashboard/graphql/queries/project_vulnerabilities.query.graphql
index 9ff50581356..d269c9e9d96 100644
--- a/ee/app/assets/javascripts/security_dashboard/graphql/queries/project_vulnerabilities.query.graphql
+++ b/ee/app/assets/javascripts/security_dashboard/graphql/queries/project_vulnerabilities.query.graphql
@@ -12,7 +12,6 @@ query project(
$sort: VulnerabilitySort
$hasIssues: Boolean
$hasResolution: Boolean
- $includeExternalIssueLinks: Boolean = false
) {
project(fullPath: $fullPath) {
vulnerabilities(
@@ -28,7 +27,7 @@ query project(
) {
nodes {
...Vulnerability
- externalIssueLinks @include(if: $includeExternalIssueLinks) {
+ externalIssueLinks @client {
nodes {
issue: externalIssue {
externalTracker
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry featureflagdisabled
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
-
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers - [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Related to #300143 (closed)
Edited by David Pisek