diff options
author | Mathieu Suen <mathieu.suen@sonarsource.com> | 2022-06-14 10:16:44 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-06-15 20:03:03 +0000 |
commit | 2a7127370736396d0f912d58ff5d6df5ed30bd07 (patch) | |
tree | faa30dfa7bd5ab22cb6b9d73e835c42c1c3401a9 /server/sonar-web/src/main/js/components | |
parent | b252bea18bbbf44452c05b1e569d530f369dede6 (diff) | |
download | sonarqube-2a7127370736396d0f912d58ff5d6df5ed30bd07.tar.gz sonarqube-2a7127370736396d0f912d58ff5d6df5ed30bd07.zip |
SONAR-16488 Clean sub-project code from the UI
Diffstat (limited to 'server/sonar-web/src/main/js/components')
12 files changed, 12 insertions, 222 deletions
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<Props, State render() { const { showMeasures } = this.props; - const { - key, - measures, - path, - project, - projectName, - q, - subProject, - subProjectName - } = this.props.sourceViewerFile; + const { key, measures, path, project, projectName, q } = this.props.sourceViewerFile; const unitTestsOrLines = q === ComponentQualifier.TestFile ? 'tests' : 'lines'; const workspace = false; const query = new URLSearchParams( @@ -144,12 +135,6 @@ export default class SourceViewerHeader extends React.PureComponent<Props, State </a> </div> - {subProject !== undefined && ( - <div className="component-name-parent"> - <QualifierIcon qualifier="BRC" /> <span>{subProjectName}</span> - </div> - )} - <div className="component-name-path"> <QualifierIcon qualifier={q} /> <span>{collapsedDirFromPath(path)}</span> <span className="component-name-file">{fileFromPath(path)}</span> 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) { </div> )} - {subProject !== undefined && ( - <> - <QualifierIcon qualifier={ComponentQualifier.SubProject} />{' '} - <span className="spacer-right">{subProjectName}</span> - </> - )} - {!isProjectRoot && ( <> <div className="spacer-right"> 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<Props> = {}) { return shallow( <SourceViewerHeaderSlim diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeaderSlim-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeaderSlim-test.tsx.snap index d25353697d6..1a2badc509e 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeaderSlim-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeaderSlim-test.tsx.snap @@ -85,100 +85,6 @@ exports[`should render correctly 1`] = ` </div> `; -exports[`should render correctly for subproject 1`] = ` -<div - className="source-viewer-header-slim display-flex-row display-flex-space-between" -> - <div - className="display-flex-center flex-1" - > - <div - className="spacer-right" - > - <a - className="link-with-icon" - href="/dashboard?id=my-project" - > - <QualifierIcon - qualifier="TRK" - /> - - <span> - MyProject - </span> - </a> - </div> - <QualifierIcon - qualifier="BRC" - /> - - <span - className="spacer-right" - > - Foo - </span> - <div - className="spacer-right" - > - <QualifierIcon - qualifier="FIL" - /> - - <span> - foo/ - </span> - <span - className="component-name-file" - > - bar.ts - </span> - </div> - <div - className="spacer-right" - > - <ClipboardIconButton - className="button-link link-no-underline" - copyValue="foo/bar.ts" - /> - </div> - </div> - <div - className="flex-0 big-spacer-left" - > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "files": "foo/bar.ts", - "id": "my-project", - "resolved": "false", - }, - } - } - > - source_viewer.view_all_issues - </Link> - </div> - <DeferredSpinner - className="little-spacer-right" - > - <div - className="flex-0 big-spacer-left" - > - <ButtonIcon - className="js-actions" - onClick={[MockFunction]} - > - <ExpandSnippetIcon /> - </ButtonIcon> - </div> - </DeferredSpinner> -</div> -`; - exports[`should render correctly: no link to project 1`] = ` <div className="source-viewer-header-slim display-flex-row display-flex-space-between" diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx index 598088ec542..cb0778b2fef 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx @@ -45,11 +45,8 @@ export default class DuplicationPopup extends React.PureComponent<Props> { 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<HTMLAnchorElement>) => { @@ -98,7 +95,6 @@ export default class DuplicationPopup extends React.PureComponent<Props> { 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<Props> { <div className="spacer-top text-ellipsis" key={duplication.file.key}> <div className="component-name"> {this.isDifferentComponent(duplication.file, this.props.sourceViewerFile) && ( - <> - <div className="component-name-parent"> - <QualifierIcon className="little-spacer-right" qualifier="TRK" /> - <Link to={getProjectUrl(duplication.file.project)}> - {duplication.file.projectName} - </Link> - </div> - {duplication.file.subProject && duplication.file.subProjectName && ( - <div className="component-name-parent"> - <QualifierIcon className="little-spacer-right" qualifier="BRC" /> - {duplication.file.subProjectName} - </div> - )} - </> + <div className="component-name-parent"> + <QualifierIcon className="little-spacer-right" qualifier="TRK" /> + <Link to={getProjectUrl(duplication.file.project)}> + {duplication.file.projectName} + </Link> + </div> )} {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<Props, State> { <Link to={getBranchLikeUrl(sourceViewerFile.project, branchLike)}> {sourceViewerFile.projectName} </Link> - - {sourceViewerFile.subProject && ( - <> - <QualifierIcon className="big-spacer-left little-spacer-right" qualifier="BRC" /> - {sourceViewerFile.subProjectName} - </> - )} </div> <div className="display-flex-center little-spacer-top"> 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 </Link> - <QualifierIcon - className="big-spacer-left little-spacer-right" - qualifier="BRC" - /> - Sub-Project Name </div> <div className="display-flex-center little-spacer-top" @@ -613,11 +608,6 @@ exports[`should render source file 2`] = ` > Project Name </Link> - <QualifierIcon - className="big-spacer-left little-spacer-right" - qualifier="BRC" - /> - Sub-Project Name </div> <div className="display-flex-center little-spacer-top" @@ -1770,11 +1760,6 @@ exports[`should render test file 1`] = ` > Project Name </Link> - <QualifierIcon - className="big-spacer-left little-spacer-right" - qualifier="BRC" - /> - Sub-Project Name </div> <div className="display-flex-center little-spacer-top" diff --git a/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx b/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx index 092db41f942..57cef682ed5 100644 --- a/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx +++ b/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx @@ -25,20 +25,13 @@ import Icon, { IconProps } from './Icon'; const qualifierIcons: Dict<(props: IconProps) => 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 ( - <Icon {...iconProps} ariaLabel={ariaLabel}> - <path - d="M1 13h4V3H1v10zm3-1H2v-2h2v2zM2 4h2v4H2V4zm4 9h4V3H6v10zm3-1H7v-2h2v2zM7 4h2v4H7V4zm4 9h4V3h-4v10zm3-1h-2v-2h2v2zm-2-8h2v4h-2V4z" - style={{ fill: fill || colors.blue }} - /> - </Icon> - ); -} - function PortfolioIcon({ fill, ariaLabel, ...iconProps }: IconProps) { return ( <Icon {...iconProps} ariaLabel={ariaLabel}> @@ -148,17 +130,6 @@ function SubPortfolioIcon({ fill, ariaLabel, ...iconProps }: IconProps) { ); } -function SubProjectIcon({ fill, ariaLabel, ...iconProps }: IconProps) { - return ( - <Icon {...iconProps} ariaLabel={ariaLabel}> - <path - d="M8 9V8h6v1h1v1h1v6H6v-6h1V9h1zm7 2H7v4h8v-4zm-1-7v3h-1V5H1v7h4v1H0V4h14zm-1-2v1.5h-1V3H2v.5H1V2h12zm-1-2v1.5h-1V1H3v.5H2V0h10z" - style={{ fill: fill || colors.blue }} - /> - </Icon> - ); -} - function UnitTestIcon({ fill, ariaLabel, ...iconProps }: IconProps) { return ( <Icon {...iconProps} ariaLabel={ariaLabel}> 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<Props> { '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<Props> { {issue.projectName} </SelectListItem> - {issue.subProject != null && ( - <SelectListItem item="module"> - <QualifierIcon className="little-spacer-right" qualifier="BRC" /> - {issue.subProjectName} - </SelectListItem> - )} - <SelectListItem item="file"> <QualifierIcon className="little-spacer-right" qualifier={issue.componentQualifier} /> {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<SimilarIssuesPopup['props']> = {}) { return shallow( <SimilarIssuesPopup - issue={mockIssue(false, { subProject: 'foo', subProjectName: 'Foo', tags: ['test-tag'] })} + issue={mockIssue(false, { tags: ['test-tag'] })} onFilter={jest.fn()} {...props} /> 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", ] } @@ -100,15 +99,6 @@ exports[`should render correctly 1`] = ` Foo </SelectListItem> <SelectListItem - item="module" - > - <QualifierIcon - className="little-spacer-right" - qualifier="BRC" - /> - Foo - </SelectListItem> - <SelectListItem item="file" > <QualifierIcon |