From 2a7127370736396d0f912d58ff5d6df5ed30bd07 Mon Sep 17 00:00:00 2001 From: Mathieu Suen Date: Tue, 14 Jun 2022 10:16:44 +0200 Subject: SONAR-16488 Clean sub-project code from the UI --- .../components/SourceViewer/SourceViewerHeader.tsx | 17 +--- .../SourceViewer/SourceViewerHeaderSlim.tsx | 9 +-- .../__tests__/SourceViewerHeaderSlim-test.tsx | 11 --- .../SourceViewerHeaderSlim-test.tsx.snap | 94 ---------------------- .../SourceViewer/components/DuplicationPopup.tsx | 28 ++----- .../SourceViewer/components/MeasuresOverlay.tsx | 7 -- .../components/__tests__/MeasuresOverlay-test.tsx | 2 - .../__snapshots__/MeasuresOverlay-test.tsx.snap | 15 ---- .../src/main/js/components/icons/QualifierIcon.tsx | 31 +------ .../components/issue/popups/SimilarIssuesPopup.tsx | 8 -- .../popups/__tests__/SimilarIssuesPopup-test.tsx | 2 +- .../__snapshots__/SimilarIssuesPopup-test.tsx.snap | 10 --- 12 files changed, 12 insertions(+), 222 deletions(-) (limited to 'server/sonar-web/src/main/js/components') diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx index 221e1a84839..569775ece00 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx @@ -114,16 +114,7 @@ export default class SourceViewerHeader extends React.PureComponent - {subProject !== undefined && ( -
- {subProjectName} -
- )} -
{collapsedDirFromPath(path)} {fileFromPath(path)} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx index 6ae845568eb..38ebd8cbce5 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx @@ -54,7 +54,7 @@ export default function SourceViewerHeaderSlim(props: Props) { onExpand, sourceViewerFile } = props; - const { measures, path, project, projectName, q, subProject, subProjectName } = sourceViewerFile; + const { measures, path, project, projectName, q } = sourceViewerFile; const projectNameLabel = ( <> @@ -81,13 +81,6 @@ export default function SourceViewerHeaderSlim(props: Props) {
)} - {subProject !== undefined && ( - <> - {' '} - {subProjectName} - - )} - {!isProjectRoot && ( <>
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeaderSlim-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeaderSlim-test.tsx index 86113ca61a2..e9b49afdd41 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeaderSlim-test.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeaderSlim-test.tsx @@ -37,17 +37,6 @@ it('should render correctly', () => { ).toMatchSnapshot('project root'); }); -it('should render correctly for subproject', () => { - expect( - shallowRender({ - sourceViewerFile: mockSourceViewerFile('foo/bar.ts', 'my-project', { - subProject: 'foo', - subProjectName: 'Foo' - }) - }) - ).toMatchSnapshot(); -}); - function shallowRender(props: Partial = {}) { return shallow( `; -exports[`should render correctly for subproject 1`] = ` -
-
- - - - - Foo - -
- - - - foo/ - - - bar.ts - -
-
- -
-
-
- - source_viewer.view_all_issues - -
- -
- - - -
-
-
-`; - exports[`should render correctly: no link to project 1`] = `
{ return !isPullRequest(branchLike); } - isDifferentComponent = ( - a: { project: string; subProject?: string }, - b: { project: string; subProject?: string } - ) => { - return Boolean(a && b && (a.project !== b.project || a.subProject !== b.subProject)); + isDifferentComponent = (a: { project: string }, b: { project: string }) => { + return Boolean(a && b && a.project !== b.project); }; handleFileClick = (event: React.MouseEvent) => { @@ -98,7 +95,6 @@ export default class DuplicationPopup extends React.PureComponent { duplications = sortBy( duplications, d => d.file.projectName !== sourceViewerFile.projectName, - d => d.file.subProjectName !== sourceViewerFile.subProjectName, d => d.file.key !== sourceViewerFile.key ); @@ -118,20 +114,12 @@ export default class DuplicationPopup extends React.PureComponent {
{this.isDifferentComponent(duplication.file, this.props.sourceViewerFile) && ( - <> -
- - - {duplication.file.projectName} - -
- {duplication.file.subProject && duplication.file.subProjectName && ( -
- - {duplication.file.subProjectName} -
- )} - +
+ + + {duplication.file.projectName} + +
)} {duplication.file.key !== this.props.sourceViewerFile.key && ( diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx index 81c48868fbc..3456b9b3577 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx @@ -379,13 +379,6 @@ export default class MeasuresOverlay extends React.PureComponent { {sourceViewerFile.projectName} - - {sourceViewerFile.subProject && ( - <> - - {sourceViewerFile.subProjectName} - - )}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx index f506a276f0b..caf553c4d9f 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx @@ -148,8 +148,6 @@ const sourceViewerFile: SourceViewerFile = { project: 'project-key', projectName: 'Project Name', q: ComponentQualifier.File, - subProject: 'sub-project-key', - subProjectName: 'Sub-Project Name', uuid: 'abcd123' }; diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap index 8943a81bd7e..eaa091a84af 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap @@ -39,11 +39,6 @@ exports[`should render source file 1`] = ` > Project Name - - Sub-Project Name
Project Name - - Sub-Project Name
Project Name - - Sub-Project Name
React.ReactElement> = { app: ApplicationIcon, - brc: SubProjectIcon, dev: DeveloperIcon, dir: DirectoryIcon, fil: FileIcon, svw: SubPortfolioIcon, trk: ProjectIcon, uts: UnitTestIcon, - vw: PortfolioIcon, - - // deprecated: - cla: UnitTestIcon, - dev_prj: ProjectIcon, - lib: LibraryIcon, - pac: DirectoryIcon + vw: PortfolioIcon }; interface QualifierIconProps { @@ -104,17 +97,6 @@ function FileIcon({ fill, ariaLabel, ...iconProps }: IconProps) { ); } -function LibraryIcon({ fill, ariaLabel, ...iconProps }: IconProps) { - return ( - - - - ); -} - function PortfolioIcon({ fill, ariaLabel, ...iconProps }: IconProps) { return ( @@ -148,17 +130,6 @@ function SubPortfolioIcon({ fill, ariaLabel, ...iconProps }: IconProps) { ); } -function SubProjectIcon({ fill, ariaLabel, ...iconProps }: IconProps) { - return ( - - - - ); -} - function UnitTestIcon({ fill, ariaLabel, ...iconProps }: IconProps) { return ( diff --git a/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx index f2d70ac448e..c789003c65e 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx @@ -53,7 +53,6 @@ export default class SimilarIssuesPopup extends React.PureComponent { 'rule', ...(issue.tags || []).map(tag => `tag###${tag}`), 'project', - issue.subProject ? 'module' : undefined, 'file' ].filter(item => item) as string[]; @@ -131,13 +130,6 @@ export default class SimilarIssuesPopup extends React.PureComponent { {issue.projectName} - {issue.subProject != null && ( - - - {issue.subProjectName} - - )} - {fileFromPath(issue.componentLongName)} diff --git a/server/sonar-web/src/main/js/components/issue/popups/__tests__/SimilarIssuesPopup-test.tsx b/server/sonar-web/src/main/js/components/issue/popups/__tests__/SimilarIssuesPopup-test.tsx index a8e4d1b993d..4a6d09a474d 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/__tests__/SimilarIssuesPopup-test.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/__tests__/SimilarIssuesPopup-test.tsx @@ -51,7 +51,7 @@ it('should filter properly', () => { function shallowRender(props: Partial = {}) { return shallow( diff --git a/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SimilarIssuesPopup-test.tsx.snap b/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SimilarIssuesPopup-test.tsx.snap index aabffd0885e..9710488692c 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SimilarIssuesPopup-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SimilarIssuesPopup-test.tsx.snap @@ -24,7 +24,6 @@ exports[`should render correctly 1`] = ` "rule", "tag###test-tag", "project", - "module", "file", ] } @@ -99,15 +98,6 @@ exports[`should render correctly 1`] = ` /> Foo - - - Foo - -- cgit v1.2.3