From: Mathieu Suen Date: Thu, 24 Jun 2021 15:02:57 +0000 (+0200) Subject: SONAR-13509 Adding title and link to rule in hotspot page. X-Git-Tag: 9.0.0.45539~47 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ae03ed92a09a3d27fe631e42b2d31d87138ce711;p=sonarqube.git SONAR-13509 Adding title and link to rule in hotspot page. --- diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx index bf51befb62f..20d6f086e62 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx @@ -19,6 +19,7 @@ */ import * as classNames from 'classnames'; import * as React from 'react'; +import { Link } from 'react-router'; import { Button } from 'sonar-ui-common/components/controls/buttons'; import { ClipboardButton } from 'sonar-ui-common/components/controls/clipboard'; import LinkIcon from 'sonar-ui-common/components/icons/LinkIcon'; @@ -27,7 +28,7 @@ import { translate } from 'sonar-ui-common/helpers/l10n'; import { getPathUrlAsString } from 'sonar-ui-common/helpers/urls'; import { withCurrentUser } from '../../../components/hoc/withCurrentUser'; import { getBranchLikeQuery } from '../../../helpers/branch-like'; -import { getComponentSecurityHotspotsUrl } from '../../../helpers/urls'; +import { getComponentSecurityHotspotsUrl, getRuleUrl } from '../../../helpers/urls'; import { isLoggedIn } from '../../../helpers/users'; import { BranchLike } from '../../../types/branch-like'; import { Hotspot } from '../../../types/security-hotspots'; @@ -78,7 +79,17 @@ export function HotspotViewerRenderer(props: HotspotViewerRendererProps) { {hotspot && (
- {hotspot.message} +
+ + {hotspot.message} + +
+ {hotspot.rule.name} + + {hotspot.rule.key} + +
+
{isLoggedIn(currentUser) && ( <> diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotViewerRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotViewerRenderer-test.tsx.snap index 29b5ea12a1f..b7455bf8090 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotViewerRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotViewerRenderer-test.tsx.snap @@ -11,11 +11,39 @@ exports[`should render correctly 1`] = `
- - '3' is a magic number. - + + '3' is a magic number. + +
+ + That rule + + + squid:S2077 + +
+
@@ -657,11 +685,39 @@ exports[`should render correctly: anonymous user 1`] = `
- - '3' is a magic number. - + + '3' is a magic number. + +
+ + That rule + + + squid:S2077 + +
+
@@ -1303,11 +1359,39 @@ exports[`should render correctly: assignee without name 1`] = `
- - '3' is a magic number. - + + '3' is a magic number. + +
+ + That rule + + + squid:S2077 + +
+
@@ -1949,11 +2033,39 @@ exports[`should render correctly: deleted assignee 1`] = `
- - '3' is a magic number. - + + '3' is a magic number. + +
+ + That rule + + + squid:S2077 + +
+
@@ -2602,11 +2714,39 @@ exports[`should render correctly: unassigned 1`] = `
- - '3' is a magic number. - + + '3' is a magic number. + +
+ + That rule + + + squid:S2077 + +
+