diff options
author | Jeremy Davis <jeremy.davis@sonarsource.com> | 2021-07-01 11:48:58 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-07-01 20:03:19 +0000 |
commit | 1cd0fe3fd30a7a2bdb801e8636330313da79fa46 (patch) | |
tree | b5d9e65eba22d2ef837eb8e42d047704420478b4 /server/sonar-web/src | |
parent | 043de8ee2d46759e737784ac66944379504836b3 (diff) | |
download | sonarqube-1cd0fe3fd30a7a2bdb801e8636330313da79fa46.tar.gz sonarqube-1cd0fe3fd30a7a2bdb801e8636330313da79fa46.zip |
SONAR-15115 SONAR-15121 Fix missing hotspot code in App branches and remove permalink
Diffstat (limited to 'server/sonar-web/src')
16 files changed, 346 insertions, 1139 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx index 4e0cbe6cb89..fb4a5147c62 100644 --- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx @@ -37,6 +37,7 @@ import { inSnippet, LINES_BELOW_ISSUE } from './utils'; interface Props { branchLike: BranchLike | undefined; component: T.SourceViewerFile; + displayLineNumberOptions?: boolean; displaySCM?: boolean; duplications?: T.Duplication[]; duplicationsByLine?: { [line: number]: number[] }; @@ -130,7 +131,7 @@ export default class SnippetViewer extends React.PureComponent<Props> { }) { const secondaryIssueLocations = getSecondaryIssueLocationsForLine(line, this.props.locations); - const { duplications, duplicationsByLine } = this.props; + const { displayLineNumberOptions, duplications, duplicationsByLine } = this.props; const duplicationsCount = duplications ? duplications.length : 0; const lineDuplications = (duplicationsCount && duplicationsByLine && duplicationsByLine[line.line]) || []; @@ -146,6 +147,7 @@ export default class SnippetViewer extends React.PureComponent<Props> { displayCoverage={true} displayDuplications={displayDuplications} displayIssues={!isSinkLine || issuesForLine.length > 1} + displayLineNumberOptions={displayLineNumberOptions} displayLocationMarkers={true} displaySCM={displaySCM} duplications={lineDuplications} diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainerRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainerRenderer.tsx index ab47a648f7d..6934ac0d5a2 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainerRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainerRenderer.tsx @@ -75,8 +75,9 @@ export default function HotspotSnippetContainerRenderer( <SourceViewerContext.Provider /* Used by LineOptionsPopup */ value={{ branchLike, file: sourceViewerFile }}> <SnippetViewer - branchLike={branchLike} + branchLike={undefined} component={sourceViewerFile} + displayLineNumberOptions={false} displaySCM={false} expandBlock={(_i, direction) => props.onExpandBlock(direction)} handleCloseIssues={noop} 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 20d6f086e62..0ab8dd44b48 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 @@ -27,7 +27,7 @@ import DeferredSpinner from 'sonar-ui-common/components/ui/DeferredSpinner'; 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 { fillBranchLike, getBranchLikeQuery } from '../../../helpers/branch-like'; import { getComponentSecurityHotspotsUrl, getRuleUrl } from '../../../helpers/urls'; import { isLoggedIn } from '../../../helpers/users'; import { BranchLike } from '../../../types/branch-like'; @@ -144,7 +144,7 @@ export function HotspotViewerRenderer(props: HotspotViewerRendererProps) { </div> <HotspotSnippetContainer - branchLike={branchLike} + branchLike={fillBranchLike(hotspot.project.branch, hotspot.project.pullRequest)} component={component} hotspot={hotspot} /> diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx index 8b1e007b084..4e7698db772 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx @@ -23,8 +23,9 @@ import * as React from 'react'; import { waitAndUpdate } from 'sonar-ui-common/helpers/testUtils'; import { getSources } from '../../../../api/components'; import { mockBranch } from '../../../../helpers/mocks/branch-like'; -import { mockHotspot } from '../../../../helpers/mocks/security-hotspots'; +import { mockHotspot, mockHotspotComponent } from '../../../../helpers/mocks/security-hotspots'; import { mockComponent, mockSourceLine } from '../../../../helpers/testMocks'; +import { ComponentQualifier } from '../../../../types/component'; import HotspotSnippetContainer from '../HotspotSnippetContainer'; import HotspotSnippetContainerRenderer from '../HotspotSnippetContainerRenderer'; @@ -46,6 +47,7 @@ it('should load sources on mount', async () => { ); const hotspot = mockHotspot({ + project: mockHotspotComponent({ branch: branch.name, qualifier: ComponentQualifier.Project }), textRange: { startLine: 10, endLine: 11, startOffset: 0, endOffset: 12 } }); @@ -116,6 +118,7 @@ describe('Expansion', () => { }); const hotspot = mockHotspot({ + project: mockHotspotComponent({ branch: branch.name, qualifier: ComponentQualifier.Project }), textRange: { startLine: 10, endLine: 11, startOffset: 0, endOffset: 12 } }); diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotReviewHistoryAndComments-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotReviewHistoryAndComments-test.tsx.snap index 8758b8bff1c..e576a075c66 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotReviewHistoryAndComments-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotReviewHistoryAndComments-test.tsx.snap @@ -29,48 +29,22 @@ exports[`should render correctly 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -192,48 +166,22 @@ exports[`should render correctly without user 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotSnippetContainer-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotSnippetContainer-test.tsx.snap index c049d85dad7..2dcb778d83e 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotSnippetContainer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotSnippetContainer-test.tsx.snap @@ -32,48 +32,22 @@ exports[`should render correctly 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -126,13 +100,13 @@ exports[`should render correctly 1`] = ` sourceLines={Array []} sourceViewerFile={ Object { - "key": "my-project", + "key": "hotspot-component", "measures": Object { "lines": undefined, }, - "path": "", - "project": "my-project", - "projectName": "MyProject", + "path": "path/to/component", + "project": "hotspot-component", + "projectName": "Hotspot Component", "q": "FIL", "uuid": "", } diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotSnippetContainerRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotSnippetContainerRenderer-test.tsx.snap index 6ddb9d1ee5f..2807a804133 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotSnippetContainerRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotSnippetContainerRenderer-test.tsx.snap @@ -116,14 +116,6 @@ exports[`should render correctly: with sourcelines 1`] = ` } > <SnippetViewer - branchLike={ - Object { - "analysisDate": "2018-01-01", - "excludedFromPurge": true, - "isMain": true, - "name": "master", - } - } component={ Object { "key": "foo", @@ -140,6 +132,7 @@ exports[`should render correctly: with sourcelines 1`] = ` "uuid": "foo-bar", } } + displayLineNumberOptions={false} displaySCM={false} expandBlock={[Function]} handleCloseIssues={[Function]} @@ -167,48 +160,22 @@ exports[`should render correctly: with sourcelines 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { 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 b7455bf8090..66edb7be3b4 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 @@ -62,7 +62,7 @@ exports[`should render correctly 1`] = ` > <HotspotOpenInIdeButton hotspotKey="01fc972e-2a3c-433e-bcae-0bd7f88f5123" - projectKey="my-project" + projectKey="hotspot-component" /> </div> <ClipboardButton @@ -142,48 +142,22 @@ exports[`should render correctly 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -248,48 +222,22 @@ exports[`should render correctly 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -330,14 +278,6 @@ exports[`should render correctly 1`] = ` </div> </div> <HotspotSnippetContainer - branchLike={ - Object { - "analysisDate": "2018-01-01", - "excludedFromPurge": true, - "isMain": false, - "name": "branch-6.7", - } - } component={ Object { "breadcrumbs": Array [], @@ -380,48 +320,22 @@ exports[`should render correctly 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -479,48 +393,22 @@ exports[`should render correctly 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -589,48 +477,22 @@ exports[`should render correctly 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -736,7 +598,7 @@ exports[`should render correctly: anonymous user 1`] = ` > <HotspotOpenInIdeButton hotspotKey="01fc972e-2a3c-433e-bcae-0bd7f88f5123" - projectKey="my-project" + projectKey="hotspot-component" /> </div> <ClipboardButton @@ -816,48 +678,22 @@ exports[`should render correctly: anonymous user 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -922,48 +758,22 @@ exports[`should render correctly: anonymous user 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -1004,14 +814,6 @@ exports[`should render correctly: anonymous user 1`] = ` </div> </div> <HotspotSnippetContainer - branchLike={ - Object { - "analysisDate": "2018-01-01", - "excludedFromPurge": true, - "isMain": false, - "name": "branch-6.7", - } - } component={ Object { "breadcrumbs": Array [], @@ -1054,48 +856,22 @@ exports[`should render correctly: anonymous user 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -1153,48 +929,22 @@ exports[`should render correctly: anonymous user 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -1263,48 +1013,22 @@ exports[`should render correctly: anonymous user 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -1410,7 +1134,7 @@ exports[`should render correctly: assignee without name 1`] = ` > <HotspotOpenInIdeButton hotspotKey="01fc972e-2a3c-433e-bcae-0bd7f88f5123" - projectKey="my-project" + projectKey="hotspot-component" /> </div> <ClipboardButton @@ -1490,48 +1214,22 @@ exports[`should render correctly: assignee without name 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -1596,48 +1294,22 @@ exports[`should render correctly: assignee without name 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -1678,14 +1350,6 @@ exports[`should render correctly: assignee without name 1`] = ` </div> </div> <HotspotSnippetContainer - branchLike={ - Object { - "analysisDate": "2018-01-01", - "excludedFromPurge": true, - "isMain": false, - "name": "branch-6.7", - } - } component={ Object { "breadcrumbs": Array [], @@ -1728,48 +1392,22 @@ exports[`should render correctly: assignee without name 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -1827,48 +1465,22 @@ exports[`should render correctly: assignee without name 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -1937,48 +1549,22 @@ exports[`should render correctly: assignee without name 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -2084,7 +1670,7 @@ exports[`should render correctly: deleted assignee 1`] = ` > <HotspotOpenInIdeButton hotspotKey="01fc972e-2a3c-433e-bcae-0bd7f88f5123" - projectKey="my-project" + projectKey="hotspot-component" /> </div> <ClipboardButton @@ -2164,48 +1750,22 @@ exports[`should render correctly: deleted assignee 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -2270,48 +1830,22 @@ exports[`should render correctly: deleted assignee 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -2352,14 +1886,6 @@ exports[`should render correctly: deleted assignee 1`] = ` </div> </div> <HotspotSnippetContainer - branchLike={ - Object { - "analysisDate": "2018-01-01", - "excludedFromPurge": true, - "isMain": false, - "name": "branch-6.7", - } - } component={ Object { "breadcrumbs": Array [], @@ -2402,48 +1928,22 @@ exports[`should render correctly: deleted assignee 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -2501,48 +2001,22 @@ exports[`should render correctly: deleted assignee 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -2611,48 +2085,22 @@ exports[`should render correctly: deleted assignee 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -2765,7 +2213,7 @@ exports[`should render correctly: unassigned 1`] = ` > <HotspotOpenInIdeButton hotspotKey="01fc972e-2a3c-433e-bcae-0bd7f88f5123" - projectKey="my-project" + projectKey="hotspot-component" /> </div> <ClipboardButton @@ -2845,48 +2293,22 @@ exports[`should render correctly: unassigned 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -2951,48 +2373,22 @@ exports[`should render correctly: unassigned 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -3033,14 +2429,6 @@ exports[`should render correctly: unassigned 1`] = ` </div> </div> <HotspotSnippetContainer - branchLike={ - Object { - "analysisDate": "2018-01-01", - "excludedFromPurge": true, - "isMain": false, - "name": "branch-6.7", - } - } component={ Object { "breadcrumbs": Array [], @@ -3083,48 +2471,22 @@ exports[`should render correctly: unassigned 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -3182,48 +2544,22 @@ exports[`should render correctly: unassigned 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -3292,48 +2628,22 @@ exports[`should render correctly: unassigned 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/Status-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/Status-test.tsx.snap index 4eaecc3eca7..8437b72cf6e 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/Status-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/Status-test.tsx.snap @@ -35,48 +35,22 @@ exports[`should render correctly: closed 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { @@ -177,48 +151,22 @@ exports[`should render correctly: open 1`] = ` "changelog": Array [], "comment": Array [], "component": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "FIL", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "creationDate": "2013-05-13T17:55:41+0200", "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", "line": 142, "message": "'3' is a magic number.", "project": Object { - "breadcrumbs": Array [], - "key": "my-project", - "name": "MyProject", + "key": "hotspot-component", + "longName": "Hotspot component long name", + "name": "Hotspot Component", + "path": "path/to/component", "qualifier": "TRK", - "qualityGate": Object { - "isDefault": true, - "key": "30", - "name": "Sonar way", - }, - "qualityProfiles": Array [ - Object { - "deleted": false, - "key": "my-qp", - "language": "ts", - "name": "Sonar way", - }, - ], - "tags": Array [], }, "resolution": "FIXED", "rule": Object { diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx index d0b7f207c03..8d7deed7708 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx @@ -37,6 +37,7 @@ interface Props { displayIssueLocationsCount?: boolean; displayIssueLocationsLink?: boolean; displayIssues: boolean; + displayLineNumberOptions?: boolean; displayLocationMarkers?: boolean; displaySCM?: boolean; duplications: number[]; @@ -94,6 +95,7 @@ export default class Line extends React.PureComponent<Props> { displayDuplications, displayIssueLocationsCount, displayIssueLocationsLink, + displayLineNumberOptions, displayLocationMarkers, highlightedLocationMessage, displayIssues, @@ -127,9 +129,12 @@ export default class Line extends React.PureComponent<Props> { const bottomPadding = verticalBuffer ? verticalBuffer * LINE_HEIGHT : undefined; + // default is true + const displayOptions = displayLineNumberOptions !== false; + return ( <tr className={className} data-line-number={line.line}> - <LineNumber firstLineNumber={firstLineNumber} line={line} /> + <LineNumber displayOptions={displayOptions} firstLineNumber={firstLineNumber} line={line} /> {displaySCM && <LineSCM line={line} previousLine={previousLine} />} {displayIssues && !displayAllIssues ? ( diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx index 21df17a4fa2..48e63fe419d 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx @@ -23,32 +23,37 @@ import { translateWithParameters } from 'sonar-ui-common/helpers/l10n'; import LineOptionsPopup from './LineOptionsPopup'; export interface LineNumberProps { + displayOptions: boolean; firstLineNumber: number; line: T.SourceLine; } -export function LineNumber({ firstLineNumber, line }: LineNumberProps) { +export function LineNumber({ displayOptions, firstLineNumber, line }: LineNumberProps) { const [isOpen, setOpen] = React.useState<boolean>(false); const { line: lineNumber } = line; const hasLineNumber = !!lineNumber; return hasLineNumber ? ( <td className="source-meta source-line-number" data-line-number={lineNumber}> - <Toggler - closeOnClickOutside={true} - onRequestClose={() => setOpen(false)} - open={isOpen} - overlay={<LineOptionsPopup firstLineNumber={firstLineNumber} line={line} />}> - <span - aria-expanded={isOpen} - aria-haspopup={true} - aria-label={translateWithParameters('source_viewer.line_X', lineNumber)} - onClick={() => setOpen(true)} - role="button" - tabIndex={0}> - {lineNumber} - </span> - </Toggler> + {displayOptions ? ( + <Toggler + closeOnClickOutside={true} + onRequestClose={() => setOpen(false)} + open={isOpen} + overlay={<LineOptionsPopup firstLineNumber={firstLineNumber} line={line} />}> + <span + aria-expanded={isOpen} + aria-haspopup={true} + aria-label={translateWithParameters('source_viewer.line_X', lineNumber)} + onClick={() => setOpen(true)} + role="button" + tabIndex={0}> + {lineNumber} + </span> + </Toggler> + ) : ( + lineNumber + )} </td> ) : ( <td className="source-meta source-line-number" /> diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineNumber-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineNumber-test.tsx index f536dd12bcb..849f09a059a 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineNumber-test.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineNumber-test.tsx @@ -25,8 +25,13 @@ it('should render correctly', () => { expect(shallowRender()).toMatchSnapshot('default'); expect(shallowRender({ line: { line: 0 } })).toMatchSnapshot('no line number'); expect(shallowRender({ line: { line: 12 } })).toMatchSnapshot('first line'); + expect(shallowRender({ displayOptions: false, line: { line: 12 } })).toMatchSnapshot( + 'no options' + ); }); function shallowRender(props: Partial<LineNumberProps> = {}) { - return shallow(<LineNumber firstLineNumber={10} line={{ line: 20 }} {...props} />); + return shallow( + <LineNumber displayOptions={true} firstLineNumber={10} line={{ line: 20 }} {...props} /> + ); } diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/Line-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/Line-test.tsx.snap index 853ff92974d..784b30a9192 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/Line-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/Line-test.tsx.snap @@ -6,6 +6,7 @@ exports[`should render correctly 1`] = ` data-line-number={16} > <Memo(LineNumber) + displayOptions={true} firstLineNumber={1} line={ Object { @@ -145,6 +146,7 @@ exports[`should render correctly for last, new, and highlighted lines 1`] = ` data-line-number={16} > <Memo(LineNumber) + displayOptions={true} firstLineNumber={1} line={ Object { @@ -284,6 +286,7 @@ exports[`should render correctly with coverage 1`] = ` data-line-number={16} > <Memo(LineNumber) + displayOptions={true} firstLineNumber={1} line={ Object { @@ -439,6 +442,7 @@ exports[`should render correctly with duplication information 1`] = ` data-line-number={16} > <Memo(LineNumber) + displayOptions={true} firstLineNumber={1} line={ Object { @@ -639,6 +643,7 @@ exports[`should render correctly with issues info 1`] = ` data-line-number={16} > <Memo(LineNumber) + displayOptions={true} firstLineNumber={1} line={ Object { @@ -854,6 +859,7 @@ exports[`should render correctly: no SCM 1`] = ` data-line-number={16} > <Memo(LineNumber) + displayOptions={true} firstLineNumber={1} line={ Object { diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineNumber-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineNumber-test.tsx.snap index ea264c2f415..553567189c8 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineNumber-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineNumber-test.tsx.snap @@ -73,3 +73,12 @@ exports[`should render correctly: no line number 1`] = ` className="source-meta source-line-number" /> `; + +exports[`should render correctly: no options 1`] = ` +<td + className="source-meta source-line-number" + data-line-number={12} +> + 12 +</td> +`; diff --git a/server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts b/server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts index 90ce5c0c031..74a2b80a647 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts @@ -21,6 +21,7 @@ import { ComponentQualifier } from '../../types/component'; import { Standards } from '../../types/security'; import { Hotspot, + HotspotComponent, HotspotResolution, HotspotRule, HotspotStatus, @@ -29,7 +30,7 @@ import { ReviewHistoryType, RiskExposure } from '../../types/security-hotspots'; -import { mockComponent, mockUser } from '../testMocks'; +import { mockUser } from '../testMocks'; export function mockRawHotspot(overrides: Partial<RawHotspot> = {}): RawHotspot { return { @@ -61,12 +62,12 @@ export function mockHotspot(overrides?: Partial<Hotspot>): Hotspot { canChangeStatus: true, changelog: [], comment: [], - component: mockComponent({ qualifier: ComponentQualifier.File }), + component: mockHotspotComponent({ qualifier: ComponentQualifier.File }), creationDate: '2013-05-13T17:55:41+0200', key: '01fc972e-2a3c-433e-bcae-0bd7f88f5123', line: 142, message: "'3' is a magic number.", - project: mockComponent({ qualifier: ComponentQualifier.Project }), + project: mockHotspotComponent({ qualifier: ComponentQualifier.Project }), resolution: HotspotResolution.FIXED, rule: mockHotspotRule(), status: HotspotStatus.REVIEWED, @@ -82,6 +83,17 @@ export function mockHotspot(overrides?: Partial<Hotspot>): Hotspot { }; } +export function mockHotspotComponent(overrides?: Partial<HotspotComponent>): HotspotComponent { + return { + key: 'hotspot-component', + name: 'Hotspot Component', + longName: 'Hotspot component long name', + qualifier: ComponentQualifier.File, + path: 'path/to/component', + ...overrides + }; +} + export function mockHotspotRule(overrides?: Partial<HotspotRule>): HotspotRule { return { key: 'squid:S2077', diff --git a/server/sonar-web/src/main/js/types/security-hotspots.ts b/server/sonar-web/src/main/js/types/security-hotspots.ts index ba043f8f344..557f92ac3ec 100644 --- a/server/sonar-web/src/main/js/types/security-hotspots.ts +++ b/server/sonar-web/src/main/js/types/security-hotspots.ts @@ -17,6 +17,8 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { ComponentQualifier } from './component'; + export enum RiskExposure { LOW = 'LOW', MEDIUM = 'MEDIUM', @@ -77,12 +79,12 @@ export interface Hotspot { canChangeStatus: boolean; changelog: T.IssueChangelog[]; comment: HotspotComment[]; - component: T.Component; + component: HotspotComponent; creationDate: string; key: string; line?: number; message: string; - project: T.Component; + project: HotspotComponent; resolution?: HotspotResolution; rule: HotspotRule; status: HotspotStatus; @@ -91,6 +93,16 @@ export interface Hotspot { users: T.UserBase[]; } +export interface HotspotComponent { + key: string; + qualifier: ComponentQualifier; + name: string; + longName: string; + path: string; + branch?: string; + pullRequest?: string; +} + export interface HotspotUpdateFields { status: HotspotStatus; resolution?: HotspotResolution; |