From: David Cho-Lerat Date: Mon, 12 Jun 2023 13:34:35 +0000 (+0200) Subject: SONAR-19218 + SONAR-19491 Fix redirection links X-Git-Tag: 10.1.0.73491~93 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ab5f7a0099c703a8864b91303202b0afd6499f79;p=sonarqube.git SONAR-19218 + SONAR-19491 Fix redirection links --- diff --git a/server/sonar-web/design-system/src/components/MainAppBar.tsx b/server/sonar-web/design-system/src/components/MainAppBar.tsx index b3575702258..0712a133143 100644 --- a/server/sonar-web/design-system/src/components/MainAppBar.tsx +++ b/server/sonar-web/design-system/src/components/MainAppBar.tsx @@ -28,6 +28,7 @@ import { LAYOUT_VIEWPORT_MIN_WIDTH, } from '../helpers/constants'; import { themeBorder, themeColor, themeContrast } from '../helpers/theme'; +import { BaseLink } from './Link'; const MainAppBarDiv = styled.div` ${tw`sw-sticky sw-top-0`} @@ -57,7 +58,7 @@ const MainAppBarNavLogoDiv = styled.div` } `; -const MainAppBarNavLogoLink = styled.a` +const MainAppBarNavLogoLink = styled(BaseLink)` border: none; `; @@ -73,7 +74,7 @@ export function MainAppBar({ return ( - + diff --git a/server/sonar-web/design-system/src/components/__tests__/MainAppBar-test.tsx b/server/sonar-web/design-system/src/components/__tests__/MainAppBar-test.tsx index fdc66f2a441..7a867284462 100644 --- a/server/sonar-web/design-system/src/components/__tests__/MainAppBar-test.tsx +++ b/server/sonar-web/design-system/src/components/__tests__/MainAppBar-test.tsx @@ -21,6 +21,7 @@ /* eslint-disable import/no-extraneous-dependencies */ import { screen } from '@testing-library/react'; +import { MemoryRouter, Route, Routes } from 'react-router-dom'; import { LAYOUT_LOGO_MAX_HEIGHT, LAYOUT_LOGO_MAX_WIDTH } from '../../helpers/constants'; import { render } from '../../helpers/testUtils'; import { FCProps } from '../../types/misc'; @@ -50,5 +51,11 @@ function setupWithProps( Logo: () => logo, } ) { - return render(); + return render( + + + } path="/" /> + + + ); } diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx index 5115e878787..736dfd99379 100644 --- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx +++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx @@ -39,7 +39,7 @@ import { ClipboardBase } from '../../../components/controls/clipboard'; import { getBranchLikeQuery } from '../../../helpers/branch-like'; import { translate } from '../../../helpers/l10n'; import { collapsedDirFromPath, fileFromPath } from '../../../helpers/path'; -import { getBranchLikeUrl, getComponentIssuesUrl, getPathUrlAsString } from '../../../helpers/urls'; +import { getBranchLikeUrl, getComponentIssuesUrl } from '../../../helpers/urls'; import { BranchLike } from '../../../types/branch-like'; import { ComponentQualifier } from '../../../types/component'; import { SourceViewerFile } from '../../../types/types'; @@ -93,10 +93,7 @@ function IssueSourceViewerHeader(props: Props & ThemeProp) { {displayProjectName && ( <> {linkToProject ? ( - + {projectName} ) : ( 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 ce3f530e3c0..63cad19a213 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx @@ -51,7 +51,6 @@ import { getCodeUrl, getComponentIssuesUrl, getComponentSecurityHotspotsUrl, - getPathUrlAsString, } from '../../helpers/urls'; import { ComponentQualifier } from '../../types/component'; @@ -143,10 +142,7 @@ export default class SourceViewerHeader extends React.PureComponent { >
- } - to={getPathUrlAsString(getBranchLikeUrl(project, this.props.branchLike))} - > + } to={getBranchLikeUrl(project, this.props.branchLike)}> {projectName}