aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Davis <jeremy.davis@sonarsource.com>2022-11-23 22:47:44 +0800
committersonartech <sonartech@sonarsource.com>2022-11-24 20:02:50 +0000
commit328840a47701c59977549ed01ce8adec11633a40 (patch)
tree5adc8c6bc8051dd1d3358dd4806f2b4a6f89b9f1
parent6eb425d0121cc6300680bdd9e6b99a27de06d8b8 (diff)
downloadsonarqube-328840a47701c59977549ed01ce8adec11633a40.tar.gz
sonarqube-328840a47701c59977549ed01ce8adec11633a40.zip
SONAR-17386 handle issues on deleted files
-rw-r--r--server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts16
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesList-test.tsx.snap3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesSourceViewer-test.tsx.snap8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/ListItem-test.tsx.snap2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssueBox-test.tsx.snap2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx49
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/ComponentSourceSnippetGroupViewer-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/CrossComponentSourceViewer-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/CrossComponentSourceViewer-test.tsx.snap3
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewer-test.tsx.snap2
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssueList-test.tsx.snap1
-rw-r--r--server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/IssueView-test.tsx.snap4
-rw-r--r--server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/issue-test.tsx.snap1
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueActionsBar-test.tsx.snap19
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.tsx.snap5
-rw-r--r--server/sonar-web/src/main/js/helpers/testMocks.ts1
-rw-r--r--server/sonar-web/src/main/js/types/issues.ts2
-rw-r--r--server/sonar-web/src/main/js/types/types.ts1
19 files changed, 118 insertions, 24 deletions
diff --git a/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts
index 2d7b4b48f3f..177f06606da 100644
--- a/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts
@@ -74,10 +74,24 @@ function mockReferenceComponent(override?: Partial<ReferencedComponent>) {
key: 'component1',
name: 'Component1',
uuid: 'id1',
+ enabled: true,
...override,
};
}
+function generateReferenceComponentsForIssues(issueData: IssueData[]) {
+ return issueData
+ .reduce((componentKeys, response) => {
+ const componentKey = response.issue.component;
+ if (!componentKeys.includes(componentKey)) {
+ return [...componentKeys, componentKey];
+ }
+
+ return componentKeys;
+ }, [] as string[])
+ .map((key) => mockReferenceComponent({ key, enabled: true }));
+}
+
interface IssueData {
issue: RawIssue;
snippets: Dict<SnippetsByComponent>;
@@ -483,7 +497,7 @@ export default class IssuesServiceMock {
};
});
return this.reply({
- components: [mockReferenceComponent()],
+ components: generateReferenceComponentsForIssues(this.list),
effortTotal: 199629,
facets,
issues: this.list.map((line) => line.issue),
diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesList-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesList-test.tsx.snap
index 0d8e3039633..cc254758253 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesList-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesList-test.tsx.snap
@@ -16,6 +16,7 @@ exports[`should render correctly 2`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -57,6 +58,7 @@ exports[`should render correctly 2`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -94,6 +96,7 @@ exports[`should render correctly 2`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesSourceViewer-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesSourceViewer-test.tsx.snap
index 7e70e983693..bb4189f7f04 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesSourceViewer-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesSourceViewer-test.tsx.snap
@@ -22,6 +22,7 @@ exports[`should render CrossComponentSourceViewer correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -96,6 +97,7 @@ exports[`should render CrossComponentSourceViewer correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -245,6 +247,7 @@ exports[`should render SourceViewer correctly: all secondary locations on same l
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -328,6 +331,7 @@ exports[`should render SourceViewer correctly: all secondary locations on same l
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -477,6 +481,7 @@ exports[`should render SourceViewer correctly: default 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -509,6 +514,7 @@ exports[`should render SourceViewer correctly: default 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -566,6 +572,7 @@ exports[`should render SourceViewer correctly: single secondary location 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -631,6 +638,7 @@ exports[`should render SourceViewer correctly: single secondary location 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/ListItem-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/ListItem-test.tsx.snap
index c56504a36a7..66912b6ce0f 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/ListItem-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/ListItem-test.tsx.snap
@@ -34,6 +34,7 @@ exports[`should render correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -77,6 +78,7 @@ exports[`should render correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssueBox-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssueBox-test.tsx.snap
index bce2e4edbab..d1fc86dd005 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssueBox-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssueBox-test.tsx.snap
@@ -25,6 +25,7 @@ exports[`should render correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -83,6 +84,7 @@ exports[`should render correctly 2`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx
index 2630d4b1add..f1b755af332 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx
@@ -254,27 +254,15 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
const { branchLike, isLastOccurenceOfPrimaryComponent, issue, lastSnippetGroup, snippetGroup } =
this.props;
const { additionalLines, loading, snippets } = this.state;
- const locations =
- issue.component === snippetGroup.component.key && issue.textRange !== undefined
- ? locationsByLine([issue])
- : {};
-
- const fullyShown =
- snippets.length === 1 &&
- snippetGroup.component.measures &&
- snippets[0].end - snippets[0].start ===
- parseInt(snippetGroup.component.measures.lines || '', 10);
const snippetLines = linesForSnippets(snippets, {
...snippetGroup.sources,
...additionalLines,
});
- const isFlow = issue.secondaryLocations.length === 0;
- const includeIssueLocation = isFlow ? isLastOccurenceOfPrimaryComponent : true;
-
const issueIsClosed = issue.status === IssueStatus.Closed;
- const issueIsFileLevel = issue.componentQualifier === ComponentQualifier.File;
+ const issueIsFileLevel =
+ issue.componentQualifier === ComponentQualifier.File && issue.componentEnabled;
const closedIssueMessageKey = issueIsFileLevel
? 'issue.closed.file_level'
: 'issue.closed.project_level';
@@ -301,7 +289,7 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
<IssueSourceViewerHeader
branchLike={branchLike}
className={issueIsClosed && !issueIsFileLevel ? 'null-spacer-bottom' : ''}
- expandable={!fullyShown && isFile(snippetGroup.component.q)}
+ expandable={isExpandable(snippets, snippetGroup)}
loading={loading}
onExpand={this.expandComponent}
sourceViewerFile={snippetGroup.component}
@@ -338,7 +326,11 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
lastSnippetOfLastGroup={lastSnippetGroup && index === snippets.length - 1}
loadDuplications={this.loadDuplications}
locations={this.props.locations}
- locationsByLine={includeIssueLocation ? locations : {}}
+ locationsByLine={getLocationsByLine(
+ issue,
+ snippetGroup,
+ isLastOccurenceOfPrimaryComponent
+ )}
onLocationSelect={this.props.onLocationSelect}
renderDuplicationPopup={this.renderDuplicationPopup}
snippet={snippet}
@@ -348,3 +340,28 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
);
}
}
+
+function getLocationsByLine(
+ issue: TypeIssue,
+ snippetGroup: SnippetGroup,
+ isLastOccurenceOfPrimaryComponent: boolean
+) {
+ const isFlow = issue.secondaryLocations.length === 0;
+ const includeIssueLocation = isFlow ? isLastOccurenceOfPrimaryComponent : true;
+
+ return includeIssueLocation &&
+ issue.component === snippetGroup.component.key &&
+ issue.textRange !== undefined
+ ? locationsByLine([issue])
+ : {};
+}
+
+function isExpandable(snippets: Snippet[], snippetGroup: SnippetGroup) {
+ const fullyShown =
+ snippets.length === 1 &&
+ snippetGroup.component.measures &&
+ snippets[0].end - snippets[0].start ===
+ parseInt(snippetGroup.component.measures.lines || '', 10);
+
+ return !fullyShown && isFile(snippetGroup.component.q);
+}
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx
index dc3d78c0026..d0ce1590f81 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx
@@ -127,7 +127,8 @@ export default class CrossComponentSourceViewer extends React.PureComponent<Prop
issue.status === IssueStatus.Closed ? {} : await getIssueFlowSnippets(issue.key);
if (components[issue.component] === undefined) {
const issueComponent = await getComponentForSourceViewer({
- component: issue.component,
+ // If the issue's component doesn't exist anymore (typically a deleted file), use the project
+ component: issue.componentEnabled ? issue.component : issue.project,
...getBranchLikeQuery(branchLike),
});
components[issue.component] = { component: issueComponent, sources: [] };
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/ComponentSourceSnippetGroupViewer-test.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/ComponentSourceSnippetGroupViewer-test.tsx
index 089f8748835..457fc4d9a46 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/ComponentSourceSnippetGroupViewer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/ComponentSourceSnippetGroupViewer-test.tsx
@@ -151,15 +151,17 @@ it('should render file-level issue correctly', () => {
});
it.each([
- ['file-level', ComponentQualifier.File, 'issue.closed.file_level'],
- ['project-level', ComponentQualifier.Project, 'issue.closed.project_level'],
+ ['file-level', ComponentQualifier.File, true, 'issue.closed.file_level'],
+ ['file-level', ComponentQualifier.File, false, 'issue.closed.project_level'],
+ ['project-level', ComponentQualifier.Project, false, 'issue.closed.project_level'],
])(
'should render a closed %s issue correctly',
- async (_level, componentQualifier, expectedLabel) => {
+ async (_level, componentQualifier, componentEnabled, expectedLabel) => {
// issue with secondary locations and no primary location
const issue = mockIssue(true, {
component: 'project:main.js',
componentQualifier,
+ componentEnabled,
flows: [],
textRange: undefined,
status: IssueStatus.Closed,
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/CrossComponentSourceViewer-test.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/CrossComponentSourceViewer-test.tsx
index c5735a79fb3..2e36f4a15f1 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/CrossComponentSourceViewer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/CrossComponentSourceViewer-test.tsx
@@ -19,7 +19,7 @@
*/
import { shallow } from 'enzyme';
import * as React from 'react';
-import { getDuplications } from '../../../../api/components';
+import { getComponentForSourceViewer, getDuplications } from '../../../../api/components';
import { getIssueFlowSnippets } from '../../../../api/issues';
import {
mockSnippetsByComponent,
@@ -75,11 +75,17 @@ it('Should fetch data', async () => {
expect(getIssueFlowSnippets).toHaveBeenCalledWith('foo');
});
-it('Should handle a closed issue', async () => {
- const wrapper = shallowRender({ issue: mockIssue(true, { status: IssueStatus.Closed }) });
+it.each([
+ ['on a deleted file', false, { component: 'myproject' }],
+ ['', true, { component: 'main.js' }],
+])('Should handle a closed issue %s', async (_, componentEnabled, expected) => {
+ const wrapper = shallowRender({
+ issue: mockIssue(true, { componentEnabled, status: IssueStatus.Closed }),
+ });
wrapper.instance().fetchIssueFlowSnippets();
await waitAndUpdate(wrapper);
expect(getIssueFlowSnippets).not.toHaveBeenCalled();
+ expect(getComponentForSourceViewer).toHaveBeenCalledWith(expect.objectContaining(expected));
});
it('Should handle no access rights', async () => {
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/CrossComponentSourceViewer-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/CrossComponentSourceViewer-test.tsx.snap
index 38a4c317e8d..e1f66aa3669 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/CrossComponentSourceViewer-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/CrossComponentSourceViewer-test.tsx.snap
@@ -41,6 +41,7 @@ exports[`should render correctly 2`] = `
Object {
"actions": Array [],
"component": "project:main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -198,6 +199,7 @@ exports[`should render correctly: no component found 1`] = `
Object {
"actions": Array [],
"component": "test.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -326,6 +328,7 @@ exports[`should render correctly: no component found 1`] = `
Object {
"actions": Array [],
"component": "test.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewer-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewer-test.tsx.snap
index a9b7f2b3143..48d95c2940d 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewer-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewer-test.tsx.snap
@@ -78,6 +78,7 @@ exports[`should render correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -112,6 +113,7 @@ exports[`should render correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssueList-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssueList-test.tsx.snap
index b86ed52063c..57a9ee6c5a3 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssueList-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssueList-test.tsx.snap
@@ -18,6 +18,7 @@ exports[`should render issues 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
diff --git a/server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/IssueView-test.tsx.snap b/server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/IssueView-test.tsx.snap
index 35f36ffc66e..a1962128727 100644
--- a/server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/IssueView-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/IssueView-test.tsx.snap
@@ -12,6 +12,7 @@ exports[`should render hotspots correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -47,6 +48,7 @@ exports[`should render hotspots correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -107,6 +109,7 @@ exports[`should render issues correctly 1`] = `
},
],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -156,6 +159,7 @@ exports[`should render issues correctly 1`] = `
},
],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
diff --git a/server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/issue-test.tsx.snap b/server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/issue-test.tsx.snap
index 3b2f7d3baba..73747956ec9 100644
--- a/server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/issue-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/issue-test.tsx.snap
@@ -22,6 +22,7 @@ exports[`should render issues correctly 1`] = `
},
],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueActionsBar-test.tsx.snap b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueActionsBar-test.tsx.snap
index 03560f28c24..5bb47ecddb6 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueActionsBar-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueActionsBar-test.tsx.snap
@@ -19,6 +19,7 @@ exports[`should render commentable correctly 1`] = `
"comment",
],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -62,6 +63,7 @@ exports[`should render commentable correctly 1`] = `
"comment",
],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -105,6 +107,7 @@ exports[`should render commentable correctly 1`] = `
"comment",
],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -148,6 +151,7 @@ exports[`should render commentable correctly 1`] = `
"comment",
],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -203,6 +207,7 @@ exports[`should render commentable correctly 1`] = `
"comment",
],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -255,6 +260,7 @@ exports[`should render effort correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -297,6 +303,7 @@ exports[`should render effort correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -339,6 +346,7 @@ exports[`should render effort correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -381,6 +389,7 @@ exports[`should render effort correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -436,6 +445,7 @@ exports[`should render effort correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -489,6 +499,7 @@ exports[`should render issue correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -530,6 +541,7 @@ exports[`should render issue correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -571,6 +583,7 @@ exports[`should render issue correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -612,6 +625,7 @@ exports[`should render issue correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -657,6 +671,7 @@ exports[`should render issue correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -709,6 +724,7 @@ exports[`should render security hotspot correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -750,6 +766,7 @@ exports[`should render security hotspot correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -791,6 +808,7 @@ exports[`should render security hotspot correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -836,6 +854,7 @@ exports[`should render security hotspot correctly 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.tsx.snap b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.tsx.snap
index 4cf04e124e1..276b4627114 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.tsx.snap
@@ -25,6 +25,7 @@ exports[`should render correctly: default 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -115,6 +116,7 @@ exports[`should render correctly: with filter 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -184,6 +186,7 @@ exports[`should render correctly: with filter 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -245,6 +248,7 @@ exports[`should render correctly: with multi locations 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
@@ -413,6 +417,7 @@ exports[`should render correctly: with multi locations and link 1`] = `
Object {
"actions": Array [],
"component": "main.js",
+ "componentEnabled": true,
"componentLongName": "main.js",
"componentQualifier": "FIL",
"componentUuid": "foo1234",
diff --git a/server/sonar-web/src/main/js/helpers/testMocks.ts b/server/sonar-web/src/main/js/helpers/testMocks.ts
index 561580776b4..a38b03e8d5c 100644
--- a/server/sonar-web/src/main/js/helpers/testMocks.ts
+++ b/server/sonar-web/src/main/js/helpers/testMocks.ts
@@ -318,6 +318,7 @@ export function mockIssue(withLocations = false, overrides: Partial<Issue> = {})
const issue: Issue = {
actions: [],
component: 'main.js',
+ componentEnabled: true,
componentLongName: 'main.js',
componentQualifier: 'FIL',
componentUuid: 'foo1234',
diff --git a/server/sonar-web/src/main/js/types/issues.ts b/server/sonar-web/src/main/js/types/issues.ts
index 0e8c55bdb00..e4b1bbf3312 100644
--- a/server/sonar-web/src/main/js/types/issues.ts
+++ b/server/sonar-web/src/main/js/types/issues.ts
@@ -110,6 +110,8 @@ export interface ReferencedComponent {
key: string;
name: string;
path?: string;
+ enabled?: boolean;
+ longName?: string;
uuid: string;
}
diff --git a/server/sonar-web/src/main/js/types/types.ts b/server/sonar-web/src/main/js/types/types.ts
index 0d28be640f8..e62a646955f 100644
--- a/server/sonar-web/src/main/js/types/types.ts
+++ b/server/sonar-web/src/main/js/types/types.ts
@@ -238,6 +238,7 @@ export interface Issue {
branch?: string;
comments?: IssueComment[];
component: string;
+ componentEnabled?: boolean;
componentLongName: string;
componentQualifier: string;
componentUuid: string;