diff options
author | Wouter Admiraal <wouter.admiraal@sonarsource.com> | 2022-08-25 10:45:27 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-08-29 20:02:53 +0000 |
commit | 06f6244b0ae2fd288e05fbdd0bd077a0da9066c4 (patch) | |
tree | 5c1cc37e9aee4859a31321b83d32eafad07f2c14 | |
parent | c757692a0a8d02998bfd8839c2612e17011013a7 (diff) | |
download | sonarqube-06f6244b0ae2fd288e05fbdd0bd077a0da9066c4.tar.gz sonarqube-06f6244b0ae2fd288e05fbdd0bd077a0da9066c4.zip |
SONAR-17027 Align the way we display links (internal & external) in the UI
288 files changed, 1233 insertions, 1287 deletions
diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json index 0c4c2d124e4..a2ffdeec0ef 100644 --- a/server/sonar-web/package.json +++ b/server/sonar-web/package.json @@ -7,7 +7,6 @@ "dependencies": { "@emotion/react": "11.10.0", "@emotion/styled": "11.10.0", - "@types/diff": "5.0.2", "classnames": "2.3.1", "clipboard": "2.0.11", "core-js": "3.21.1", @@ -61,6 +60,7 @@ "@types/d3-selection": "1.3.2", "@types/d3-shape": "1.2.4", "@types/d3-zoom": "1.7.3", + "@types/diff": "5.0.2", "@types/dompurify": "2.3.3", "@types/enzyme": "3.10.5", "@types/jest": "27.4.1", diff --git a/server/sonar-web/src/main/js/app/components/ComponentContainerNotFound.tsx b/server/sonar-web/src/main/js/app/components/ComponentContainerNotFound.tsx index c6fb0f8c382..4375ae160bc 100644 --- a/server/sonar-web/src/main/js/app/components/ComponentContainerNotFound.tsx +++ b/server/sonar-web/src/main/js/app/components/ComponentContainerNotFound.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; -import { Link } from 'react-router-dom'; +import Link from '../../components/common/Link'; import { translate } from '../../helpers/l10n'; export default function ComponentContainerNotFound() { diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx b/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx index 70d929392fd..7631e5345a6 100644 --- a/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx +++ b/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import InstanceMessage from '../../components/common/InstanceMessage'; +import Link from '../../components/common/Link'; import { Alert } from '../../components/ui/Alert'; import { getEdition } from '../../helpers/editions'; import { translate, translateWithParameters } from '../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx b/server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx index bb9da9bbc6f..15c6672a055 100644 --- a/server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx +++ b/server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../components/common/Link'; import { Button } from '../../components/controls/buttons'; import Modal from '../../components/controls/Modal'; import { isInput } from '../../helpers/keyboardEventHelpers'; diff --git a/server/sonar-web/src/main/js/app/components/NotFound.tsx b/server/sonar-web/src/main/js/app/components/NotFound.tsx index 2c5546b4a4a..9ad45060d03 100644 --- a/server/sonar-web/src/main/js/app/components/NotFound.tsx +++ b/server/sonar-web/src/main/js/app/components/NotFound.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; -import { Link } from 'react-router-dom'; +import Link from '../../components/common/Link'; import { translate } from '../../helpers/l10n'; import SimpleContainer from './SimpleContainer'; diff --git a/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/GlobalFooter-test.tsx.snap b/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/GlobalFooter-test.tsx.snap index 233f033bc31..93db6c4ba6f 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/GlobalFooter-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/GlobalFooter-test.tsx.snap @@ -44,11 +44,11 @@ exports[`should display the sq version 1`] = ` <li className="page-footer-menu-item" > - <Link + <ForwardRef(Link) to="/documentation" > footer.documentation - </Link> + </ForwardRef(Link)> </li> <li className="page-footer-menu-item" @@ -64,11 +64,11 @@ exports[`should display the sq version 1`] = ` <li className="page-footer-menu-item" > - <Link + <ForwardRef(Link) to="/web_api" > footer.web_api - </Link> + </ForwardRef(Link)> </li> </ul> </div> @@ -108,11 +108,11 @@ exports[`should not render the only logged in information 1`] = ` <li className="page-footer-menu-item" > - <Link + <ForwardRef(Link) to="/documentation" > footer.documentation - </Link> + </ForwardRef(Link)> </li> <li className="page-footer-menu-item" @@ -173,11 +173,11 @@ exports[`should render the only logged in information 1`] = ` <li className="page-footer-menu-item" > - <Link + <ForwardRef(Link) to="/documentation" > footer.documentation - </Link> + </ForwardRef(Link)> </li> <li className="page-footer-menu-item" @@ -193,11 +193,11 @@ exports[`should render the only logged in information 1`] = ` <li className="page-footer-menu-item" > - <Link + <ForwardRef(Link) to="/web_api" > footer.web_api - </Link> + </ForwardRef(Link)> </li> </ul> </div> diff --git a/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/KeyboardShortcutsModal-test.tsx.snap b/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/KeyboardShortcutsModal-test.tsx.snap index 595ebb03f54..f63709831aa 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/KeyboardShortcutsModal-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/KeyboardShortcutsModal-test.tsx.snap @@ -14,12 +14,12 @@ exports[`should render correctly: visible 1`] = ` <h2> keyboard_shortcuts.title </h2> - <Link + <ForwardRef(Link) onClick={[Function]} to="/account" > keyboard_shortcuts.disable_link - </Link> + </ForwardRef(Link)> </div> <div className="modal-body modal-container markdown display-flex-start shortcuts-modal" diff --git a/server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationRenderer.tsx b/server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationRenderer.tsx index 16439c7b2f0..c63bf4def70 100644 --- a/server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationRenderer.tsx +++ b/server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationRenderer.tsx @@ -22,7 +22,7 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { Alert, AlertProps } from '../../../components/ui/Alert'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { queryToSearch } from '../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/app/components/indexation/__tests__/__snapshots__/IndexationNotificationRenderer-test.tsx.snap b/server/sonar-web/src/main/js/app/components/indexation/__tests__/__snapshots__/IndexationNotificationRenderer-test.tsx.snap index 6802c479180..2872d6529b9 100644 --- a/server/sonar-web/src/main/js/app/components/indexation/__tests__/__snapshots__/IndexationNotificationRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/indexation/__tests__/__snapshots__/IndexationNotificationRenderer-test.tsx.snap @@ -94,7 +94,7 @@ exports[`should render correctly for type="CompletedWithFailure" & isSystemAdmin id="indexation.completed_with_error" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/admin/background_tasks", @@ -103,7 +103,7 @@ exports[`should render correctly for type="CompletedWithFailure" & isSystemAdmin } > indexation.completed_with_error.link - </Link>, + </ForwardRef(Link)>, } } /> @@ -176,7 +176,7 @@ exports[`should render correctly for type="InProgress" & isSystemAdmin=true 1`] id="indexation.admin_link" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/admin/background_tasks", @@ -185,7 +185,7 @@ exports[`should render correctly for type="InProgress" & isSystemAdmin=true 1`] } > background_tasks.page - </Link>, + </ForwardRef(Link)>, } } /> @@ -261,7 +261,7 @@ exports[`should render correctly for type="InProgressWithFailure" & isSystemAdmi id="indexation.progression_with_error" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/admin/background_tasks", @@ -270,7 +270,7 @@ exports[`should render correctly for type="InProgressWithFailure" & isSystemAdmi } > indexation.progression_with_error.link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx b/server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx index c9cc789ec05..ab7f8f58528 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx @@ -19,7 +19,7 @@ */ import { last } from 'lodash'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import QualifierIcon from '../../../../components/icons/QualifierIcon'; import { isMainBranch } from '../../../../helpers/branch-like'; import { getComponentOverviewUrl } from '../../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx index bdd5fce58c6..0277db56333 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBgTaskNotif.tsx @@ -19,8 +19,8 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { STATUSES } from '../../../../apps/background-tasks/constants'; +import Link from '../../../../components/common/Link'; import { Location, withRouter } from '../../../../components/hoc/withRouter'; import { Alert } from '../../../../components/ui/Alert'; import { hasMessage, translate } from '../../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx index ba2f645c2d1..a719e337214 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { isValidLicense } from '../../../../api/editions'; +import Link from '../../../../components/common/Link'; import { Alert } from '../../../../components/ui/Alert'; import { translate, translateWithParameters } from '../../../../helpers/l10n'; import { AppState } from '../../../../types/appstate'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavProjectBindingErrorNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavProjectBindingErrorNotif.tsx index 5cbb5494a0a..fbf1723f736 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavProjectBindingErrorNotif.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavProjectBindingErrorNotif.tsx @@ -19,8 +19,8 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { PULL_REQUEST_DECORATION_BINDING_CATEGORY } from '../../../../apps/settings/constants'; +import Link from '../../../../components/common/Link'; import { Alert } from '../../../../components/ui/Alert'; import { translate } from '../../../../helpers/l10n'; import { getProjectSettingsUrl } from '../../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/HeaderMeta.tsx b/server/sonar-web/src/main/js/app/components/nav/component/HeaderMeta.tsx index 27fc83ce271..4d7ba4f3bea 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/HeaderMeta.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/HeaderMeta.tsx @@ -20,8 +20,8 @@ import * as React from 'react'; import { useIntl } from 'react-intl'; import BranchStatus from '../../../../components/common/BranchStatus'; +import Link from '../../../../components/common/Link'; import HomePageSelect from '../../../../components/controls/HomePageSelect'; -import DetachIcon from '../../../../components/icons/DetachIcon'; import { formatterOption } from '../../../../components/intl/DateTimeFormatter'; import { isBranch, isPullRequest } from '../../../../helpers/branch-like'; import { translate, translateWithParameters } from '../../../../helpers/l10n'; @@ -86,14 +86,13 @@ export function HeaderMeta(props: HeaderMetaProps) { {isPullRequest(branchLike) && ( <div className="navbar-context-meta-secondary display-inline-flex-center"> {branchLike.url !== undefined && ( - <a - className="display-inline-flex-center big-spacer-right" - href={branchLike.url} - rel="noopener noreferrer" - target="_blank"> + <Link + className="link-no-underline big-spacer-right" + to={branchLike.url} + target="_blank" + size={12}> {translate('branches.see_the_pr')} - <DetachIcon className="little-spacer-left" size={12} /> - </a> + </Link> )} <BranchStatus branchLike={branchLike} component={component} /> </div> diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavLicenseNotif-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavLicenseNotif-test.tsx.snap index 30fcabe4912..415d696f63e 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavLicenseNotif-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavLicenseNotif-test.tsx.snap @@ -19,12 +19,12 @@ exports[`renders background task license info correctly 1`] = ` > Foo </span> - <Link + <ForwardRef(Link) to="/admin/extension/license/app" > license.component_navigation.button.LICENSING . - </Link> + </ForwardRef(Link)> </Alert> `; @@ -52,11 +52,11 @@ exports[`renders correctly for LICENSING_LOC error 1`] = ` > Foo </span> - <Link + <ForwardRef(Link) to="/admin/extension/license/app" > license.component_navigation.button.LICENSING_LOC . - </Link> + </ForwardRef(Link)> </Alert> `; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavProjectBindingErrorNotif-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavProjectBindingErrorNotif-test.tsx.snap index 86ee8a11613..f7fa9433b9d 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavProjectBindingErrorNotif-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavProjectBindingErrorNotif-test.tsx.snap @@ -27,7 +27,7 @@ exports[`should render correctly: project admin 1`] = ` id="component_navigation.pr_deco.error_detected_X" values={ Object { - "action": <Link + "action": <ForwardRef(Link) to={ Object { "pathname": "/project/settings", @@ -36,7 +36,7 @@ exports[`should render correctly: project admin 1`] = ` } > component_navigation.pr_deco.action.check_project_settings - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/HeaderMeta-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/HeaderMeta-test.tsx.snap index 677f9989be4..98ebacc1ab8 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/HeaderMeta-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/HeaderMeta-test.tsx.snap @@ -185,18 +185,14 @@ exports[`should render correctly for a pull request 1`] = ` <div className="navbar-context-meta-secondary display-inline-flex-center" > - <a - className="display-inline-flex-center big-spacer-right" - href="https://example.com/pull/1234" - rel="noopener noreferrer" + <ForwardRef(Link) + className="link-no-underline big-spacer-right" + size={12} target="_blank" + to="https://example.com/pull/1234" > branches.see_the_pr - <DetachIcon - className="little-spacer-left" - size={12} - /> - </a> + </ForwardRef(Link)> <withBranchStatus(BranchStatus) branchLike={ Object { diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx index 79a6ec109df..7c51dd97fa7 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import DocumentationTooltip from '../../../../../components/common/DocumentationTooltip'; +import Link from '../../../../../components/common/Link'; import HelpTooltip from '../../../../../components/controls/HelpTooltip'; import BranchLikeIcon from '../../../../../components/icons/BranchLikeIcon'; import DropdownIcon from '../../../../../components/icons/DropdownIcon'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx index 8e5f1127d15..e171e41daff 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../../../components/common/Link'; import { DropdownOverlay } from '../../../../../components/controls/Dropdown'; import SearchBox from '../../../../../components/controls/SearchBox'; import { Router, withRouter } from '../../../../../components/hoc/withRouter'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx index b11f3a30f7a..f11ac90ad01 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../../../../components/common/Link'; import SearchBox from '../../../../../../components/controls/SearchBox'; import { KeyboardKeys } from '../../../../../../helpers/keycodes'; import { diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/__snapshots__/CurrentBranchLike-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/__snapshots__/CurrentBranchLike-test.tsx.snap index 03c55f4adfc..eb009ecfeee 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/__snapshots__/CurrentBranchLike-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/__snapshots__/CurrentBranchLike-test.tsx.snap @@ -79,7 +79,7 @@ exports[`applications should render correctly when there is only one branch and <hr className="spacer-top spacer-bottom" /> - <Link + <ForwardRef(Link) to={ Object { "pathname": "/project/admin/extension/developer-server/application-console", @@ -88,7 +88,7 @@ exports[`applications should render correctly when there is only one branch and } > application.branches.link - </Link> + </ForwardRef(Link)> </React.Fragment> } > diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/__snapshots__/Menu-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/__snapshots__/Menu-test.tsx.snap index df18a2f2f5a..ed6cc27a2a0 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/__snapshots__/Menu-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/__snapshots__/Menu-test.tsx.snap @@ -146,7 +146,7 @@ exports[`should render correctly 1`] = ` <div className="hint-container text-right" > - <Link + <ForwardRef(Link) onClick={[Function]} to={ Object { @@ -156,7 +156,7 @@ exports[`should render correctly 1`] = ` } > branch_like_navigation.manage - </Link> + </ForwardRef(Link)> </div> </DropdownOverlay> `; @@ -307,7 +307,7 @@ exports[`should render correctly with no current branch like 1`] = ` <div className="hint-container text-right" > - <Link + <ForwardRef(Link) onClick={[Function]} to={ Object { @@ -317,7 +317,7 @@ exports[`should render correctly with no current branch like 1`] = ` } > branch_like_navigation.manage - </Link> + </ForwardRef(Link)> </div> </DropdownOverlay> `; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityGate.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityGate.tsx index 379997fccab..3826ae760ef 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityGate.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityGate.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../../../../components/common/Link'; import { translate } from '../../../../../../helpers/l10n'; import { getQualityGateUrl } from '../../../../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityProfiles.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityProfiles.tsx index 2b6bac54bbd..50794431cef 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityProfiles.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityProfiles.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { searchRules } from '../../../../../../api/rules'; +import Link from '../../../../../../components/common/Link'; import Tooltip from '../../../../../../components/controls/Tooltip'; import { translate, translateWithParameters } from '../../../../../../helpers/l10n'; import { getQualityProfileUrl } from '../../../../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/__snapshots__/MetaQualityProfiles-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/__snapshots__/MetaQualityProfiles-test.tsx.snap index 0c11ae23f65..04941dc74b7 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/__snapshots__/MetaQualityProfiles-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/__snapshots__/MetaQualityProfiles-test.tsx.snap @@ -42,7 +42,7 @@ exports[`should render correctly 1`] = ` CSS ) </span> - <Link + <ForwardRef(Link) to={ Object { "pathname": "/profiles/show", @@ -55,7 +55,7 @@ exports[`should render correctly 1`] = ` > name </span> - </Link> + </ForwardRef(Link)> </div> </li> </ul> @@ -108,7 +108,7 @@ exports[`should render correctly 2`] = ` CSS ) </span> - <Link + <ForwardRef(Link) to={ Object { "pathname": "/profiles/show", @@ -121,7 +121,7 @@ exports[`should render correctly 2`] = ` > name </span> - </Link> + </ForwardRef(Link)> </div> </li> </Tooltip> diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavBranding.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavBranding.tsx index 5e0231911bc..a766edf15e6 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavBranding.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavBranding.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import { translate } from '../../../../helpers/l10n'; import { getBaseUrl } from '../../../../helpers/system'; import { AppState } from '../../../../types/appstate'; diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx index ae72bfedf00..79dee1dc5c2 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx @@ -19,8 +19,9 @@ */ import classNames from 'classnames'; import * as React from 'react'; -import { Link, NavLink } from 'react-router-dom'; +import { NavLink } from 'react-router-dom'; import { isMySet } from '../../../../apps/issues/utils'; +import Link from '../../../../components/common/Link'; import Dropdown from '../../../../components/controls/Dropdown'; import DropdownIcon from '../../../../components/icons/DropdownIcon'; import { translate } from '../../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx index 14c4221719e..83539d8ce5c 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import Dropdown from '../../../../components/controls/Dropdown'; import { Router, withRouter } from '../../../../components/hoc/withRouter'; import Avatar from '../../../../components/ui/Avatar'; @@ -98,9 +98,9 @@ export class GlobalNavUser extends React.PureComponent<Props> { renderAnonymous() { return ( <div> - <a className="navbar-login" href="/sessions/new" onClick={this.handleLogin}> + <Link className="navbar-login" to="/sessions/new" onClick={this.handleLogin}> {translate('layout.login')} - </a> + </Link> </div> ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/__snapshots__/GlobalNavBranding-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/__snapshots__/GlobalNavBranding-test.tsx.snap index 9fe279984b6..56d829bf682 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/__snapshots__/GlobalNavBranding-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/__snapshots__/GlobalNavBranding-test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should render correctly: default 1`] = ` -<Link +<ForwardRef(Link) className="navbar-brand" to="/" > @@ -12,11 +12,11 @@ exports[`should render correctly: default 1`] = ` title="layout.sonar.slogan" width={83} /> -</Link> +</ForwardRef(Link)> `; exports[`should render correctly: with logo 1`] = ` -<Link +<ForwardRef(Link) className="navbar-brand" to="/" > @@ -27,11 +27,11 @@ exports[`should render correctly: with logo 1`] = ` title="layout.sonar.slogan" width={100} /> -</Link> +</ForwardRef(Link)> `; exports[`should render correctly: with logo and width 1`] = ` -<Link +<ForwardRef(Link) className="navbar-brand" to="/" > @@ -42,5 +42,5 @@ exports[`should render correctly: with logo and width 1`] = ` title="layout.sonar.slogan" width="200" /> -</Link> +</ForwardRef(Link)> `; diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SystemRestartNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/SystemRestartNotif.tsx index b16dca9e9cb..da0436e8c69 100644 --- a/server/sonar-web/src/main/js/app/components/nav/settings/SystemRestartNotif.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/settings/SystemRestartNotif.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import { Alert } from '../../../../components/ui/Alert'; import { translate } from '../../../../helpers/l10n'; import { getInstance } from '../../../../helpers/system'; diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SystemRestartNotif-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SystemRestartNotif-test.tsx.snap index 1bec0d5aa3a..a8678bc9396 100644 --- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SystemRestartNotif-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SystemRestartNotif-test.tsx.snap @@ -11,11 +11,11 @@ exports[`should render correctly 1`] = ` values={ Object { "instance": undefined, - "link": <Link + "link": <ForwardRef(Link) to="/admin/background_tasks" > background_tasks.page - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/app/components/search/SearchResult.tsx b/server/sonar-web/src/main/js/app/components/search/SearchResult.tsx index c6d8d84cc97..ff444714d01 100644 --- a/server/sonar-web/src/main/js/app/components/search/SearchResult.tsx +++ b/server/sonar-web/src/main/js/app/components/search/SearchResult.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import ClockIcon from '../../../components/icons/ClockIcon'; import FavoriteIcon from '../../../components/icons/FavoriteIcon'; import QualifierIcon from '../../../components/icons/QualifierIcon'; diff --git a/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchResult-test.tsx.snap b/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchResult-test.tsx.snap index a9d22eae13d..ac7e9e5b4e6 100644 --- a/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchResult-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchResult-test.tsx.snap @@ -6,7 +6,7 @@ exports[`renders favorite 1`] = ` key="foo" role="option" > - <Link + <ForwardRef(Link) data-key="foo" onClick={[MockFunction]} onFocus={[Function]} @@ -48,7 +48,7 @@ exports[`renders favorite 1`] = ` foo </div> </div> - </Link> + </ForwardRef(Link)> </li> `; @@ -58,7 +58,7 @@ exports[`renders match 1`] = ` key="foo" role="option" > - <Link + <ForwardRef(Link) data-key="foo" onClick={[MockFunction]} onFocus={[Function]} @@ -99,7 +99,7 @@ exports[`renders match 1`] = ` foo </div> </div> - </Link> + </ForwardRef(Link)> </li> `; @@ -109,7 +109,7 @@ exports[`renders recently browsed 1`] = ` key="foo" role="option" > - <Link + <ForwardRef(Link) data-key="foo" onClick={[MockFunction]} onFocus={[Function]} @@ -150,7 +150,7 @@ exports[`renders recently browsed 1`] = ` foo </div> </div> - </Link> + </ForwardRef(Link)> </li> `; @@ -160,7 +160,7 @@ exports[`renders selected 1`] = ` key="foo" role="option" > - <Link + <ForwardRef(Link) data-key="foo" onClick={[MockFunction]} onFocus={[Function]} @@ -198,7 +198,7 @@ exports[`renders selected 1`] = ` foo </div> </div> - </Link> + </ForwardRef(Link)> </li> `; @@ -209,7 +209,7 @@ exports[`renders selected 2`] = ` key="foo" role="option" > - <Link + <ForwardRef(Link) data-key="foo" onClick={[MockFunction]} onFocus={[Function]} @@ -247,6 +247,6 @@ exports[`renders selected 2`] = ` foo </div> </div> - </Link> + </ForwardRef(Link)> </li> `; diff --git a/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx b/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx index f63a4aee7f7..c850f77dc87 100644 --- a/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx +++ b/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx @@ -22,18 +22,18 @@ import * as React from 'react'; import { getSystemUpgrades } from '../../../../api/system'; import { Alert } from '../../../../components/ui/Alert'; import DismissableAlert from '../../../../components/ui/DismissableAlert'; -import { mockUpgrades } from '../../../../helpers/mocks/system-upgrades'; +import { mockSystemUpgrade } from '../../../../helpers/mocks/system-upgrades'; import { mockAppState, mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; import { waitAndUpdate } from '../../../../helpers/testUtils'; import { Permissions } from '../../../../types/permissions'; import { UpdateNotification } from '../UpdateNotification'; jest.mock('../../../../api/system', () => { - const { mockUpgrades } = jest.requireActual('../../../../helpers/mocks/system-upgrades'); + const { mockSystemUpgrade } = jest.requireActual('../../../../helpers/mocks/system-upgrades'); return { getSystemUpgrades: jest .fn() - .mockResolvedValue({ upgrades: [mockUpgrades({ version: '9.1' })], latestLTS: '8.9' }) + .mockResolvedValue({ upgrades: [mockSystemUpgrade({ version: '9.1' })], latestLTS: '8.9' }) }; }); @@ -86,7 +86,7 @@ it('should not show prompt when no upgrade', async () => { it('should show prompt when no lts date', async () => { (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [mockUpgrades({ version: '8.9', releaseDate: 'INVALID' })], + upgrades: [mockSystemUpgrade({ version: '8.9', releaseDate: 'INVALID' })], latestLTS: '8.9' }); const wrapper = shallowRender({ @@ -100,7 +100,7 @@ it('should show prompt when no lts date', async () => { it('should show prompt when minor upgrade', async () => { (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [mockUpgrades({ version: '9.2' }), mockUpgrades({ version: '9.1' })], + upgrades: [mockSystemUpgrade({ version: '9.2' }), mockSystemUpgrade({ version: '9.1' })], latestLTS: '8.9' }); const wrapper = shallowRender({ @@ -114,7 +114,7 @@ it('should show prompt when minor upgrade', async () => { it('should show prompt when patch upgrade', async () => { (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ - upgrades: [mockUpgrades({ version: '9.2' }), mockUpgrades({ version: '9.1.1' })], + upgrades: [mockSystemUpgrade({ version: '9.2' }), mockSystemUpgrade({ version: '9.1.1' })], latestLTS: '8.9' }); const wrapper = shallowRender({ @@ -129,9 +129,9 @@ it('should show prompt when patch upgrade', async () => { it('should show prompt when lts upgrade', async () => { (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ upgrades: [ - mockUpgrades({ version: '8.9', releaseDate: formatDate(new Date(Date.now())) }), - mockUpgrades({ version: '9.2' }), - mockUpgrades({ version: '9.1.1' }) + mockSystemUpgrade({ version: '8.9', releaseDate: formatDate(new Date(Date.now())) }), + mockSystemUpgrade({ version: '9.2' }), + mockSystemUpgrade({ version: '9.1.1' }) ], latestLTS: '8.9' }); @@ -149,9 +149,9 @@ it('should show prompt when lts upgrade is more than 6 month', async () => { ltsDate.setMonth(ltsDate.getMonth() - 7); (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ upgrades: [ - mockUpgrades({ version: '8.9', releaseDate: formatDate(ltsDate) }), - mockUpgrades({ version: '9.2' }), - mockUpgrades({ version: '9.1.1' }) + mockSystemUpgrade({ version: '8.9', releaseDate: formatDate(ltsDate) }), + mockSystemUpgrade({ version: '9.2' }), + mockSystemUpgrade({ version: '9.1.1' }) ], latestLTS: '8.9' }); @@ -167,9 +167,9 @@ it('should show prompt when lts upgrade is more than 6 month', async () => { it('should show correct alert when not dismissable', async () => { (getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ upgrades: [ - mockUpgrades({ version: '8.9', releaseDate: formatDate(new Date(Date.now())) }), - mockUpgrades({ version: '9.2' }), - mockUpgrades({ version: '9.1.1' }) + mockSystemUpgrade({ version: '8.9', releaseDate: formatDate(new Date(Date.now())) }), + mockSystemUpgrade({ version: '9.2' }), + mockSystemUpgrade({ version: '9.1.1' }) ], latestLTS: '8.9' }); diff --git a/server/sonar-web/src/main/js/app/styles/init/links.css b/server/sonar-web/src/main/js/app/styles/init/links.css index 9d7995d0d8f..dc4c7c56b5e 100644 --- a/server/sonar-web/src/main/js/app/styles/init/links.css +++ b/server/sonar-web/src/main/js/app/styles/init/links.css @@ -32,6 +32,11 @@ a:focus { border-bottom-color: var(--primary); } +a svg, +a img { + vertical-align: middle; +} + .link-no-underline { border-bottom-color: transparent !important; } diff --git a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx index f8d3e916aad..1a80ff210ed 100644 --- a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx +++ b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import MetaLink from '../../../app/components/nav/component/projectInformation/meta/MetaLink'; +import Link from '../../../components/common/Link'; import HelpTooltip from '../../../components/controls/HelpTooltip'; import DateFromNow from '../../../components/intl/DateFromNow'; import Level from '../../../components/ui/Level'; diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx index 38901794aac..668cb99c8e4 100644 --- a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx @@ -21,7 +21,7 @@ import { subDays } from 'date-fns'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import DateRangeInput from '../../../components/controls/DateRangeInput'; import Radio from '../../../components/controls/Radio'; import Suggestions from '../../../components/embed-docs-modal/Suggestions'; diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/AuditAppRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/AuditAppRenderer-test.tsx.snap index fa377d15b9c..db78b925ddd 100644 --- a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/AuditAppRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/AuditAppRenderer-test.tsx.snap @@ -34,7 +34,7 @@ exports[`should render correctly for Monthly housekeeping policy 1`] = ` values={ Object { "housekeeping": "audit_logs.housekeeping_policy.Monthly", - "link": <Link + "link": <ForwardRef(Link) to={ Object { "hash": "#auditLogs", @@ -44,7 +44,7 @@ exports[`should render correctly for Monthly housekeeping policy 1`] = ` } > audit_logs.page.description.link - </Link>, + </ForwardRef(Link)>, } } /> @@ -156,7 +156,7 @@ exports[`should render correctly for Trimestrial housekeeping policy 1`] = ` values={ Object { "housekeeping": "audit_logs.housekeeping_policy.Trimestrial", - "link": <Link + "link": <ForwardRef(Link) to={ Object { "hash": "#auditLogs", @@ -166,7 +166,7 @@ exports[`should render correctly for Trimestrial housekeeping policy 1`] = ` } > audit_logs.page.description.link - </Link>, + </ForwardRef(Link)>, } } /> @@ -290,7 +290,7 @@ exports[`should render correctly for Weekly housekeeping policy 1`] = ` values={ Object { "housekeeping": "audit_logs.housekeeping_policy.Weekly", - "link": <Link + "link": <ForwardRef(Link) to={ Object { "hash": "#auditLogs", @@ -300,7 +300,7 @@ exports[`should render correctly for Weekly housekeeping policy 1`] = ` } > audit_logs.page.description.link - </Link>, + </ForwardRef(Link)>, } } /> @@ -400,7 +400,7 @@ exports[`should render correctly for Yearly housekeeping policy 1`] = ` values={ Object { "housekeeping": "audit_logs.housekeeping_policy.Yearly", - "link": <Link + "link": <ForwardRef(Link) to={ Object { "hash": "#auditLogs", @@ -410,7 +410,7 @@ exports[`should render correctly for Yearly housekeeping policy 1`] = ` } > audit_logs.page.description.link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Header.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Header.tsx index fa7c2e92c3a..dd4cbe6f060 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Header.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Header.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { translate } from '../../../helpers/l10n'; import Workers from './Workers'; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/NoWorkersSupportPopup.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/NoWorkersSupportPopup.tsx index 4db3bfc749e..c471a76e5f8 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/NoWorkersSupportPopup.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/NoWorkersSupportPopup.tsx @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import Link from '../../../components/common/Link'; import { translate } from '../../../helpers/l10n'; export default function NoWorkersSupportPopup() { @@ -30,12 +31,11 @@ export default function NoWorkersSupportPopup() { {translate('background_tasks.add_more_workers.text')} </p> <p> - <a - href="https://www.sonarqube.org/trial-request/enterprise-edition/?referrer=sonarqube-background-tasks" - rel="noopener noreferrer" + <Link + to="https://www.sonarqube.org/trial-request/enterprise-edition/?referrer=sonarqube-background-tasks" target="_blank"> {translate('learn_more')} - </a> + </Link> </p> </> ); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx index f642e4521d5..8248a678513 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import BranchIcon from '../../../components/icons/BranchIcon'; import PullRequestIcon from '../../../components/icons/PullRequestIcon'; import QualifierIcon from '../../../components/icons/QualifierIcon'; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/NoWorkersSupportPopup-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/NoWorkersSupportPopup-test.tsx.snap index eecf3cafaa0..ad292a7ded2 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/NoWorkersSupportPopup-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/NoWorkersSupportPopup-test.tsx.snap @@ -15,13 +15,12 @@ exports[`should render correctly 1`] = ` background_tasks.add_more_workers.text </p> <p> - <a - href="https://www.sonarqube.org/trial-request/enterprise-edition/?referrer=sonarqube-background-tasks" - rel="noopener noreferrer" + <ForwardRef(Link) target="_blank" + to="https://www.sonarqube.org/trial-request/enterprise-edition/?referrer=sonarqube-background-tasks" > learn_more - </a> + </ForwardRef(Link)> </p> </Fragment> `; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap index 44c3899b20b..d10fe462edc 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap @@ -9,7 +9,7 @@ exports[`renders correctly 1`] = ` qualifier="TRK" /> </span> - <Link + <ForwardRef(Link) className="spacer-right" to={ Object { @@ -19,7 +19,7 @@ exports[`renders correctly 1`] = ` } > Foo - </Link> + </ForwardRef(Link)> <TaskType type="REPORT" /> @@ -31,7 +31,7 @@ exports[`renders correctly: branch 1`] = ` <BranchIcon className="little-spacer-right" /> - <Link + <ForwardRef(Link) className="spacer-right" to={ Object { @@ -57,7 +57,7 @@ exports[`renders correctly: branch 1`] = ` </span> feature </span> - </Link> + </ForwardRef(Link)> <TaskType type="REPORT" /> @@ -69,7 +69,7 @@ exports[`renders correctly: branch 2`] = ` <BranchIcon className="little-spacer-right" /> - <Link + <ForwardRef(Link) className="spacer-right" to={ Object { @@ -95,7 +95,7 @@ exports[`renders correctly: branch 2`] = ` </span> branch-6.7 </span> - </Link> + </ForwardRef(Link)> <TaskType type="REPORT" /> @@ -111,7 +111,7 @@ exports[`renders correctly: portfolio 1`] = ` qualifier="VW" /> </span> - <Link + <ForwardRef(Link) className="spacer-right" to={ Object { @@ -121,7 +121,7 @@ exports[`renders correctly: portfolio 1`] = ` } > Foo - </Link> + </ForwardRef(Link)> <TaskType type="REPORT" /> @@ -133,7 +133,7 @@ exports[`renders correctly: pull request 1`] = ` <PullRequestIcon className="little-spacer-right" /> - <Link + <ForwardRef(Link) className="spacer-right" to={ Object { @@ -158,7 +158,7 @@ exports[`renders correctly: pull request 1`] = ` </span> pr-89 </span> - </Link> + </ForwardRef(Link)> <TaskType type="REPORT" /> diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx index a22e7b7989a..164d1b1b2a2 100644 --- a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { colors } from '../../../app/theme'; +import Link from '../../../components/common/Link'; import BranchIcon from '../../../components/icons/BranchIcon'; import QualifierIcon from '../../../components/icons/QualifierIcon'; import { getBranchLikeQuery } from '../../../helpers/branch-like'; diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/__snapshots__/ComponentName-test.tsx.snap b/server/sonar-web/src/main/js/apps/code/components/__tests__/__snapshots__/ComponentName-test.tsx.snap index 0160ee7d449..46034a852f6 100644 --- a/server/sonar-web/src/main/js/apps/code/components/__tests__/__snapshots__/ComponentName-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/__snapshots__/ComponentName-test.tsx.snap @@ -169,7 +169,7 @@ exports[`#ComponentName should render correctly for files 2`] = ` foo:src/index.tsx" > - <Link + <ForwardRef(Link) className="display-inline-flex-center link-no-underline" to={ Object { @@ -186,7 +186,7 @@ foo:src/index.tsx" <span> index.tsx </span> - </Link> + </ForwardRef(Link)> </span> `; @@ -289,7 +289,7 @@ foo foo" > - <Link + <ForwardRef(Link) className="display-inline-flex-center link-no-underline" to={ Object { @@ -306,7 +306,7 @@ foo" <span> Foo </span> - </Link> + </ForwardRef(Link)> </span> `; @@ -322,7 +322,7 @@ foo foo" > - <Link + <ForwardRef(Link) className="display-inline-flex-center link-no-underline" to={ Object { @@ -339,7 +339,7 @@ foo" <span> Foo </span> - </Link> + </ForwardRef(Link)> </span> <span className="text-ellipsis spacer-left" @@ -366,7 +366,7 @@ exports[`#ComponentName should render correctly for refs 3`] = ` foo" > - <Link + <ForwardRef(Link) className="display-inline-flex-center link-no-underline" to={ Object { @@ -383,7 +383,7 @@ foo" <span> Foo </span> - </Link> + </ForwardRef(Link)> </span> <span className="spacer-left badge flex-1" diff --git a/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts b/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts index 781cf70cc05..32221bf8792 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts +++ b/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts @@ -177,7 +177,7 @@ it('should show rule advanced section with context', async () => { expect(screen.getByText('coding_rules.context.others.description.first')).toBeInTheDocument(); const productBoardLink = screen.getByRole('link', { - name: 'coding_rules.context.others.feedback_description.link' + name: 'opens_in_new_window coding_rules.context.others.feedback_description.link' }); expect(productBoardLink).toBeInTheDocument(); expect(productBoardLink).toHaveAttribute('target', '_blank'); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx index 569154d2109..7d3830b3b16 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx @@ -19,8 +19,8 @@ */ import { sortBy } from 'lodash'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { deleteRule, searchRules } from '../../../api/rules'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import ConfirmButton from '../../../components/controls/ConfirmButton'; import SeverityHelper from '../../../components/shared/SeverityHelper'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx index b2337639259..1a6a3ebd363 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx @@ -18,9 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { getFacet } from '../../../api/issues'; import withAppStateContext from '../../../app/components/app-state/withAppStateContext'; +import Link from '../../../components/common/Link'; import Tooltip from '../../../components/controls/Tooltip'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx index b0582542437..11059de2b43 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { ButtonLink } from '../../../components/controls/buttons'; import Dropdown from '../../../components/controls/Dropdown'; import HelpTooltip from '../../../components/controls/HelpTooltip'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx index 5d8a86d738a..0d621c4e925 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx @@ -19,9 +19,9 @@ */ import { filter } from 'lodash'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { activateRule, deactivateRule, Profile } from '../../../api/quality-profiles'; import InstanceMessage from '../../../components/common/InstanceMessage'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import ConfirmButton from '../../../components/controls/ConfirmButton'; import Tooltip from '../../../components/controls/Tooltip'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx index 28a19498e66..d873bec0ecd 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx @@ -19,8 +19,8 @@ */ import classNames from 'classnames'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { deactivateRule, Profile } from '../../../api/quality-profiles'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import ConfirmButton from '../../../components/controls/ConfirmButton'; import Tooltip from '../../../components/controls/Tooltip'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx index acfc1083c4a..f8ea100c9d4 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx @@ -19,8 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { deactivateRule } from '../../../../api/quality-profiles'; +import Link from '../../../../components/common/Link'; import { mockQualityProfile, mockRule } from '../../../../helpers/testMocks'; import { mockEvent, waitAndUpdate } from '../../../../helpers/testUtils'; import RuleListItem from '../RuleListItem'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleDetailsIssues-test.tsx.snap b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleDetailsIssues-test.tsx.snap index bdfbd11492e..4c6016c40b9 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleDetailsIssues-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleDetailsIssues-test.tsx.snap @@ -15,7 +15,7 @@ exports[`should fetch issues and render 1`] = ` className="little-spacer-left" > ( - <Link + <ForwardRef(Link) to={ Object { "pathname": "/issues", @@ -24,7 +24,7 @@ exports[`should fetch issues and render 1`] = ` } > 18 - </Link> + </ForwardRef(Link)> ) </span> </h2> @@ -51,7 +51,7 @@ exports[`should fetch issues and render 1`] = ` <td className="coding-rules-detail-list-parameters" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/issues", @@ -60,7 +60,7 @@ exports[`should fetch issues and render 1`] = ` } > 13 - </Link> + </ForwardRef(Link)> </td> </tr> <tr @@ -74,7 +74,7 @@ exports[`should fetch issues and render 1`] = ` <td className="coding-rules-detail-list-parameters" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/issues", @@ -83,7 +83,7 @@ exports[`should fetch issues and render 1`] = ` } > 5 - </Link> + </ForwardRef(Link)> </td> </tr> </tbody> diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleDetailsMeta-test.tsx.snap b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleDetailsMeta-test.tsx.snap index cbfba172d8a..4308e9f8eb1 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleDetailsMeta-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleDetailsMeta-test.tsx.snap @@ -15,7 +15,7 @@ exports[`should display right meta info 1`] = ` > squid:S1133 </span> - <Link + <ForwardRef(Link) className="coding-rules-detail-permalink link-no-underline spacer-left text-middle" title="permalink" to={ @@ -26,7 +26,7 @@ exports[`should display right meta info 1`] = ` } > <LinkIcon /> - </Link> + </ForwardRef(Link)> <SimilarRulesFilter onFilterChange={[MockFunction]} rule={ diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleListItem-test.tsx.snap b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleListItem-test.tsx.snap index 773efa6f1a9..2ae4d1df139 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleListItem-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleListItem-test.tsx.snap @@ -116,7 +116,7 @@ exports[`should render correctly: default 1`] = ` <div className="coding-rule-title" > - <Link + <ForwardRef(Link) className="link-no-underline" onClick={[Function]} to={ @@ -127,7 +127,7 @@ exports[`should render correctly: default 1`] = ` } > Use foo - </Link> + </ForwardRef(Link)> </div> </td> <td @@ -213,7 +213,7 @@ exports[`should render correctly: with activation 1`] = ` <div className="coding-rule-title" > - <Link + <ForwardRef(Link) className="link-no-underline" onClick={[Function]} to={ @@ -224,7 +224,7 @@ exports[`should render correctly: with activation 1`] = ` } > Use foo - </Link> + </ForwardRef(Link)> </div> </td> <td diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx index 3911ea503b2..73319f882d7 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import LanguageDistribution from '../../../components/charts/LanguageDistribution'; +import Link from '../../../components/common/Link'; import Tooltip from '../../../components/controls/Tooltip'; import HistoryIcon from '../../../components/icons/HistoryIcon'; import IssueTypeIcon from '../../../components/icons/IssueTypeIcon'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureHeader-test.tsx.snap b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureHeader-test.tsx.snap index 8235bbe62da..3e7a651341c 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureHeader-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureHeader-test.tsx.snap @@ -29,7 +29,7 @@ exports[`should render correctly 1`] = ` <Tooltip overlay="component_measures.show_metric_history" > - <Link + <ForwardRef(Link) className="js-show-history spacer-left button button-small" to={ Object { @@ -39,7 +39,7 @@ exports[`should render correctly 1`] = ` } > <HistoryIcon /> - </Link> + </ForwardRef(Link)> </Tooltip> </div> <div @@ -204,7 +204,7 @@ exports[`should work with measure without value 1`] = ` <Tooltip overlay="component_measures.show_metric_history" > - <Link + <ForwardRef(Link) className="js-show-history spacer-left button button-small" to={ Object { @@ -214,7 +214,7 @@ exports[`should work with measure without value 1`] = ` } > <HistoryIcon /> - </Link> + </ForwardRef(Link)> </Tooltip> </div> <div diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx index dc5030c9208..fa15cae3a51 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx @@ -18,9 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import OriginalBubbleChart from '../../../components/charts/BubbleChart'; import ColorRatingsLegend from '../../../components/charts/ColorRatingsLegend'; +import Link from '../../../components/common/Link'; import HelpTooltip from '../../../components/controls/HelpTooltip'; import { RATING_COLORS } from '../../../helpers/constants'; import { diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx index 585601da5a6..ec93e70f7fd 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx @@ -18,7 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link, To } from 'react-router-dom'; +import { To } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import BranchIcon from '../../../components/icons/BranchIcon'; import LinkIcon from '../../../components/icons/LinkIcon'; import QualifierIcon from '../../../components/icons/QualifierIcon'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx index 1465e2a1351..706051bd81a 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import { mockComponentMeasure, mockComponentMeasureEnhanced diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/BubbleChart-test.tsx.snap b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/BubbleChart-test.tsx.snap index 0a648d6f8a1..d9c90ef8efd 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/BubbleChart-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/BubbleChart-test.tsx.snap @@ -46,7 +46,7 @@ exports[`should render correctly: all on x=0 1`] = ` <div className="text-center small spacer-top spacer-bottom" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/component_measures", @@ -55,7 +55,7 @@ exports[`should render correctly: all on x=0 1`] = ` } > component_measures.overview.see_data_as_list - </Link> + </ForwardRef(Link)> </div> <BubbleChart displayXGrid={true} @@ -254,7 +254,7 @@ exports[`should render correctly: default 1`] = ` <div className="text-center small spacer-top spacer-bottom" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/component_measures", @@ -263,7 +263,7 @@ exports[`should render correctly: default 1`] = ` } > component_measures.overview.see_data_as_list - </Link> + </ForwardRef(Link)> </div> <BubbleChart displayXGrid={true} @@ -463,7 +463,7 @@ exports[`should render correctly: only showing first 500 files 1`] = ` <div className="text-center small spacer-top spacer-bottom" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/component_measures", @@ -472,7 +472,7 @@ exports[`should render correctly: only showing first 500 files 1`] = ` } > component_measures.overview.see_data_as_list - </Link> + </ForwardRef(Link)> </div> <BubbleChart displayXGrid={true} diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/ComponentCell-test.tsx.snap b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/ComponentCell-test.tsx.snap index 96fcb66989e..a7bb6a51d53 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/ComponentCell-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/ComponentCell-test.tsx.snap @@ -7,7 +7,7 @@ exports[`should render correctly for a "APP" root component and a component with <div className="text-ellipsis" > - <Link + <ForwardRef(Link) className="link-no-underline" id="component-measures-component-link-foo" to={ @@ -36,7 +36,7 @@ exports[`should render correctly for a "APP" root component and a component with develop </span> </span> - </Link> + </ForwardRef(Link)> </div> </td> `; @@ -48,7 +48,7 @@ exports[`should render correctly for a "APP" root component and a component with <div className="text-ellipsis" > - <Link + <ForwardRef(Link) className="link-no-underline" id="component-measures-component-link-foo" to={ @@ -74,7 +74,7 @@ exports[`should render correctly for a "APP" root component and a component with branches.main_branch </span> </span> - </Link> + </ForwardRef(Link)> </div> </td> `; @@ -86,7 +86,7 @@ exports[`should render correctly for a "TRK" root component and a component with <div className="text-ellipsis" > - <Link + <ForwardRef(Link) className="link-no-underline" id="component-measures-component-link-foo" to={ @@ -107,7 +107,7 @@ exports[`should render correctly for a "TRK" root component and a component with Foo </span> </span> - </Link> + </ForwardRef(Link)> </div> </td> `; @@ -119,7 +119,7 @@ exports[`should render correctly for a "TRK" root component and a component with <div className="text-ellipsis" > - <Link + <ForwardRef(Link) className="link-no-underline" id="component-measures-component-link-foo" to={ @@ -140,7 +140,7 @@ exports[`should render correctly for a "TRK" root component and a component with Foo </span> </span> - </Link> + </ForwardRef(Link)> </div> </td> `; @@ -152,7 +152,7 @@ exports[`should render correctly for a "VW" root component and a component with <div className="text-ellipsis" > - <Link + <ForwardRef(Link) className="link-no-underline" id="component-measures-component-link-foo" to={ @@ -181,7 +181,7 @@ exports[`should render correctly for a "VW" root component and a component with develop </span> </span> - </Link> + </ForwardRef(Link)> </div> </td> `; @@ -193,7 +193,7 @@ exports[`should render correctly for a "VW" root component and a component with <div className="text-ellipsis" > - <Link + <ForwardRef(Link) className="link-no-underline" id="component-measures-component-link-foo" to={ @@ -219,7 +219,7 @@ exports[`should render correctly for a "VW" root component and a component with branches.main_branch </span> </span> - </Link> + </ForwardRef(Link)> </div> </td> `; @@ -231,7 +231,7 @@ exports[`should render correctly: default 1`] = ` <div className="text-ellipsis" > - <Link + <ForwardRef(Link) className="link-no-underline" id="component-measures-component-link-foo:src/index.tsx" to={ @@ -258,7 +258,7 @@ exports[`should render correctly: default 1`] = ` index.tsx </span> </span> - </Link> + </ForwardRef(Link)> </div> </td> `; diff --git a/server/sonar-web/src/main/js/apps/create/project/AzurePersonalAccessTokenForm.tsx b/server/sonar-web/src/main/js/apps/create/project/AzurePersonalAccessTokenForm.tsx index 67ba28ef4aa..cb86bc63023 100644 --- a/server/sonar-web/src/main/js/apps/create/project/AzurePersonalAccessTokenForm.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/AzurePersonalAccessTokenForm.tsx @@ -20,9 +20,9 @@ import classNames from 'classnames'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; +import Link from '../../../components/common/Link'; import { SubmitButton } from '../../../components/controls/buttons'; import ValidationInput from '../../../components/controls/ValidationInput'; -import DetachIcon from '../../../components/icons/DetachIcon'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; import { translate } from '../../../helpers/l10n'; import { AlmSettingsInstance } from '../../../types/alm-settings'; @@ -72,16 +72,9 @@ export default function AzurePersonalAccessTokenForm(props: AzurePersonalAccessT defaultMessage={translate('onboarding.create_project.pat_help.instructions', alm)} values={{ link: url ? ( - <a - className="link-no-underline" - href={getAzurePatUrl(url)} - rel="noopener noreferrer" - target="_blank"> - <DetachIcon className="little-spacer-right" /> - <span> - {translate('onboarding.create_project.pat_help.instructions.link', alm)} - </span> - </a> + <Link className="link-no-underline" to={getAzurePatUrl(url)} target="_blank"> + {translate('onboarding.create_project.pat_help.instructions.link', alm)} + </Link> ) : ( translate('onboarding.create_project.pat_help.instructions.link', alm) ), diff --git a/server/sonar-web/src/main/js/apps/create/project/AzureProjectAccordion.tsx b/server/sonar-web/src/main/js/apps/create/project/AzureProjectAccordion.tsx index ec51beea670..e590fdbdbe1 100644 --- a/server/sonar-web/src/main/js/apps/create/project/AzureProjectAccordion.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/AzureProjectAccordion.tsx @@ -20,8 +20,8 @@ import classNames from 'classnames'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { colors } from '../../../app/theme'; +import Link from '../../../components/common/Link'; import BoxedGroupAccordion from '../../../components/controls/BoxedGroupAccordion'; import ListFooter from '../../../components/controls/ListFooter'; import Radio from '../../../components/controls/Radio'; diff --git a/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx b/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx index a7a424b32f4..214fa15ee87 100644 --- a/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import SearchBox from '../../../components/controls/SearchBox'; import { Alert } from '../../../components/ui/Alert'; diff --git a/server/sonar-web/src/main/js/apps/create/project/AzureProjectsList.tsx b/server/sonar-web/src/main/js/apps/create/project/AzureProjectsList.tsx index e8b222682c2..09e18f2efae 100644 --- a/server/sonar-web/src/main/js/apps/create/project/AzureProjectsList.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/AzureProjectsList.tsx @@ -20,7 +20,7 @@ import { uniqBy } from 'lodash'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import ListFooter from '../../../components/controls/ListFooter'; import { Alert } from '../../../components/ui/Alert'; import { translate, translateWithParameters } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudSearchForm.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudSearchForm.tsx index 03cb73fc033..de70b76174a 100644 --- a/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudSearchForm.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudSearchForm.tsx @@ -19,12 +19,11 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import SearchBox from '../../../components/controls/SearchBox'; import Tooltip from '../../../components/controls/Tooltip'; import CheckIcon from '../../../components/icons/CheckIcon'; -import DetachIcon from '../../../components/icons/DetachIcon'; import QualifierIcon from '../../../components/icons/QualifierIcon'; import { Alert } from '../../../components/ui/Alert'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; @@ -126,14 +125,12 @@ export default function BitbucketCloudSearchForm(props: BitbucketCloudSearchForm </Tooltip> </td> <td> - <a + <Link className="display-inline-flex-center big-spacer-right" - href={getRepositoryUrl(repository.workspace, repository.slug)} - rel="noopener noreferrer" + to={getRepositoryUrl(repository.workspace, repository.slug)} target="_blank"> - <DetachIcon className="little-spacer-right" /> {translate('onboarding.create_project.bitbucketcloud.link')} - </a> + </Link> </td> {repository.sqProjectKey ? ( <td> diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketImportRepositoryForm.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketImportRepositoryForm.tsx index d1a741729a7..5434db6d159 100644 --- a/server/sonar-web/src/main/js/apps/create/project/BitbucketImportRepositoryForm.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketImportRepositoryForm.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import SearchBox from '../../../components/controls/SearchBox'; import { Alert } from '../../../components/ui/Alert'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectAccordion.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectAccordion.tsx index 4bd638587d0..707f4d6415d 100644 --- a/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectAccordion.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectAccordion.tsx @@ -20,8 +20,8 @@ import classNames from 'classnames'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { colors } from '../../../app/theme'; +import Link from '../../../components/common/Link'; import BoxedGroupAccordion from '../../../components/controls/BoxedGroupAccordion'; import Radio from '../../../components/controls/Radio'; import CheckIcon from '../../../components/icons/CheckIcon'; diff --git a/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx b/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx index 7fbfedb3606..85503415407 100644 --- a/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx @@ -22,8 +22,8 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { colors } from '../../../app/theme'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import ListFooter from '../../../components/controls/ListFooter'; import Radio from '../../../components/controls/Radio'; diff --git a/server/sonar-web/src/main/js/apps/create/project/GitlabProjectSelectionForm.tsx b/server/sonar-web/src/main/js/apps/create/project/GitlabProjectSelectionForm.tsx index bdbcc5f93be..10719853aa5 100644 --- a/server/sonar-web/src/main/js/apps/create/project/GitlabProjectSelectionForm.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/GitlabProjectSelectionForm.tsx @@ -19,13 +19,12 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import ListFooter from '../../../components/controls/ListFooter'; import SearchBox from '../../../components/controls/SearchBox'; import Tooltip from '../../../components/controls/Tooltip'; import CheckIcon from '../../../components/icons/CheckIcon'; -import DetachIcon from '../../../components/icons/DetachIcon'; import QualifierIcon from '../../../components/icons/QualifierIcon'; import { Alert } from '../../../components/ui/Alert'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; @@ -123,14 +122,12 @@ export default function GitlabProjectSelectionForm(props: GitlabProjectSelection </Tooltip> </td> <td> - <a + <Link className="display-inline-flex-center big-spacer-right" - href={project.url} - rel="noopener noreferrer" + to={project.url} target="_blank"> - <DetachIcon className="little-spacer-right" /> {translate('onboarding.create_project.gitlab.link')} - </a> + </Link> </td> {project.sqProjectKey ? ( <td> diff --git a/server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx b/server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx index 821d2a1ed7f..296f7638bcc 100644 --- a/server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { Alert } from '../../../components/ui/Alert'; import { translate } from '../../../helpers/l10n'; import { getGlobalSettingsUrl } from '../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzurePersonalAccessTokenForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzurePersonalAccessTokenForm-test.tsx.snap index 685eb640c7e..0c3af3883bb 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzurePersonalAccessTokenForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzurePersonalAccessTokenForm-test.tsx.snap @@ -18,19 +18,13 @@ exports[`should render correctly: default 1`] = ` id="onboarding.create_project.pat_help.instructions" values={ Object { - "link": <a + "link": <ForwardRef(Link) className="link-no-underline" - href="http://www.example.com/_usersSettings/tokens" - rel="noopener noreferrer" target="_blank" + to="http://www.example.com/_usersSettings/tokens" > - <DetachIcon - className="little-spacer-right" - /> - <span> - onboarding.create_project.pat_help.instructions.link.azure - </span> - </a>, + onboarding.create_project.pat_help.instructions.link.azure + </ForwardRef(Link)>, "scope": <strong> <em> Code (Read & Write) @@ -94,19 +88,13 @@ exports[`should render correctly: submitting 1`] = ` id="onboarding.create_project.pat_help.instructions" values={ Object { - "link": <a + "link": <ForwardRef(Link) className="link-no-underline" - href="http://www.example.com/_usersSettings/tokens" - rel="noopener noreferrer" target="_blank" + to="http://www.example.com/_usersSettings/tokens" > - <DetachIcon - className="little-spacer-right" - /> - <span> - onboarding.create_project.pat_help.instructions.link.azure - </span> - </a>, + onboarding.create_project.pat_help.instructions.link.azure + </ForwardRef(Link)>, "scope": <strong> <em> Code (Read & Write) @@ -170,19 +158,13 @@ exports[`should render correctly: validation failed 1`] = ` id="onboarding.create_project.pat_help.instructions" values={ Object { - "link": <a + "link": <ForwardRef(Link) className="link-no-underline" - href="http://www.example.com/_usersSettings/tokens" - rel="noopener noreferrer" target="_blank" + to="http://www.example.com/_usersSettings/tokens" > - <DetachIcon - className="little-spacer-right" - /> - <span> - onboarding.create_project.pat_help.instructions.link.azure - </span> - </a>, + onboarding.create_project.pat_help.instructions.link.azure + </ForwardRef(Link)>, "scope": <strong> <em> Code (Read & Write) diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzureProjectAccordion-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzureProjectAccordion-test.tsx.snap index 85fc0eecdd7..c717c261d32 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzureProjectAccordion-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzureProjectAccordion-test.tsx.snap @@ -150,7 +150,7 @@ exports[`should render correctly: search results 1`] = ` <div className="little-spacer-bottom text-ellipsis" > - <Link + <ForwardRef(Link) title="SQ Name" to={ Object { @@ -160,7 +160,7 @@ exports[`should render correctly: search results 1`] = ` } > SQ Name - </Link> + </ForwardRef(Link)> </div> <em> onboarding.create_project.repository_imported @@ -230,7 +230,7 @@ exports[`should render correctly: with repositories 1`] = ` <div className="little-spacer-bottom text-ellipsis" > - <Link + <ForwardRef(Link) title="SQ Name" to={ Object { @@ -240,7 +240,7 @@ exports[`should render correctly: with repositories 1`] = ` } > SQ Name - </Link> + </ForwardRef(Link)> </div> <em> onboarding.create_project.repository_imported diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzureProjectCreateRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzureProjectCreateRenderer-test.tsx.snap index d39ae29d2d9..7b95f10bdf8 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzureProjectCreateRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzureProjectCreateRenderer-test.tsx.snap @@ -164,7 +164,7 @@ exports[`should render correctly: setting missing url, admin 1`] = ` values={ Object { "alm": "onboarding.alm.azure", - "url": <Link + "url": <ForwardRef(Link) to={ Object { "pathname": "/admin/settings", @@ -173,7 +173,7 @@ exports[`should render correctly: setting missing url, admin 1`] = ` } > settings.page - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzureProjectsList-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzureProjectsList-test.tsx.snap index 9cfa749b9f6..fa72ffea21b 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzureProjectsList-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/AzureProjectsList-test.tsx.snap @@ -35,7 +35,7 @@ exports[`should render correctly: empty 1`] = ` id="onboarding.create_project.azure.no_projects" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/projects/create", @@ -44,7 +44,7 @@ exports[`should render correctly: empty 1`] = ` } > onboarding.create_project.update_your_token - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/BitbucketCloudSearchForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/BitbucketCloudSearchForm-test.tsx.snap index bbaa3079000..a788d858535 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/BitbucketCloudSearchForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/BitbucketCloudSearchForm-test.tsx.snap @@ -10,7 +10,7 @@ exports[`Should render correctly 1`] = ` id="onboarding.create_project.bitbucketcloud.no_projects" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/projects/create", @@ -19,7 +19,7 @@ exports[`Should render correctly 1`] = ` } > onboarding.create_project.update_your_token - </Link>, + </ForwardRef(Link)>, } } /> @@ -67,17 +67,13 @@ exports[`Should render correctly: Importing 1`] = ` </Tooltip> </td> <td> - <a + <ForwardRef(Link) className="display-inline-flex-center big-spacer-right" - href="https://bitbucket.org/worksapce/import-slug" - rel="noopener noreferrer" target="_blank" + to="https://bitbucket.org/worksapce/import-slug" > - <DetachIcon - className="little-spacer-right" - /> onboarding.create_project.bitbucketcloud.link - </a> + </ForwardRef(Link)> </td> <td className="text-right" @@ -103,7 +99,7 @@ exports[`Should render correctly: Importing 1`] = ` <strong className="project-name display-inline-block text-ellipsis" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -116,7 +112,7 @@ exports[`Should render correctly: Importing 1`] = ` qualifier="TRK" /> Repo - </Link> + </ForwardRef(Link)> </strong> </Tooltip> <br /> @@ -131,17 +127,13 @@ exports[`Should render correctly: Importing 1`] = ` </Tooltip> </td> <td> - <a + <ForwardRef(Link) className="display-inline-flex-center big-spacer-right" - href="https://bitbucket.org/worksapce/project__repo" - rel="noopener noreferrer" target="_blank" + to="https://bitbucket.org/worksapce/project__repo" > - <DetachIcon - className="little-spacer-right" - /> onboarding.create_project.bitbucketcloud.link - </a> + </ForwardRef(Link)> </td> <td> <span @@ -213,17 +205,13 @@ exports[`Should render correctly: Loading more 1`] = ` </Tooltip> </td> <td> - <a + <ForwardRef(Link) className="display-inline-flex-center big-spacer-right" - href="https://bitbucket.org/worksapce/project__repo" - rel="noopener noreferrer" target="_blank" + to="https://bitbucket.org/worksapce/project__repo" > - <DetachIcon - className="little-spacer-right" - /> onboarding.create_project.bitbucketcloud.link - </a> + </ForwardRef(Link)> </td> <td className="text-right" @@ -329,17 +317,13 @@ exports[`Should render correctly: Show more 1`] = ` </Tooltip> </td> <td> - <a + <ForwardRef(Link) className="display-inline-flex-center big-spacer-right" - href="https://bitbucket.org/worksapce/project__repo" - rel="noopener noreferrer" target="_blank" + to="https://bitbucket.org/worksapce/project__repo" > - <DetachIcon - className="little-spacer-right" - /> onboarding.create_project.bitbucketcloud.link - </a> + </ForwardRef(Link)> </td> <td className="text-right" @@ -362,7 +346,7 @@ exports[`Should render correctly: Show more 1`] = ` <strong className="project-name display-inline-block text-ellipsis" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -375,7 +359,7 @@ exports[`Should render correctly: Show more 1`] = ` qualifier="TRK" /> Repo - </Link> + </ForwardRef(Link)> </strong> </Tooltip> <br /> @@ -390,17 +374,13 @@ exports[`Should render correctly: Show more 1`] = ` </Tooltip> </td> <td> - <a + <ForwardRef(Link) className="display-inline-flex-center big-spacer-right" - href="https://bitbucket.org/worksapce/project__repo" - rel="noopener noreferrer" target="_blank" + to="https://bitbucket.org/worksapce/project__repo" > - <DetachIcon - className="little-spacer-right" - /> onboarding.create_project.bitbucketcloud.link - </a> + </ForwardRef(Link)> </td> <td> <span @@ -472,17 +452,13 @@ exports[`Should render correctly: Show no more 1`] = ` </Tooltip> </td> <td> - <a + <ForwardRef(Link) className="display-inline-flex-center big-spacer-right" - href="https://bitbucket.org/worksapce/project__repo" - rel="noopener noreferrer" target="_blank" + to="https://bitbucket.org/worksapce/project__repo" > - <DetachIcon - className="little-spacer-right" - /> onboarding.create_project.bitbucketcloud.link - </a> + </ForwardRef(Link)> </td> <td className="text-right" diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/BitbucketImportRepositoryForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/BitbucketImportRepositoryForm-test.tsx.snap index 171179efbaf..8292bfe2bba 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/BitbucketImportRepositoryForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/BitbucketImportRepositoryForm-test.tsx.snap @@ -61,7 +61,7 @@ exports[`should render correctly: no projects 1`] = ` id="onboarding.create_project.no_bbs_projects" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/projects/create", @@ -70,7 +70,7 @@ exports[`should render correctly: no projects 1`] = ` } > onboarding.create_project.update_your_token - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/BitbucketProjectAccordion-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/BitbucketProjectAccordion-test.tsx.snap index bbcf7b5ecbe..65186535bcb 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/BitbucketProjectAccordion-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/BitbucketProjectAccordion-test.tsx.snap @@ -59,7 +59,7 @@ exports[`should render correctly: default 1`] = ` <strong title="Bar" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -68,7 +68,7 @@ exports[`should render correctly: default 1`] = ` } > Bar - </Link> + </ForwardRef(Link)> </strong> </div> <em> @@ -126,7 +126,7 @@ exports[`should render correctly: disable options 1`] = ` <strong title="Bar" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -135,7 +135,7 @@ exports[`should render correctly: disable options 1`] = ` } > Bar - </Link> + </ForwardRef(Link)> </strong> </div> <em> @@ -193,7 +193,7 @@ exports[`should render correctly: no click handler 1`] = ` <strong title="Bar" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -202,7 +202,7 @@ exports[`should render correctly: no click handler 1`] = ` } > Bar - </Link> + </ForwardRef(Link)> </strong> </div> <em> @@ -260,7 +260,7 @@ exports[`should render correctly: no project info 1`] = ` <strong title="Bar" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -269,7 +269,7 @@ exports[`should render correctly: no project info 1`] = ` } > Bar - </Link> + </ForwardRef(Link)> </strong> </div> <em> @@ -303,7 +303,7 @@ exports[`should render correctly: no repos 1`] = ` id="onboarding.create_project.no_bbs_repos" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/projects/create", @@ -312,7 +312,7 @@ exports[`should render correctly: no repos 1`] = ` } > onboarding.create_project.update_your_token - </Link>, + </ForwardRef(Link)>, } } /> @@ -367,7 +367,7 @@ exports[`should render correctly: not showing all repos 1`] = ` <strong title="Bar" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -376,7 +376,7 @@ exports[`should render correctly: not showing all repos 1`] = ` } > Bar - </Link> + </ForwardRef(Link)> </strong> </div> <em> @@ -439,7 +439,7 @@ exports[`should render correctly: selected repo 1`] = ` <strong title="Bar" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -448,7 +448,7 @@ exports[`should render correctly: selected repo 1`] = ` } > Bar - </Link> + </ForwardRef(Link)> </strong> </div> <em> diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitHubProjectCreateRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitHubProjectCreateRenderer-test.tsx.snap index 8179e528969..c47fef67a68 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitHubProjectCreateRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitHubProjectCreateRenderer-test.tsx.snap @@ -111,11 +111,11 @@ exports[`should render correctly: error for admin 1`] = ` id="onboarding.create_project.github.warning.message_admin" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to="/admin/settings?category=almintegration" > onboarding.create_project.github.warning.message_admin.link - </Link>, + </ForwardRef(Link)>, } } /> @@ -371,7 +371,7 @@ exports[`should render correctly: repositories 1`] = ` <div className="display-flex-center max-width-100" > - <Link + <ForwardRef(Link) className="display-flex-center max-width-60" to={ Object { @@ -389,7 +389,7 @@ exports[`should render correctly: repositories 1`] = ` > repository 1 </span> - </Link> + </ForwardRef(Link)> <em className="display-flex-center small big-spacer-left flex-0" > diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitlabProjectSelectionForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitlabProjectSelectionForm-test.tsx.snap index daa8b66ab26..35a35f027d0 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitlabProjectSelectionForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/GitlabProjectSelectionForm-test.tsx.snap @@ -41,17 +41,13 @@ exports[`should render correctly: importing 1`] = ` </Tooltip> </td> <td> - <a + <ForwardRef(Link) className="display-inline-flex-center big-spacer-right" - href="https://gitlab.company.com/best-projects/awesome-project-exclamation" - rel="noopener noreferrer" target="_blank" + to="https://gitlab.company.com/best-projects/awesome-project-exclamation" > - <DetachIcon - className="little-spacer-right" - /> onboarding.create_project.gitlab.link - </a> + </ForwardRef(Link)> </td> <td className="text-right" @@ -74,7 +70,7 @@ exports[`should render correctly: importing 1`] = ` <strong className="project-name display-inline-block text-ellipsis" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -87,7 +83,7 @@ exports[`should render correctly: importing 1`] = ` qualifier="TRK" /> Already Imported - </Link> + </ForwardRef(Link)> </strong> </Tooltip> <br /> @@ -102,17 +98,13 @@ exports[`should render correctly: importing 1`] = ` </Tooltip> </td> <td> - <a + <ForwardRef(Link) className="display-inline-flex-center big-spacer-right" - href="https://gitlab.company.com/best-projects/awesome-project-exclamation" - rel="noopener noreferrer" target="_blank" + to="https://gitlab.company.com/best-projects/awesome-project-exclamation" > - <DetachIcon - className="little-spacer-right" - /> onboarding.create_project.gitlab.link - </a> + </ForwardRef(Link)> </td> <td> <span @@ -148,7 +140,7 @@ exports[`should render correctly: no projects 1`] = ` id="onboarding.create_project.gitlab.no_projects" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/projects/create", @@ -157,7 +149,7 @@ exports[`should render correctly: no projects 1`] = ` } > onboarding.create_project.update_your_token - </Link>, + </ForwardRef(Link)>, } } /> @@ -232,17 +224,13 @@ exports[`should render correctly: projects 1`] = ` </Tooltip> </td> <td> - <a + <ForwardRef(Link) className="display-inline-flex-center big-spacer-right" - href="https://gitlab.company.com/best-projects/awesome-project-exclamation" - rel="noopener noreferrer" target="_blank" + to="https://gitlab.company.com/best-projects/awesome-project-exclamation" > - <DetachIcon - className="little-spacer-right" - /> onboarding.create_project.gitlab.link - </a> + </ForwardRef(Link)> </td> <td className="text-right" @@ -265,7 +253,7 @@ exports[`should render correctly: projects 1`] = ` <strong className="project-name display-inline-block text-ellipsis" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -278,7 +266,7 @@ exports[`should render correctly: projects 1`] = ` qualifier="TRK" /> Already Imported - </Link> + </ForwardRef(Link)> </strong> </Tooltip> <br /> @@ -293,17 +281,13 @@ exports[`should render correctly: projects 1`] = ` </Tooltip> </td> <td> - <a + <ForwardRef(Link) className="display-inline-flex-center big-spacer-right" - href="https://gitlab.company.com/best-projects/awesome-project-exclamation" - rel="noopener noreferrer" target="_blank" + to="https://gitlab.company.com/best-projects/awesome-project-exclamation" > - <DetachIcon - className="little-spacer-right" - /> onboarding.create_project.gitlab.link - </a> + </ForwardRef(Link)> </td> <td> <span @@ -339,7 +323,7 @@ exports[`should render correctly: undefined projects 1`] = ` id="onboarding.create_project.gitlab.no_projects" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/projects/create", @@ -348,7 +332,7 @@ exports[`should render correctly: undefined projects 1`] = ` } > onboarding.create_project.update_your_token - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/WrongBindingCountAlert-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/WrongBindingCountAlert-test.tsx.snap index 7dff8982253..a1b89ceab0e 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/WrongBindingCountAlert-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/WrongBindingCountAlert-test.tsx.snap @@ -26,7 +26,7 @@ exports[`should render correctly: for admin 1`] = ` values={ Object { "alm": "onboarding.alm.bitbucket", - "url": <Link + "url": <ForwardRef(Link) to={ Object { "pathname": "/admin/settings", @@ -35,7 +35,7 @@ exports[`should render correctly: for admin 1`] = ` } > settings.page - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/documentation/components/App.tsx b/server/sonar-web/src/main/js/apps/documentation/components/App.tsx index 05d14b82c1c..7834ae8612a 100644 --- a/server/sonar-web/src/main/js/apps/documentation/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/documentation/components/App.tsx @@ -21,11 +21,12 @@ import * as navigationTreeSonarQube from 'Docs/../static/SonarQubeNavigationTree import { DocNavigationItem } from 'Docs/@types/types'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; -import { Link, useLocation, useParams } from 'react-router-dom'; +import { useLocation, useParams } from 'react-router-dom'; import { getInstalledPlugins } from '../../../api/plugins'; import { getPluginStaticFileContent } from '../../../api/static'; import NotFound from '../../../app/components/NotFound'; import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; +import Link from '../../../components/common/Link'; import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper'; import DocMarkdownBlock from '../../../components/docs/DocMarkdownBlock'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; diff --git a/server/sonar-web/src/main/js/apps/documentation/components/MenuItem.tsx b/server/sonar-web/src/main/js/apps/documentation/components/MenuItem.tsx index 1e9245acbed..e3fcf7f5498 100644 --- a/server/sonar-web/src/main/js/apps/documentation/components/MenuItem.tsx +++ b/server/sonar-web/src/main/js/apps/documentation/components/MenuItem.tsx @@ -19,7 +19,7 @@ */ import classNames from 'classnames'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { testPathAgainstUrl } from '../navTreeUtils'; import { DocumentationEntry } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/documentation/components/SearchResultEntry.tsx b/server/sonar-web/src/main/js/apps/documentation/components/SearchResultEntry.tsx index 6490f365a16..f563d5300aa 100644 --- a/server/sonar-web/src/main/js/apps/documentation/components/SearchResultEntry.tsx +++ b/server/sonar-web/src/main/js/apps/documentation/components/SearchResultEntry.tsx @@ -19,7 +19,7 @@ */ import classNames from 'classnames'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { Dict } from '../../../types/types'; import { cutWords, DocumentationEntry, highlightMarks } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/documentation/components/__tests__/__snapshots__/App-test.tsx.snap b/server/sonar-web/src/main/js/apps/documentation/components/__tests__/__snapshots__/App-test.tsx.snap index a27c118ffa2..690037a28e2 100644 --- a/server/sonar-web/src/main/js/apps/documentation/components/__tests__/__snapshots__/App-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/documentation/components/__tests__/__snapshots__/App-test.tsx.snap @@ -68,13 +68,13 @@ exports[`should render correctly for SonarQube 2`] = ` label="documentation.skip_to_nav" weight={10} /> - <Link + <ForwardRef(Link) to="/documentation/" > <h1> documentation.page </h1> - </Link> + </ForwardRef(Link)> </div> <Sidebar navigation={ diff --git a/server/sonar-web/src/main/js/apps/documentation/components/__tests__/__snapshots__/MenuItem-test.tsx.snap b/server/sonar-web/src/main/js/apps/documentation/components/__tests__/__snapshots__/MenuItem-test.tsx.snap index 73eca5dd152..6eb967c4ed3 100644 --- a/server/sonar-web/src/main/js/apps/documentation/components/__tests__/__snapshots__/MenuItem-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/documentation/components/__tests__/__snapshots__/MenuItem-test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should not render a high depth differently than a depth of 3 1`] = ` -<Link +<ForwardRef(Link) className="list-group-item depth-3" key="/bar" to="/documentation/bar" @@ -9,11 +9,11 @@ exports[`should not render a high depth differently than a depth of 3 1`] = ` <h3 className="list-group-item-heading" /> -</Link> +</ForwardRef(Link)> `; exports[`should render correctly 1`] = ` -<Link +<ForwardRef(Link) className="list-group-item" key="/bar" to="/documentation/bar" @@ -21,11 +21,11 @@ exports[`should render correctly 1`] = ` <h3 className="list-group-item-heading" /> -</Link> +</ForwardRef(Link)> `; exports[`should render correctly if the current node matches the splat 1`] = ` -<Link +<ForwardRef(Link) className="list-group-item active" key="/bar" to="/documentation/bar" @@ -33,5 +33,5 @@ exports[`should render correctly if the current node matches the splat 1`] = ` <h3 className="list-group-item-heading" /> -</Link> +</ForwardRef(Link)> `; diff --git a/server/sonar-web/src/main/js/apps/documentation/components/__tests__/__snapshots__/SearchResultEntry-test.tsx.snap b/server/sonar-web/src/main/js/apps/documentation/components/__tests__/__snapshots__/SearchResultEntry-test.tsx.snap index 2a50912a76b..9537e85112a 100644 --- a/server/sonar-web/src/main/js/apps/documentation/components/__tests__/__snapshots__/SearchResultEntry-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/documentation/components/__tests__/__snapshots__/SearchResultEntry-test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`SearchResultEntry should render 1`] = ` -<Link +<ForwardRef(Link) className="list-group-item active" to="/documentation/foo/bar" > @@ -39,7 +39,7 @@ exports[`SearchResultEntry should render 1`] = ` } } /> -</Link> +</ForwardRef(Link)> `; exports[`SearchResultText should correctly extract exact matches 1`] = ` diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx index 630c044e89f..f3fa73c8014 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { setIssueAssignee } from '../../../api/issues'; +import Link from '../../../components/common/Link'; import LinkIcon from '../../../components/icons/LinkIcon'; import { updateIssue } from '../../../components/issue/actions'; import IssueActionsBar from '../../../components/issue/components/IssueActionsBar'; 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 16672277108..e5695f6ec99 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 @@ -19,7 +19,7 @@ */ import classNames from 'classnames'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { ButtonIcon } from '../../../components/controls/buttons'; import { ClipboardIconButton } from '../../../components/controls/clipboard'; import ExpandSnippetIcon from '../../../components/icons/ExpandSnippetIcon'; diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/IssueSourceViewerHeader-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/IssueSourceViewerHeader-test.tsx.snap index db4633e9607..da1a9623544 100644 --- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/IssueSourceViewerHeader-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/IssueSourceViewerHeader-test.tsx.snap @@ -54,7 +54,7 @@ exports[`should render correctly 1`] = ` <div className="flex-0 big-spacer-left" > - <Link + <ForwardRef(Link) to={ Object { "hash": "", @@ -64,7 +64,7 @@ exports[`should render correctly 1`] = ` } > source_viewer.view_all_issues - </Link> + </ForwardRef(Link)> </div> <DeferredSpinner className="little-spacer-right" @@ -132,7 +132,7 @@ exports[`should render correctly: no link to project 1`] = ` <div className="flex-0 big-spacer-left" > - <Link + <ForwardRef(Link) to={ Object { "hash": "", @@ -142,7 +142,7 @@ exports[`should render correctly: no link to project 1`] = ` } > source_viewer.view_all_issues - </Link> + </ForwardRef(Link)> </div> <DeferredSpinner className="little-spacer-right" @@ -199,7 +199,7 @@ exports[`should render correctly: no project name 1`] = ` <div className="flex-0 big-spacer-left" > - <Link + <ForwardRef(Link) to={ Object { "hash": "", @@ -209,7 +209,7 @@ exports[`should render correctly: no project name 1`] = ` } > source_viewer.view_all_issues - </Link> + </ForwardRef(Link)> </div> <DeferredSpinner className="little-spacer-right" diff --git a/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx b/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx index 447c8510fec..7b943cf2000 100644 --- a/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx @@ -23,6 +23,7 @@ import { Helmet } from 'react-helmet-async'; import { FormattedMessage } from 'react-intl'; import { getMigrationStatus, getSystemStatus, migrateDatabase } from '../../../api/system'; import InstanceMessage from '../../../components/common/InstanceMessage'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import DateFromNow from '../../../components/intl/DateFromNow'; import TimeFormatter from '../../../components/intl/TimeFormatter'; @@ -163,7 +164,7 @@ export default class App extends React.PureComponent<Props, State> { {translate('maintenance.all_systems_opetational')} </p> <p className="maintenance-text text-center"> - <a href={getBaseUrl() + '/'}>{translate('layout.home')}</a> + <Link to={getBaseUrl() + '/'}>{translate('layout.home')}</Link> </p> </> )} @@ -204,12 +205,11 @@ export default class App extends React.PureComponent<Props, State> { id="maintenance.sonarqube_is_under_maintenance.1" values={{ link: ( - <a - href="https://www.sonarlint.org/?referrer=sonarqube-maintenance" - target="_blank" - rel="noopener noreferrer"> + <Link + to="https://www.sonarlint.org/?referrer=sonarqube-maintenance" + target="_blank"> {translate('maintenance.sonarqube_is_under_maintenance_link.1')} - </a> + </Link> ) }} /> @@ -220,12 +220,11 @@ export default class App extends React.PureComponent<Props, State> { id="maintenance.sonarqube_is_under_maintenance.2" values={{ link: ( - <a - href="https://redirect.sonarsource.com/doc/upgrading.html" - target="_blank" - rel="noopener noreferrer"> + <Link + to="https://redirect.sonarsource.com/doc/upgrading.html" + target="_blank"> {translate('maintenance.sonarqube_is_under_maintenance_link.2')} - </a> + </Link> ) }} /> @@ -239,7 +238,7 @@ export default class App extends React.PureComponent<Props, State> { {translate('maintenance.database_is_up_to_date')} </h1> <p className="maintenance-text text-center"> - <a href={getBaseUrl() + '/'}>{translate('layout.home')}</a> + <Link to={getBaseUrl() + '/'}>{translate('layout.home')}</Link> </p> </> )} @@ -295,7 +294,7 @@ export default class App extends React.PureComponent<Props, State> { {translate('maintenance.database_is_up_to_date')} </h1> <p className="maintenance-text text-center"> - <a href={getBaseUrl() + '/'}>{translate('layout.home')}</a> + <Link to={getBaseUrl() + '/'}>{translate('layout.home')}</Link> </p> </> )} diff --git a/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/__snapshots__/App-test.tsx.snap b/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/__snapshots__/App-test.tsx.snap index 478c483d9a4..0dc87dd0165 100644 --- a/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/__snapshots__/App-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/__snapshots__/App-test.tsx.snap @@ -31,13 +31,12 @@ exports[`Maintenance Page should render DB_MIGRATION_NEEDED status 1`] = ` id="maintenance.sonarqube_is_under_maintenance.1" values={ Object { - "link": <a - href="https://www.sonarlint.org/?referrer=sonarqube-maintenance" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="https://www.sonarlint.org/?referrer=sonarqube-maintenance" > maintenance.sonarqube_is_under_maintenance_link.1 - </a>, + </ForwardRef(Link)>, } } /> @@ -50,13 +49,12 @@ exports[`Maintenance Page should render DB_MIGRATION_NEEDED status 1`] = ` id="maintenance.sonarqube_is_under_maintenance.2" values={ Object { - "link": <a - href="https://redirect.sonarsource.com/doc/upgrading.html" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="https://redirect.sonarsource.com/doc/upgrading.html" > maintenance.sonarqube_is_under_maintenance_link.2 - </a>, + </ForwardRef(Link)>, } } /> @@ -97,13 +95,12 @@ exports[`Maintenance Page should render DB_MIGRATION_RUNNING status 1`] = ` id="maintenance.sonarqube_is_under_maintenance.1" values={ Object { - "link": <a - href="https://www.sonarlint.org/?referrer=sonarqube-maintenance" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="https://www.sonarlint.org/?referrer=sonarqube-maintenance" > maintenance.sonarqube_is_under_maintenance_link.1 - </a>, + </ForwardRef(Link)>, } } /> @@ -116,13 +113,12 @@ exports[`Maintenance Page should render DB_MIGRATION_RUNNING status 1`] = ` id="maintenance.sonarqube_is_under_maintenance.2" values={ Object { - "link": <a - href="https://redirect.sonarsource.com/doc/upgrading.html" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="https://redirect.sonarsource.com/doc/upgrading.html" > maintenance.sonarqube_is_under_maintenance_link.2 - </a>, + </ForwardRef(Link)>, } } /> @@ -282,11 +278,11 @@ exports[`Maintenance Page should render UP status 1`] = ` <p className="maintenance-text text-center" > - <a - href="/" + <ForwardRef(Link) + to="/" > layout.home - </a> + </ForwardRef(Link)> </p> </div> </div> @@ -348,11 +344,11 @@ exports[`Setup Page should render MIGRATION_SUCCEEDED state 1`] = ` <p className="maintenance-text text-center" > - <a - href="/" + <ForwardRef(Link) + to="/" > layout.home - </a> + </ForwardRef(Link)> </p> </div> </div> @@ -383,11 +379,11 @@ exports[`Setup Page should render NO_MIGRATION state 1`] = ` <p className="maintenance-text text-center" > - <a - href="/" + <ForwardRef(Link) + to="/" > layout.home - </a> + </ForwardRef(Link)> </p> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/marketplace/App.tsx b/server/sonar-web/src/main/js/apps/marketplace/App.tsx index debe1da43a7..2ce22d60b0a 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/App.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/App.tsx @@ -21,7 +21,6 @@ import { sortBy, uniqBy } from 'lodash'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { getAvailablePlugins, getInstalledPlugins, @@ -29,6 +28,7 @@ import { getPluginUpdates } from '../../api/plugins'; import { getValues, setSimpleSettingValue } from '../../api/settings'; +import Link from '../../components/common/Link'; import Suggestions from '../../components/embed-docs-modal/Suggestions'; import { Location, Router, withRouter } from '../../components/hoc/withRouter'; import { Alert } from '../../components/ui/Alert'; diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/App-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/App-test.tsx.snap index f839316faff..dfe9f4507b0 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/App-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/__snapshots__/App-test.tsx.snap @@ -43,12 +43,12 @@ exports[`should render correctly: loaded 1`] = ` id="marketplace.page.plugins.description2" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/instance-administration/marketplace/" > marketplace.page.plugins.description2.link - </Link>, + </ForwardRef(Link)>, } } /> @@ -141,12 +141,12 @@ exports[`should render correctly: loading 1`] = ` id="marketplace.page.plugins.description2" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/instance-administration/marketplace/" > marketplace.page.plugins.description2.link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx index 56882029a15..4336f3090f4 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { ResetButtonLink } from '../../../components/controls/buttons'; import Modal from '../../../components/controls/Modal'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx index 4ced6763e33..19f4ce99a1b 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx @@ -19,6 +19,7 @@ */ import * as React from 'react'; import { installPlugin, uninstallPlugin, updatePlugin } from '../../../api/plugins'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import Checkbox from '../../../components/controls/Checkbox'; import Tooltip from '../../../components/controls/Tooltip'; @@ -81,9 +82,11 @@ export default class PluginActions extends React.PureComponent<Props, State> { <p className="little-spacer-bottom"> {translate('marketplace.available_under_commercial_license')} </p> - <a href={plugin.homepageUrl} target="_blank" rel="noopener noreferrer"> - {translate('marketplace.learn_more')} - </a> + {plugin.homepageUrl && ( + <Link to={plugin.homepageUrl} target="_blank"> + {translate('marketplace.learn_more')} + </Link> + )} </div> )} {isInstalledPlugin(plugin) && ( diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginActions-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginActions-test.tsx.snap index d5a6548367e..15853674d26 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginActions-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginActions-test.tsx.snap @@ -54,12 +54,6 @@ exports[`should render available plugin correctly 2`] = ` > marketplace.available_under_commercial_license </p> - <a - rel="noopener noreferrer" - target="_blank" - > - marketplace.learn_more - </a> </div> </div> `; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx b/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx index cbb88c81447..cde368eb107 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx @@ -19,8 +19,8 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext'; +import Link from '../../../components/common/Link'; import DismissableAlert from '../../../components/ui/DismissableAlert'; import { translate } from '../../../helpers/l10n'; import { queryToSearch } from '../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx index 7e58f648703..b377671d51f 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { getBranchLikeQuery } from '../../../helpers/branch-like'; import { translate } from '../../../helpers/l10n'; import { getBaseUrl } from '../../../helpers/system'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx index 959649c2057..76e9ea22aa1 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx @@ -60,11 +60,11 @@ it('should render the default message', () => { id="overview.measures.empty_link" values={ Object { - "learn_more_link": <Link + "learn_more_link": <ForwardRef(Link) to="/documentation/user-guide/clean-as-you-code/" > learn_more - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/FirstAnalysisNextStepsNotif-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/FirstAnalysisNextStepsNotif-test.tsx.snap index c16bf79e93d..76e429a85c8 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/FirstAnalysisNextStepsNotif-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/FirstAnalysisNextStepsNotif-test.tsx.snap @@ -10,7 +10,7 @@ exports[`should render correctly: show prompt to configure CI 1`] = ` id="overview.project.next_steps.set_up_ci" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/tutorials", @@ -19,7 +19,7 @@ exports[`should render correctly: show prompt to configure CI 1`] = ` } > overview.project.next_steps.links.set_up_ci - </Link>, + </ForwardRef(Link)>, } } /> @@ -36,7 +36,7 @@ exports[`should render correctly: show prompt to configure PR decoration + CI, p id="overview.project.next_steps.set_up_pr_deco_and_ci.admin" values={ Object { - "link_ci": <Link + "link_ci": <ForwardRef(Link) to={ Object { "pathname": "/tutorials", @@ -45,8 +45,8 @@ exports[`should render correctly: show prompt to configure PR decoration + CI, p } > overview.project.next_steps.links.set_up_ci - </Link>, - "link_project_settings": <Link + </ForwardRef(Link)>, + "link_project_settings": <ForwardRef(Link) to={ Object { "pathname": "/project/settings", @@ -55,7 +55,7 @@ exports[`should render correctly: show prompt to configure PR decoration + CI, p } > overview.project.next_steps.links.project_settings - </Link>, + </ForwardRef(Link)>, } } /> @@ -72,7 +72,7 @@ exports[`should render correctly: show prompt to configure PR decoration + CI, r id="overview.project.next_steps.set_up_pr_deco_and_ci" values={ Object { - "link_ci": <Link + "link_ci": <ForwardRef(Link) to={ Object { "pathname": "/tutorials", @@ -81,7 +81,7 @@ exports[`should render correctly: show prompt to configure PR decoration + CI, r } > overview.project.next_steps.links.set_up_ci - </Link>, + </ForwardRef(Link)>, } } /> @@ -98,7 +98,7 @@ exports[`should render correctly: show prompt to configure PR decoration, projec id="overview.project.next_steps.set_up_pr_deco.admin" values={ Object { - "link_project_settings": <Link + "link_project_settings": <ForwardRef(Link) to={ Object { "pathname": "/project/settings", @@ -107,7 +107,7 @@ exports[`should render correctly: show prompt to configure PR decoration, projec } > overview.project.next_steps.links.project_settings - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelNoNewCode-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelNoNewCode-test.tsx.snap index 17a5cf7abcc..7929a930024 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelNoNewCode-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/MeasuresPanelNoNewCode-test.tsx.snap @@ -34,11 +34,11 @@ exports[`should render "bad code setting" explanation: no link 1`] = ` id="overview.measures.empty_link" values={ Object { - "learn_more_link": <Link + "learn_more_link": <ForwardRef(Link) to="/documentation/user-guide/clean-as-you-code/" > learn_more - </Link>, + </ForwardRef(Link)>, } } /> @@ -81,11 +81,11 @@ exports[`should render "bad code setting" explanation: with link 1`] = ` id="overview.measures.empty_link" values={ Object { - "learn_more_link": <Link + "learn_more_link": <ForwardRef(Link) to="/documentation/user-guide/clean-as-you-code/" > learn_more - </Link>, + </ForwardRef(Link)>, } } /> @@ -160,11 +160,11 @@ exports[`should render the default message 6`] = ` id="overview.measures.empty_link" values={ Object { - "learn_more_link": <Link + "learn_more_link": <ForwardRef(Link) to="/documentation/user-guide/clean-as-you-code/" > learn_more - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx b/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx index 0c47a3e1e57..fecd47bd0f5 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import HelpTooltip from '../../../components/controls/HelpTooltip'; import { getLeakValue } from '../../../components/measure/utils'; import { getBranchLikeQuery } from '../../../helpers/branch-like'; diff --git a/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx b/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx index b62b5fa043f..d9335143d60 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx @@ -19,7 +19,8 @@ */ import classNames from 'classnames'; import * as React from 'react'; -import { Link, Path } from 'react-router-dom'; +import { Path } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import IssueTypeIcon from '../../../components/icons/IssueTypeIcon'; import Measure from '../../../components/measure/Measure'; import DrilldownLink from '../../../components/shared/DrilldownLink'; diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/IssueLabel-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/IssueLabel-test.tsx.snap index ebba3879584..335b5497f4b 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/IssueLabel-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/IssueLabel-test.tsx.snap @@ -2,7 +2,7 @@ exports[`should render correctly for bugs 1`] = ` <Fragment> - <Link + <ForwardRef(Link) aria-label="overview.see_list_of_x_y_issues.1.0.metric.bugs.name" className="overview-measures-value text-light" to={ @@ -14,7 +14,7 @@ exports[`should render correctly for bugs 1`] = ` } > 1 - </Link> + </ForwardRef(Link)> <BugIcon className="big-spacer-left little-spacer-right" /> @@ -24,7 +24,7 @@ exports[`should render correctly for bugs 1`] = ` exports[`should render correctly for bugs 2`] = ` <Fragment> - <Link + <ForwardRef(Link) aria-label="overview.see_list_of_x_y_issues.1.0.metric.new_bugs.name" className="overview-measures-value text-light" to={ @@ -36,7 +36,7 @@ exports[`should render correctly for bugs 2`] = ` } > 1 - </Link> + </ForwardRef(Link)> <BugIcon className="big-spacer-left little-spacer-right" /> @@ -46,7 +46,7 @@ exports[`should render correctly for bugs 2`] = ` exports[`should render correctly for code smells 1`] = ` <Fragment> - <Link + <ForwardRef(Link) aria-label="overview.see_list_of_x_y_issues.1.0.metric.code_smells.name" className="overview-measures-value text-light" to={ @@ -58,7 +58,7 @@ exports[`should render correctly for code smells 1`] = ` } > 1 - </Link> + </ForwardRef(Link)> <CodeSmellIcon className="big-spacer-left little-spacer-right" /> @@ -68,7 +68,7 @@ exports[`should render correctly for code smells 1`] = ` exports[`should render correctly for code smells 2`] = ` <Fragment> - <Link + <ForwardRef(Link) aria-label="overview.see_list_of_x_y_issues.1.0.metric.new_code_smells.name" className="overview-measures-value text-light" to={ @@ -80,7 +80,7 @@ exports[`should render correctly for code smells 2`] = ` } > 1 - </Link> + </ForwardRef(Link)> <CodeSmellIcon className="big-spacer-left little-spacer-right" /> @@ -90,7 +90,7 @@ exports[`should render correctly for code smells 2`] = ` exports[`should render correctly for hotspots 1`] = ` <Fragment> - <Link + <ForwardRef(Link) aria-label="overview.see_list_of_x_y_issues.1.0.metric.security_hotspots.name" className="overview-measures-value text-light" to={ @@ -102,7 +102,7 @@ exports[`should render correctly for hotspots 1`] = ` } > 1 - </Link> + </ForwardRef(Link)> <SecurityHotspotIcon className="big-spacer-left little-spacer-right" /> @@ -116,7 +116,7 @@ exports[`should render correctly for hotspots 1`] = ` exports[`should render correctly for hotspots 2`] = ` <Fragment> - <Link + <ForwardRef(Link) aria-label="overview.see_list_of_x_y_issues.1.0.metric.new_security_hotspots.name" className="overview-measures-value text-light" to={ @@ -128,7 +128,7 @@ exports[`should render correctly for hotspots 2`] = ` } > 1 - </Link> + </ForwardRef(Link)> <SecurityHotspotIcon className="big-spacer-left little-spacer-right" /> @@ -142,7 +142,7 @@ exports[`should render correctly for hotspots 2`] = ` exports[`should render correctly for vulnerabilities 1`] = ` <Fragment> - <Link + <ForwardRef(Link) aria-label="overview.see_list_of_x_y_issues.1.0.metric.vulnerabilities.name" className="overview-measures-value text-light" to={ @@ -154,7 +154,7 @@ exports[`should render correctly for vulnerabilities 1`] = ` } > 1 - </Link> + </ForwardRef(Link)> <VulnerabilityIcon className="big-spacer-left little-spacer-right" /> @@ -164,7 +164,7 @@ exports[`should render correctly for vulnerabilities 1`] = ` exports[`should render correctly for vulnerabilities 2`] = ` <Fragment> - <Link + <ForwardRef(Link) aria-label="overview.see_list_of_x_y_issues.1.0.metric.new_vulnerabilities.name" className="overview-measures-value text-light" to={ @@ -176,7 +176,7 @@ exports[`should render correctly for vulnerabilities 2`] = ` } > 1 - </Link> + </ForwardRef(Link)> <VulnerabilityIcon className="big-spacer-left little-spacer-right" /> diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/QualityGateCondition-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/QualityGateCondition-test.tsx.snap index 34fc6ff397d..70ea3e38769 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/QualityGateCondition-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/QualityGateCondition-test.tsx.snap @@ -46,7 +46,7 @@ exports[`should render correclty 1`] = ` exports[`should render correclty 2`] = ` <li> - <Link + <ForwardRef(Link) className="overview-quality-gate-condition overview-quality-gate-condition-error" to={ Object { @@ -88,13 +88,13 @@ exports[`should render correclty 2`] = ` </span> </div> </div> - </Link> + </ForwardRef(Link)> </li> `; exports[`should render correclty 3`] = ` <li> - <Link + <ForwardRef(Link) className="overview-quality-gate-condition overview-quality-gate-condition-error" to={ Object { @@ -136,13 +136,13 @@ exports[`should render correclty 3`] = ` </span> </div> </div> - </Link> + </ForwardRef(Link)> </li> `; exports[`should render correclty 4`] = ` <li> - <Link + <ForwardRef(Link) className="overview-quality-gate-condition overview-quality-gate-condition-error" to={ Object { @@ -184,13 +184,13 @@ exports[`should render correclty 4`] = ` </span> </div> </div> - </Link> + </ForwardRef(Link)> </li> `; exports[`should render correclty 5`] = ` <li> - <Link + <ForwardRef(Link) className="overview-quality-gate-condition overview-quality-gate-condition-error" to={ Object { @@ -232,13 +232,13 @@ exports[`should render correclty 5`] = ` </span> </div> </div> - </Link> + </ForwardRef(Link)> </li> `; exports[`should render correclty 6`] = ` <li> - <Link + <ForwardRef(Link) className="overview-quality-gate-condition overview-quality-gate-condition-error" to={ Object { @@ -280,13 +280,13 @@ exports[`should render correclty 6`] = ` </span> </div> </div> - </Link> + </ForwardRef(Link)> </li> `; exports[`should render correclty 7`] = ` <li> - <Link + <ForwardRef(Link) className="overview-quality-gate-condition overview-quality-gate-condition-error" to={ Object { @@ -328,13 +328,13 @@ exports[`should render correclty 7`] = ` </span> </div> </div> - </Link> + </ForwardRef(Link)> </li> `; exports[`should render correclty 8`] = ` <li> - <Link + <ForwardRef(Link) className="overview-quality-gate-condition overview-quality-gate-condition-error" to={ Object { @@ -376,13 +376,13 @@ exports[`should render correclty 8`] = ` </span> </div> </div> - </Link> + </ForwardRef(Link)> </li> `; exports[`should render correclty 9`] = ` <li> - <Link + <ForwardRef(Link) className="overview-quality-gate-condition overview-quality-gate-condition-error" to={ Object { @@ -424,13 +424,13 @@ exports[`should render correclty 9`] = ` </span> </div> </div> - </Link> + </ForwardRef(Link)> </li> `; exports[`should work with branch 1`] = ` <li> - <Link + <ForwardRef(Link) className="overview-quality-gate-condition overview-quality-gate-condition-error" to={ Object { @@ -472,6 +472,6 @@ exports[`should work with branch 1`] = ` </span> </div> </div> - </Link> + </ForwardRef(Link)> </li> `; diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx index 53460033875..46c3f448280 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx @@ -20,8 +20,8 @@ import classNames from 'classnames'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { colors } from '../../../app/theme'; +import Link from '../../../components/common/Link'; import HelpTooltip from '../../../components/controls/HelpTooltip'; import HelpIcon from '../../../components/icons/HelpIcon'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/__snapshots__/LargeQualityGateBadge-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/__snapshots__/LargeQualityGateBadge-test.tsx.snap index 527e390ba6b..6777ccaacca 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/__snapshots__/LargeQualityGateBadge-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/__snapshots__/LargeQualityGateBadge-test.tsx.snap @@ -18,7 +18,7 @@ exports[`should render correctly for SQ 1`] = ` id="overview.quality_gate.conditions_on_new_code" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/quality_gates/show/30", @@ -26,7 +26,7 @@ exports[`should render correctly for SQ 1`] = ` } > overview.quality_gate - </Link>, + </ForwardRef(Link)>, } } /> @@ -64,7 +64,7 @@ exports[`should render correctly for SQ 2`] = ` id="overview.quality_gate.conditions_on_new_code" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/quality_gates/show/30", @@ -72,7 +72,7 @@ exports[`should render correctly for SQ 2`] = ` } > overview.quality_gate - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/NameCell.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/NameCell.tsx index 02ead1cf2a2..ef790e83f4d 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/NameCell.tsx +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/NameCell.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { queryToSearch } from '../../../helpers/urls'; import { PermissionTemplate } from '../../../types/types'; import { PERMISSION_TEMPLATES_PATH } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateHeader.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateHeader.tsx index 09eca7b0f1c..bc9277e882c 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateHeader.tsx +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateHeader.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { translate } from '../../../helpers/l10n'; import { PermissionTemplate } from '../../../types/types'; import { PERMISSION_TEMPLATES_PATH } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/__snapshots__/NameCell-test.tsx.snap b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/__snapshots__/NameCell-test.tsx.snap index f4b305b47fa..a6c24bb7e16 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/__snapshots__/NameCell-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/__snapshots__/NameCell-test.tsx.snap @@ -4,7 +4,7 @@ exports[`render correctly 1`] = ` <td className="little-padded-left little-padded-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/admin/permission_templates", @@ -17,7 +17,7 @@ exports[`render correctly 1`] = ` > test </strong> - </Link> + </ForwardRef(Link)> <div className="spacer-top js-defaults" > diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/DefinitionChangeEventInner.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/DefinitionChangeEventInner.tsx index 7d3b7dc09db..41c393a3b3f 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/DefinitionChangeEventInner.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/DefinitionChangeEventInner.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { ButtonLink } from '../../../components/controls/buttons'; import BranchIcon from '../../../components/icons/BranchIcon'; import DropdownIcon from '../../../components/icons/DropdownIcon'; diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/RichQualityGateEventInner.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/RichQualityGateEventInner.tsx index 542540066fb..37c6333c3a7 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/RichQualityGateEventInner.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/RichQualityGateEventInner.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { ResetButtonLink } from '../../../components/controls/buttons'; import DropdownIcon from '../../../components/icons/DropdownIcon'; import Level from '../../../components/ui/Level'; diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/DefinitionChangeEventInner-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/DefinitionChangeEventInner-test.tsx.snap index d2384be643a..ce770c6fcd3 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/DefinitionChangeEventInner-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/DefinitionChangeEventInner-test.tsx.snap @@ -69,7 +69,7 @@ exports[`should render 2`] = ` /> master </span>, - "project": <Link + "project": <ForwardRef(Link) onClick={[Function]} title="Foo" to={ @@ -80,7 +80,7 @@ exports[`should render 2`] = ` } > Foo - </Link>, + </ForwardRef(Link)>, } } /> @@ -107,7 +107,7 @@ exports[`should render 2`] = ` /> master </span>, - "project": <Link + "project": <ForwardRef(Link) onClick={[Function]} title="Bar" to={ @@ -118,7 +118,7 @@ exports[`should render 2`] = ` } > Bar - </Link>, + </ForwardRef(Link)>, } } /> @@ -173,7 +173,7 @@ exports[`should render for a branch 1`] = ` /> feature-x </span>, - "project": <Link + "project": <ForwardRef(Link) onClick={[Function]} title="Foo" to={ @@ -184,7 +184,7 @@ exports[`should render for a branch 1`] = ` } > Foo - </Link>, + </ForwardRef(Link)>, } } /> @@ -217,7 +217,7 @@ exports[`should render for a branch 1`] = ` /> master </span>, - "project": <Link + "project": <ForwardRef(Link) onClick={[Function]} title="Bar" to={ @@ -228,7 +228,7 @@ exports[`should render for a branch 1`] = ` } > Bar - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/RichQualityGateEventInner-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/RichQualityGateEventInner-test.tsx.snap index c263d815f9c..cd9373673f2 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/RichQualityGateEventInner-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/RichQualityGateEventInner-test.tsx.snap @@ -85,7 +85,7 @@ exports[`should render 2`] = ` <div className="flex-1 text-ellipsis" > - <Link + <ForwardRef(Link) onClick={[Function]} title="Foo" to={ @@ -100,7 +100,7 @@ exports[`should render 2`] = ` > Foo </span> - </Link> + </ForwardRef(Link)> </div> </li> <li @@ -116,7 +116,7 @@ exports[`should render 2`] = ` <div className="flex-1 text-ellipsis" > - <Link + <ForwardRef(Link) onClick={[Function]} title="Bar" to={ @@ -131,7 +131,7 @@ exports[`should render 2`] = ` > Bar </span> - </Link> + </ForwardRef(Link)> </div> </li> </ul> diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/AppHeader.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/AppHeader.tsx index 6adb1055806..634306b49fb 100644 --- a/server/sonar-web/src/main/js/apps/projectBaseline/components/AppHeader.tsx +++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/AppHeader.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { translate } from '../../../helpers/l10n'; export interface AppHeaderProps { diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/__snapshots__/AppHeader-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/__snapshots__/AppHeader-test.tsx.snap index f411099adfa..8ff79641274 100644 --- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/__snapshots__/AppHeader-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/__snapshots__/AppHeader-test.tsx.snap @@ -17,11 +17,11 @@ exports[`should render correctly: can admin 1`] = ` id="project_baseline.page.description" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to="/documentation/project-administration/new-code-period/" > project_baseline.page.description.link - </Link>, + </ForwardRef(Link)>, } } /> @@ -31,11 +31,11 @@ exports[`should render correctly: can admin 1`] = ` id="project_baseline.page.description2" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to="/admin/settings?category=new_code_period" > project_baseline.page.description2.link - </Link>, + </ForwardRef(Link)>, } } /> @@ -60,11 +60,11 @@ exports[`should render correctly: cannot admin 1`] = ` id="project_baseline.page.description" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to="/documentation/project-administration/new-code-period/" > project_baseline.page.description.link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx index 42c6826000e..efda55587f4 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; import { translate } from '../../../helpers/l10n'; import { formatMeasure } from '../../../helpers/measures'; diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/LifetimeInformationRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/LifetimeInformationRenderer-test.tsx.snap index 810c4081524..1020ddc9890 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/LifetimeInformationRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/LifetimeInformationRenderer-test.tsx.snap @@ -47,11 +47,11 @@ exports[`should render correctly when user is admin 1`] = ` id="project_branch_pull_request.lifetime_information.admin" values={ Object { - "settings": <Link + "settings": <ForwardRef(Link) to="/admin/settings" > settings.page - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/Export.tsx b/server/sonar-web/src/main/js/apps/projectDump/components/Export.tsx index 37d4a78600b..473e17fbaec 100644 --- a/server/sonar-web/src/main/js/apps/projectDump/components/Export.tsx +++ b/server/sonar-web/src/main/js/apps/projectDump/components/Export.tsx @@ -19,6 +19,7 @@ */ import * as React from 'react'; import { doExport } from '../../../api/project-dump'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import DateFromNow from '../../../components/intl/DateFromNow'; import DateTimeFormatter from '../../../components/intl/DateTimeFormatter'; @@ -110,9 +111,9 @@ export default class Export extends React.Component<Props> { <div className="boxed-group-inner"> <Alert id="export-in-progress" variant="error"> {translate('project_dump.failed_export')} - <a className="spacer-left" href={detailsUrl}> + <Link className="spacer-left" to={detailsUrl}> {translate('project_dump.see_details')} - </a> + </Link> </Alert> {this.renderExport()} diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx b/server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx index 39a28c846ef..39c61a03b37 100644 --- a/server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx +++ b/server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx @@ -19,8 +19,8 @@ */ import classNames from 'classnames'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { doImport } from '../../../api/project-dump'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import DateFromNow from '../../../components/intl/DateFromNow'; import DateTimeFormatter from '../../../components/intl/DateTimeFormatter'; diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Export-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Export-test.tsx.snap index 788257b21d0..8e02d72a15c 100644 --- a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Export-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Export-test.tsx.snap @@ -126,12 +126,12 @@ exports[`should render correctly: task failed 1`] = ` variant="error" > project_dump.failed_export - <a + <ForwardRef(Link) className="spacer-left" - href="/project/background_tasks?id=key&status=FAILED&taskType=PROJECT_EXPORT" + to="/project/background_tasks?id=key&status=FAILED&taskType=PROJECT_EXPORT" > project_dump.see_details - </a> + </ForwardRef(Link)> </Alert> <div> <div diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Import-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Import-test.tsx.snap index 0c62310f98d..7c3c0bd960b 100644 --- a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Import-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Import-test.tsx.snap @@ -41,7 +41,7 @@ exports[`should render correctly: failed 1`] = ` variant="error" > project_dump.failed_import - <Link + <ForwardRef(Link) className="spacer-left" to={ Object { @@ -52,7 +52,7 @@ exports[`should render correctly: failed 1`] = ` } > project_dump.see_details - </Link> + </ForwardRef(Link)> </Alert> <div> <div diff --git a/server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx b/server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx index 49df2cc3647..92ffdfe5690 100644 --- a/server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx +++ b/server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx @@ -19,6 +19,7 @@ */ import * as React from 'react'; import isValidUri from '../../app/utils/isValidUri'; +import Link from '../../components/common/Link'; import { Button } from '../../components/controls/buttons'; import ConfirmButton from '../../components/controls/ConfirmButton'; import ProjectLinkIcon from '../../components/icons/ProjectLinkIcon'; @@ -93,9 +94,9 @@ export default class LinkRow extends React.PureComponent<Props> { <td className="nowrap">{this.renderName(link)}</td> <td className="nowrap js-url"> {isValidUri(link.url) ? ( - <a href={link.url} rel="nofollow noreferrer noopener" target="_blank"> + <Link to={link.url} target="_blank"> {link.url} - </a> + </Link> ) : ( link.url )} diff --git a/server/sonar-web/src/main/js/apps/projectLinks/__tests__/__snapshots__/LinkRow-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectLinks/__tests__/__snapshots__/LinkRow-test.tsx.snap index e05b8f94f91..1d479fdfb1a 100644 --- a/server/sonar-web/src/main/js/apps/projectLinks/__tests__/__snapshots__/LinkRow-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectLinks/__tests__/__snapshots__/LinkRow-test.tsx.snap @@ -26,13 +26,12 @@ exports[`should render custom link 1`] = ` <td className="nowrap js-url" > - <a - href="http://example.com" - rel="nofollow noreferrer noopener" + <ForwardRef(Link) target="_blank" + to="http://example.com" > http://example.com - </a> + </ForwardRef(Link)> </td> <td className="thin nowrap" @@ -131,13 +130,12 @@ exports[`should render provided link 1`] = ` <td className="nowrap js-url" > - <a - href="http://example.com" - rel="nofollow noreferrer noopener" + <ForwardRef(Link) target="_blank" + to="http://example.com" > http://example.com - </a> + </ForwardRef(Link)> </td> <td className="thin nowrap" diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx index 3cae6090497..cc6ef7da006 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx @@ -20,10 +20,10 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { components, OptionProps } from 'react-select'; import A11ySkipTarget from '../../components/a11y/A11ySkipTarget'; import DisableableSelectOption from '../../components/common/DisableableSelectOption'; +import Link from '../../components/common/Link'; import { SubmitButton } from '../../components/controls/buttons'; import HelpTooltip from '../../components/controls/HelpTooltip'; import Radio from '../../components/controls/Radio'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/__snapshots__/ProjectQualityGateAppRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/__snapshots__/ProjectQualityGateAppRenderer-test.tsx.snap index d46f48ec678..e05fd68d052 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/__snapshots__/ProjectQualityGateAppRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/__snapshots__/ProjectQualityGateAppRenderer-test.tsx.snap @@ -478,7 +478,7 @@ exports[`should render correctly: show new code warning 1`] = ` id="project_quality_gate.no_condition_on_new_code" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/quality_gates/show/3", @@ -486,7 +486,7 @@ exports[`should render correctly: show new code warning 1`] = ` } > project_quality_gate.no_condition.link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx index 8fd0186beae..2a8e33b2671 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx @@ -20,9 +20,9 @@ import { groupBy, orderBy } from 'lodash'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; -import { Link } from 'react-router-dom'; import { Profile } from '../../api/quality-profiles'; import A11ySkipTarget from '../../components/a11y/A11ySkipTarget'; +import Link from '../../components/common/Link'; import { Button } from '../../components/controls/buttons'; import HelpTooltip from '../../components/controls/HelpTooltip'; import Suggestions from '../../components/embed-docs-modal/Suggestions'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/__snapshots__/ProjectQualityProfilesAppRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/__snapshots__/ProjectQualityProfilesAppRenderer-test.tsx.snap index 08e1b441407..7bffb8aadc5 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/__snapshots__/ProjectQualityProfilesAppRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/__snapshots__/ProjectQualityProfilesAppRenderer-test.tsx.snap @@ -99,7 +99,7 @@ exports[`should render correctly: add language 1`] = ` <td className="nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -108,7 +108,7 @@ exports[`should render correctly: add language 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </td> <td className="text-right" @@ -141,7 +141,7 @@ exports[`should render correctly: add language 1`] = ` <td className="nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -150,7 +150,7 @@ exports[`should render correctly: add language 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </td> <td className="text-right" @@ -185,7 +185,7 @@ exports[`should render correctly: add language 1`] = ` <td className="nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -194,7 +194,7 @@ exports[`should render correctly: add language 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </td> <td className="text-right" @@ -399,7 +399,7 @@ exports[`should render correctly: default 1`] = ` <td className="nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -408,7 +408,7 @@ exports[`should render correctly: default 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </td> <td className="text-right" @@ -441,7 +441,7 @@ exports[`should render correctly: default 1`] = ` <td className="nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -450,7 +450,7 @@ exports[`should render correctly: default 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </td> <td className="text-right" @@ -485,7 +485,7 @@ exports[`should render correctly: default 1`] = ` <td className="nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -494,7 +494,7 @@ exports[`should render correctly: default 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </td> <td className="text-right" @@ -720,7 +720,7 @@ exports[`should render correctly: open profile 1`] = ` <td className="nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -729,7 +729,7 @@ exports[`should render correctly: open profile 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </td> <td className="text-right" @@ -762,7 +762,7 @@ exports[`should render correctly: open profile 1`] = ` <td className="nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -771,7 +771,7 @@ exports[`should render correctly: open profile 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </td> <td className="text-right" @@ -806,7 +806,7 @@ exports[`should render correctly: open profile 1`] = ` <td className="nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -815,7 +815,7 @@ exports[`should render correctly: open profile 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </td> <td className="text-right" diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/LanguageProfileSelectOption.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/LanguageProfileSelectOption.tsx index b506a93878e..ca55cf7dabf 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/LanguageProfileSelectOption.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/LanguageProfileSelectOption.tsx @@ -18,9 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { components, OptionProps } from 'react-select'; import DisableableSelectOption from '../../../components/common/DisableableSelectOption'; +import Link from '../../../components/common/Link'; import { BasicSelectOption } from '../../../components/controls/Select'; import { translate } from '../../../helpers/l10n'; import { getQualityProfileUrl } from '../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/__snapshots__/LanguageProfileSelectOption-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/__snapshots__/LanguageProfileSelectOption-test.tsx.snap index 534f179f976..a9f9fb0c776 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/__snapshots__/LanguageProfileSelectOption-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/__snapshots__/LanguageProfileSelectOption-test.tsx.snap @@ -33,7 +33,7 @@ exports[`tooltip should render correctly: default 1`] = ` <p> project_quality_profile.add_language_modal.profile_unavailable_no_active_rules </p> - <Link + <ForwardRef(Link) to={ Object { "pathname": "/profiles/show", @@ -42,7 +42,7 @@ exports[`tooltip should render correctly: default 1`] = ` } > project_quality_profile.add_language_modal.go_to_profile - </Link> + </ForwardRef(Link)> </React.Fragment> `; diff --git a/server/sonar-web/src/main/js/apps/projects/components/EmptyFavoriteSearch.tsx b/server/sonar-web/src/main/js/apps/projects/components/EmptyFavoriteSearch.tsx index 11530510c6f..f6007a6681f 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/EmptyFavoriteSearch.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/EmptyFavoriteSearch.tsx @@ -19,8 +19,8 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import '../../../components/common/EmptySearch.css'; +import Link from '../../../components/common/Link'; import { translate } from '../../../helpers/l10n'; import { queryToSearch } from '../../../helpers/urls'; import { Dict } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.tsx b/server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.tsx index 1cf78b4a997..b020a4bb64c 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/NoFavoriteProjects.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { translate } from '../../../helpers/l10n'; export default function NoFavoriteProjects() { diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx index 3fa8a85e11d..2b3db1c30bb 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx @@ -18,9 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { getAlmSettings } from '../../../api/alm-settings'; import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import Dropdown from '../../../components/controls/Dropdown'; import DropdownIcon from '../../../components/icons/DropdownIcon'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenuItem.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenuItem.tsx index 7d933de7d9d..f53122f6ab0 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenuItem.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenuItem.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import ChevronsIcon from '../../../components/icons/ChevronsIcon'; import { translate } from '../../../helpers/l10n'; import { getBaseUrl } from '../../../helpers/system'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/NoFavoriteProjects-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/NoFavoriteProjects-test.tsx.snap index 9c59832d3e6..f52b6888166 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/NoFavoriteProjects-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/NoFavoriteProjects-test.tsx.snap @@ -16,12 +16,12 @@ exports[`renders 1`] = ` <p className="big-spacer-top" > - <Link + <ForwardRef(Link) className="button" to="/projects/all" > projects.explore_projects - </Link> + </ForwardRef(Link)> </p> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCreationMenu-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCreationMenu-test.tsx.snap index c2eea8f86d0..1f8eda4e83a 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCreationMenu-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCreationMenu-test.tsx.snap @@ -17,7 +17,7 @@ exports[`should render correctly: default 1`] = ` <li className="bordered-top little-padded-top" > - <Link + <ForwardRef(Link) className="display-flex-center" to={ Object { @@ -30,7 +30,7 @@ exports[`should render correctly: default 1`] = ` size={16} /> more - </Link> + </ForwardRef(Link)> </li> </ul> } diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCreationMenuItem-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCreationMenuItem-test.tsx.snap index b4e778a2161..209d4eee7e1 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCreationMenuItem-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCreationMenuItem-test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should render correctly: bitbucket 1`] = ` -<Link +<ForwardRef(Link) className="display-flex-center" to={ Object { @@ -17,11 +17,11 @@ exports[`should render correctly: bitbucket 1`] = ` width={16} /> my_account.add_project.bitbucket -</Link> +</ForwardRef(Link)> `; exports[`should render correctly: manual 1`] = ` -<Link +<ForwardRef(Link) className="display-flex-center" to={ Object { @@ -34,5 +34,5 @@ exports[`should render correctly: manual 1`] = ` className="spacer-right" /> my_account.add_project.manual -</Link> +</ForwardRef(Link)> `; diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx index 7b06cc6385d..6a1f90701d9 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx @@ -20,7 +20,7 @@ import classNames from 'classnames'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import PrivacyBadgeContainer from '../../../../components/common/PrivacyBadgeContainer'; import Favorite from '../../../../components/controls/Favorite'; import Tooltip from '../../../../components/controls/Tooltip'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/__snapshots__/ProjectCard-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/__snapshots__/ProjectCard-test.tsx.snap index af69b9a3c92..8a83a968776 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/__snapshots__/ProjectCard-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/__snapshots__/ProjectCard-test.tsx.snap @@ -36,7 +36,7 @@ exports[`should display applications 1`] = ` className="h2 project-card-name text-ellipsis" title="Foo" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -45,7 +45,7 @@ exports[`should display applications 1`] = ` } > Foo - </Link> + </ForwardRef(Link)> </h3> <ProjectCardQualityGate status="OK" @@ -139,7 +139,7 @@ exports[`should display applications: with project count 1`] = ` className="h2 project-card-name text-ellipsis" title="Foo" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -148,7 +148,7 @@ exports[`should display applications: with project count 1`] = ` } > Foo - </Link> + </ForwardRef(Link)> </h3> <ProjectCardQualityGate status="OK" @@ -223,7 +223,7 @@ exports[`should display configure analysis button for logged in user: default 1` className="h2 project-card-name text-ellipsis" title="Foo" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -232,7 +232,7 @@ exports[`should display configure analysis button for logged in user: default 1` } > Foo - </Link> + </ForwardRef(Link)> </h3> </div> <div @@ -263,7 +263,7 @@ exports[`should display configure analysis button for logged in user: default 1` > projects.not_analyzed.TRK </span> - <Link + <ForwardRef(Link) className="button spacer-left" to={ Object { @@ -273,7 +273,7 @@ exports[`should display configure analysis button for logged in user: default 1` } > projects.configure_analysis - </Link> + </ForwardRef(Link)> </div> </div> <div @@ -437,7 +437,7 @@ exports[`should display not analyzed yet 1`] = ` className="h2 project-card-name text-ellipsis" title="Foo" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -446,7 +446,7 @@ exports[`should display not analyzed yet 1`] = ` } > Foo - </Link> + </ForwardRef(Link)> </h3> </div> <div @@ -506,7 +506,7 @@ exports[`should display the overall measures and quality gate 1`] = ` className="h2 project-card-name text-ellipsis" title="Foo" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -515,7 +515,7 @@ exports[`should display the overall measures and quality gate 1`] = ` } > Foo - </Link> + </ForwardRef(Link)> </h3> <ProjectCardQualityGate status="OK" diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx index 622329fc954..c25cdf0455e 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx @@ -19,8 +19,8 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { createProject } from '../../api/components'; +import Link from '../../components/common/Link'; import VisibilitySelector from '../../components/common/VisibilitySelector'; import { ResetButtonLink, SubmitButton } from '../../components/controls/buttons'; import Modal from '../../components/controls/Modal'; diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx index 5178b23c919..0c0752f811d 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { Project } from '../../api/components'; +import Link from '../../components/common/Link'; import PrivacyBadgeContainer from '../../components/common/PrivacyBadgeContainer'; import Checkbox from '../../components/controls/Checkbox'; import Tooltip from '../../components/controls/Tooltip'; diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/CreateProjectForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/CreateProjectForm-test.tsx.snap index 6e3daf3a9bf..1a4fc2524bd 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/CreateProjectForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/CreateProjectForm-test.tsx.snap @@ -312,7 +312,7 @@ exports[`creates project 4`] = ` id="projects_management.project_has_been_successfully_created" values={ Object { - "project": <Link + "project": <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -321,7 +321,7 @@ exports[`creates project 4`] = ` } > name - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ProjectRow-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ProjectRow-test.tsx.snap index 19273a75709..3b90b7f657c 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ProjectRow-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ProjectRow-test.tsx.snap @@ -16,7 +16,7 @@ exports[`renders 1`] = ` <td className="nowrap hide-overflow project-row-text-cell" > - <Link + <ForwardRef(Link) className="link-no-underline" to={ Object { @@ -37,7 +37,7 @@ exports[`renders 1`] = ` Project </span> </Tooltip> - </Link> + </ForwardRef(Link)> </td> <td className="thin nowrap" @@ -108,7 +108,7 @@ exports[`renders: portfolio 1`] = ` <td className="nowrap hide-overflow project-row-text-cell" > - <Link + <ForwardRef(Link) className="link-no-underline" to={ Object { @@ -129,7 +129,7 @@ exports[`renders: portfolio 1`] = ` Project </span> </Tooltip> - </Link> + </ForwardRef(Link)> </td> <td className="thin nowrap" @@ -200,7 +200,7 @@ exports[`renders: with lastAnalysisDate 1`] = ` <td className="nowrap hide-overflow project-row-text-cell" > - <Link + <ForwardRef(Link) className="link-no-underline" to={ Object { @@ -221,7 +221,7 @@ exports[`renders: with lastAnalysisDate 1`] = ` Project </span> </Tooltip> - </Link> + </ForwardRef(Link)> </td> <td className="thin nowrap" diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx index 367ee4be80b..da8a8f24414 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx @@ -20,7 +20,7 @@ import { isSameMinute } from 'date-fns'; import { sortBy } from 'lodash'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import DateTimeFormatter from '../../../components/intl/DateTimeFormatter'; import { parseDate } from '../../../helpers/dates'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx index 0aa89d41eec..3e6999ecc14 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx @@ -19,6 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import Link from '../../../../components/common/Link'; import { ProfileChangelogEvent } from '../../types'; import Changelog from '../Changelog'; import ChangesList from '../ChangesList'; @@ -68,7 +69,7 @@ it('should render action', () => { it('should render rule', () => { const events = [createEvent()]; const changelog = shallow(<Changelog events={events} />); - expect(changelog.find('Link').prop('to')).toHaveProperty('search', '?rule_key=squid1234'); + expect(changelog.find(Link).prop('to')).toHaveProperty('search', '?rule_key=squid1234'); }); it('should render ChangesList', () => { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx index 4ced3242a18..538e9b08741 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { CompareResponse, Profile } from '../../../api/quality-profiles'; +import Link from '../../../components/common/Link'; import ChevronLeftIcon from '../../../components/icons/ChevronLeftIcon'; import ChevronRightIcon from '../../../components/icons/ChevronRightIcon'; import SeverityIcon from '../../../components/icons/SeverityIcon'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx index bfab84c2975..8a477b618e1 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx @@ -19,8 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { Profile } from '../../../../api/quality-profiles'; +import Link from '../../../../components/common/Link'; import ComparisonEmpty from '../ComparisonEmpty'; import ComparisonResults from '../ComparisonResults'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx index a855c791707..782747c0451 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx @@ -19,6 +19,7 @@ */ import * as React from 'react'; import { getQualityProfileExporterUrl } from '../../../api/quality-profiles'; +import Link from '../../../components/common/Link'; import { Alert } from '../../../components/ui/Alert'; import { translate } from '../../../helpers/l10n'; import { getBaseUrl } from '../../../helpers/system'; @@ -56,9 +57,9 @@ export default class ProfileExporters extends React.PureComponent<Props> { className={index > 0 ? 'spacer-top' : undefined} data-key={exporter.key} key={exporter.key}> - <a href={this.getExportUrl(exporter)} rel="noopener noreferrer" target="_blank"> + <Link to={this.getExportUrl(exporter)} target="_blank"> {exporter.name} - </a> + </Link> </li> ))} </ul> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx index 5e147feec6b..9fe78d963f7 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx @@ -18,7 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link, NavLink } from 'react-router-dom'; +import { NavLink } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import Tooltip from '../../../components/controls/Tooltip'; import DateFromNow from '../../../components/intl/DateFromNow'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx index a5ad08c1fb6..bf9bc63f3f3 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { getProfileProjects } from '../../../api/quality-profiles'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import ListFooter from '../../../components/controls/ListFooter'; import Tooltip from '../../../components/controls/Tooltip'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx index cd5113bf17c..9e60f069a5b 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx @@ -19,9 +19,9 @@ */ import { keyBy } from 'lodash'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { getQualityProfile } from '../../../api/quality-profiles'; import { searchRules, takeFacet } from '../../../api/rules'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import Tooltip from '../../../components/controls/Tooltip'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesDeprecatedWarning.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesDeprecatedWarning.tsx index bde0c6a01f4..a146feeb175 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesDeprecatedWarning.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesDeprecatedWarning.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import HelpTooltip from '../../../components/controls/HelpTooltip'; import { translate } from '../../../helpers/l10n'; import { getDeprecatedActiveRulesUrl } from '../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx index 3f813408c04..f4c69eaee6f 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import IssueTypeIcon from '../../../components/icons/IssueTypeIcon'; import { translate } from '../../../helpers/l10n'; import { formatMeasure } from '../../../helpers/measures'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowTotal.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowTotal.tsx index 62156642237..2d4c8911b9c 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowTotal.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowTotal.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { translate } from '../../../helpers/l10n'; import { formatMeasure } from '../../../helpers/measures'; import { getRulesUrl } from '../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.tsx index 94831180faa..ff96db6669e 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import HelpTooltip from '../../../components/controls/HelpTooltip'; import { translate } from '../../../helpers/l10n'; import { getRulesUrl } from '../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileExporters-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileExporters-test.tsx.snap index b225bede9e0..1f5eff13f09 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileExporters-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileExporters-test.tsx.snap @@ -21,13 +21,12 @@ exports[`should render correctly 1`] = ` data-key="exporter-key" key="exporter-key" > - <a - href="/api/qualityprofiles/export?exporterKey=exporter-key&language=js&qualityProfile=name" - rel="noopener noreferrer" + <ForwardRef(Link) target="_blank" + to="/api/qualityprofiles/export?exporterKey=exporter-key&language=js&qualityProfile=name" > exporter-name - </a> + </ForwardRef(Link)> </li> </ul> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileHeader-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileHeader-test.tsx.snap index 8b99596ac38..f181062d432 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileHeader-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileHeader-test.tsx.snap @@ -14,7 +14,7 @@ exports[`should render correctly 1`] = ` quality_profiles.page </NavLink> / - <Link + <ForwardRef(Link) to={ Object { "pathname": "/profiles", @@ -23,7 +23,7 @@ exports[`should render correctly 1`] = ` } > JavaScript - </Link> + </ForwardRef(Link)> </div> <h1 className="page-title" @@ -63,7 +63,7 @@ exports[`should render correctly 1`] = ` <DateFromNow /> </li> <li> - <Link + <ForwardRef(Link) className="button" to={ Object { @@ -73,7 +73,7 @@ exports[`should render correctly 1`] = ` } > changelog - </Link> + </ForwardRef(Link)> </li> <li> <withRouter(ProfileActions) @@ -116,7 +116,7 @@ exports[`should render correctly: for default profile 1`] = ` quality_profiles.page </NavLink> / - <Link + <ForwardRef(Link) to={ Object { "pathname": "/profiles", @@ -125,7 +125,7 @@ exports[`should render correctly: for default profile 1`] = ` } > JavaScript - </Link> + </ForwardRef(Link)> </div> <h1 className="page-title" @@ -174,7 +174,7 @@ exports[`should render correctly: for default profile 1`] = ` <DateFromNow /> </li> <li> - <Link + <ForwardRef(Link) className="button" to={ Object { @@ -184,7 +184,7 @@ exports[`should render correctly: for default profile 1`] = ` } > changelog - </Link> + </ForwardRef(Link)> </li> <li> <withRouter(ProfileActions) diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileProjects-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileProjects-test.tsx.snap index cfb7b753c46..860ed7074e8 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileProjects-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileProjects-test.tsx.snap @@ -35,7 +35,7 @@ exports[`should render correctly: default 1`] = ` data-key="org.sonarsource.xml:xml" key="org.sonarsource.xml:xml" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -50,7 +50,7 @@ exports[`should render correctly: default 1`] = ` <span> SonarXML </span> - </Link> + </ForwardRef(Link)> </li> </ul> <ListFooter @@ -134,7 +134,7 @@ exports[`should render correctly: no active rules, but associated projects 1`] = data-key="org.sonarsource.xml:xml" key="org.sonarsource.xml:xml" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -149,7 +149,7 @@ exports[`should render correctly: no active rules, but associated projects 1`] = <span> SonarXML </span> - </Link> + </ForwardRef(Link)> </li> </ul> <ListFooter @@ -218,7 +218,7 @@ exports[`should render correctly: no rights 1`] = ` data-key="org.sonarsource.xml:xml" key="org.sonarsource.xml:xml" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -233,7 +233,7 @@ exports[`should render correctly: no rights 1`] = ` <span> SonarXML </span> - </Link> + </ForwardRef(Link)> </li> </ul> <ListFooter diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap index 2bfdc44d131..7e2cbee1080 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap @@ -72,7 +72,7 @@ exports[`should render the quality profiles rules with sonarway comparison 1`] = `; exports[`should show a button to activate more rules for admins 1`] = ` -<Link +<ForwardRef(Link) className="button js-activate-rules" to={ Object { @@ -82,7 +82,7 @@ exports[`should show a button to activate more rules for admins 1`] = ` } > quality_profiles.activate_more -</Link> +</ForwardRef(Link)> `; exports[`should show a deprecated rules warning message 1`] = ` diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesDeprecatedWarning-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesDeprecatedWarning-test.tsx.snap index 9b9d0902b5f..675f9dedb4f 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesDeprecatedWarning-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesDeprecatedWarning-test.tsx.snap @@ -17,7 +17,7 @@ exports[`should render correctly 1`] = ` overlay="quality_profiles.deprecated_rules_description" /> </span> - <Link + <ForwardRef(Link) className="pull-right" to={ Object { @@ -27,6 +27,6 @@ exports[`should render correctly 1`] = ` } > 18 - </Link> + </ForwardRef(Link)> </div> `; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesRowOfType-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesRowOfType-test.tsx.snap index a1eb150e996..5779c1a9925 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesRowOfType-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesRowOfType-test.tsx.snap @@ -14,7 +14,7 @@ exports[`should render correctly 1`] = ` <td className="thin nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -23,12 +23,12 @@ exports[`should render correctly 1`] = ` } > 3 - </Link> + </ForwardRef(Link)> </td> <td className="thin nowrap text-right" > - <Link + <ForwardRef(Link) className="small" to={ Object { @@ -38,7 +38,7 @@ exports[`should render correctly 1`] = ` } > 7 - </Link> + </ForwardRef(Link)> </td> </tr> `; @@ -57,7 +57,7 @@ exports[`should render correctly if there is 0 rules 1`] = ` <td className="thin nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -66,7 +66,7 @@ exports[`should render correctly if there is 0 rules 1`] = ` } > 0 - </Link> + </ForwardRef(Link)> </td> <td className="thin nowrap text-right" @@ -94,7 +94,7 @@ exports[`should render correctly if there is missing data 1`] = ` <td className="thin nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -103,7 +103,7 @@ exports[`should render correctly if there is missing data 1`] = ` } > 5 - </Link> + </ForwardRef(Link)> </td> <td className="thin nowrap text-right" diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesRowTotal-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesRowTotal-test.tsx.snap index 695b3fbe044..64f405142ec 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesRowTotal-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesRowTotal-test.tsx.snap @@ -10,7 +10,7 @@ exports[`should render correctly 1`] = ` <td className="thin nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -21,12 +21,12 @@ exports[`should render correctly 1`] = ` <strong> 3 </strong> - </Link> + </ForwardRef(Link)> </td> <td className="thin nowrap text-right" > - <Link + <ForwardRef(Link) className="small" to={ Object { @@ -38,7 +38,7 @@ exports[`should render correctly 1`] = ` <strong> 7 </strong> - </Link> + </ForwardRef(Link)> </td> </tr> `; @@ -53,7 +53,7 @@ exports[`should render correctly if there is 0 rules 1`] = ` <td className="thin nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -64,7 +64,7 @@ exports[`should render correctly if there is 0 rules 1`] = ` <strong> 0 </strong> - </Link> + </ForwardRef(Link)> </td> <td className="thin nowrap text-right" @@ -88,7 +88,7 @@ exports[`should render correctly if there is missing data 1`] = ` <td className="thin nowrap text-right" > - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -99,7 +99,7 @@ exports[`should render correctly if there is missing data 1`] = ` <strong> 5 </strong> - </Link> + </ForwardRef(Link)> </td> <td className="thin nowrap text-right" diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesSonarWayComparison-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesSonarWayComparison-test.tsx.snap index 83633732e7b..f388e66edbc 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesSonarWayComparison-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRulesSonarWayComparison-test.tsx.snap @@ -17,7 +17,7 @@ exports[`should render correctly 1`] = ` overlay="quality_profiles.sonarway_missing_rules_description" /> </span> - <Link + <ForwardRef(Link) className="pull-right" data-test="rules" to={ @@ -28,6 +28,6 @@ exports[`should render correctly 1`] = ` } > 158 - </Link> + </ForwardRef(Link)> </div> `; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx index 3c7ce567769..74052a2e3f5 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx @@ -19,7 +19,7 @@ */ import { sortBy } from 'lodash'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { getDeprecatedActiveRulesUrl } from '../../../helpers/urls'; import ProfileLink from '../components/ProfileLink'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx index 155543ad1b0..0d7c300fdce 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx @@ -19,8 +19,8 @@ */ import { sortBy } from 'lodash'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { searchRules } from '../../../api/rules'; +import Link from '../../../components/common/Link'; import { toShortNotSoISOString } from '../../../helpers/dates'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { formatMeasure } from '../../../helpers/measures'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx index 006b70a3490..0280b5b11d2 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { Actions } from '../../../api/quality-profiles'; +import Link from '../../../components/common/Link'; import { Button } from '../../../components/controls/buttons'; import { Location, Router, withRouter } from '../../../components/hoc/withRouter'; import { Alert } from '../../../components/ui/Alert'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx index 72408e1905e..094bc9ef4b8 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import Tooltip from '../../../components/controls/Tooltip'; import DateFromNow from '../../../components/intl/DateFromNow'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/__snapshots__/EvolutionDeprecated-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/__snapshots__/EvolutionDeprecated-test.tsx.snap index 9166e4285dd..2aa055dd009 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/__snapshots__/EvolutionDeprecated-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/__snapshots__/EvolutionDeprecated-test.tsx.snap @@ -36,7 +36,7 @@ exports[`should render correctly 1`] = ` > JavaScript , - <Link + <ForwardRef(Link) className="link-no-underline" to={ Object { @@ -46,7 +46,7 @@ exports[`should render correctly 1`] = ` } > quality_profile.x_rules.4 - </Link> + </ForwardRef(Link)> <div className="muted" key="qp-2" @@ -82,7 +82,7 @@ exports[`should render correctly 1`] = ` > JavaScript , - <Link + <ForwardRef(Link) className="link-no-underline" to={ Object { @@ -92,7 +92,7 @@ exports[`should render correctly 1`] = ` } > quality_profile.x_rules.3 - </Link> + </ForwardRef(Link)> <div className="muted" key="qp-2" @@ -121,7 +121,7 @@ exports[`should render correctly 1`] = ` > JavaScript , - <Link + <ForwardRef(Link) className="link-no-underline" to={ Object { @@ -131,7 +131,7 @@ exports[`should render correctly 1`] = ` } > quality_profile.x_rules.2 - </Link> + </ForwardRef(Link)> </div> </li> <li @@ -153,7 +153,7 @@ exports[`should render correctly 1`] = ` > JavaScript , - <Link + <ForwardRef(Link) className="link-no-underline" to={ Object { @@ -163,7 +163,7 @@ exports[`should render correctly 1`] = ` } > quality_profile.x_rules.2 - </Link> + </ForwardRef(Link)> <div className="muted" key="qp-2" diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/__snapshots__/PageHeader-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/__snapshots__/PageHeader-test.tsx.snap index 4cabe302e26..b56ff86f837 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/__snapshots__/PageHeader-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/__snapshots__/PageHeader-test.tsx.snap @@ -15,7 +15,7 @@ exports[`should render correctly 1`] = ` quality_profiles.intro1 <br /> quality_profiles.intro2 - <Link + <ForwardRef(Link) className="spacer-left" target="_blank" to={ @@ -25,7 +25,7 @@ exports[`should render correctly 1`] = ` } > learn_more - </Link> + </ForwardRef(Link)> </div> </header> `; @@ -63,7 +63,7 @@ exports[`should render correctly 2`] = ` quality_profiles.intro1 <br /> quality_profiles.intro2 - <Link + <ForwardRef(Link) className="spacer-left" target="_blank" to={ @@ -73,7 +73,7 @@ exports[`should render correctly 2`] = ` } > learn_more - </Link> + </ForwardRef(Link)> </div> </header> `; @@ -117,7 +117,7 @@ exports[`should render correctly 3`] = ` quality_profiles.intro1 <br /> quality_profiles.intro2 - <Link + <ForwardRef(Link) className="spacer-left" target="_blank" to={ @@ -127,7 +127,7 @@ exports[`should render correctly 3`] = ` } > learn_more - </Link> + </ForwardRef(Link)> </div> </header> `; @@ -165,7 +165,7 @@ exports[`should show a create form 1`] = ` quality_profiles.intro1 <br /> quality_profiles.intro2 - <Link + <ForwardRef(Link) className="spacer-left" target="_blank" to={ @@ -175,7 +175,7 @@ exports[`should show a create form 1`] = ` } > learn_more - </Link> + </ForwardRef(Link)> </div> <CreateProfileForm languages={ @@ -253,7 +253,7 @@ exports[`should show a restore form 1`] = ` quality_profiles.intro1 <br /> quality_profiles.intro2 - <Link + <ForwardRef(Link) className="spacer-left" target="_blank" to={ @@ -263,7 +263,7 @@ exports[`should show a restore form 1`] = ` } > learn_more - </Link> + </ForwardRef(Link)> </div> <RestoreProfileForm onClose={[Function]} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/__snapshots__/ProfilesListRow-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/__snapshots__/ProfilesListRow-test.tsx.snap index 85d7ef07a13..90c5fc4af4e 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/__snapshots__/ProfilesListRow-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/__snapshots__/ProfilesListRow-test.tsx.snap @@ -47,7 +47,7 @@ exports[`should render correctly: built-in profile 1`] = ` <Tooltip overlay="quality_profiles.deprecated_rules" > - <Link + <ForwardRef(Link) className="badge badge-error" to={ Object { @@ -57,10 +57,10 @@ exports[`should render correctly: built-in profile 1`] = ` } > 2 - </Link> + </ForwardRef(Link)> </Tooltip> </span> - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -69,7 +69,7 @@ exports[`should render correctly: built-in profile 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </div> </td> <td @@ -146,7 +146,7 @@ exports[`should render correctly: default 1`] = ` className="quality-profiles-table-rules thin nowrap text-middle text-right" > <div> - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -155,7 +155,7 @@ exports[`should render correctly: default 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </div> </td> <td @@ -244,7 +244,7 @@ exports[`should render correctly: default profile 1`] = ` <Tooltip overlay="quality_profiles.deprecated_rules" > - <Link + <ForwardRef(Link) className="badge badge-error" to={ Object { @@ -254,10 +254,10 @@ exports[`should render correctly: default profile 1`] = ` } > 2 - </Link> + </ForwardRef(Link)> </Tooltip> </span> - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -266,7 +266,7 @@ exports[`should render correctly: default profile 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </div> </td> <td @@ -349,7 +349,7 @@ exports[`should render correctly: with deprecated rules 1`] = ` <Tooltip overlay="quality_profiles.deprecated_rules" > - <Link + <ForwardRef(Link) className="badge badge-error" to={ Object { @@ -359,10 +359,10 @@ exports[`should render correctly: with deprecated rules 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </Tooltip> </span> - <Link + <ForwardRef(Link) to={ Object { "pathname": "/coding_rules", @@ -371,7 +371,7 @@ exports[`should render correctly: with deprecated rules 1`] = ` } > 10 - </Link> + </ForwardRef(Link)> </div> </td> <td diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/EmptyHotspotsPage.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/EmptyHotspotsPage.tsx index 92c6afdd267..05096cc74a4 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/EmptyHotspotsPage.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/EmptyHotspotsPage.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { translate } from '../../../helpers/l10n'; import { getBaseUrl } from '../../../helpers/system'; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotHeader.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotHeader.tsx index 7dd943896f6..d9402440b4c 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotHeader.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotHeader.tsx @@ -19,7 +19,7 @@ */ import React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { translate } from '../../../helpers/l10n'; import { getRuleUrl } from '../../../helpers/urls'; import { Hotspot, HotspotStatusOption } from '../../../types/security-hotspots'; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/EmptyHotspotsPage-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/EmptyHotspotsPage-test.tsx.snap index 5ca002b074f..440d4a6e8ae 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/EmptyHotspotsPage-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/EmptyHotspotsPage-test.tsx.snap @@ -20,7 +20,7 @@ exports[`should render correctly 1`] = ` > hotspots.no_hotspots.description </div> - <Link + <ForwardRef(Link) className="big-spacer-top" target="_blank" to={ @@ -30,7 +30,7 @@ exports[`should render correctly 1`] = ` } > hotspots.learn_more - </Link> + </ForwardRef(Link)> </div> `; @@ -54,7 +54,7 @@ exports[`should render correctly: file 1`] = ` > hotspots.no_hotspots_for_file.description </div> - <Link + <ForwardRef(Link) className="big-spacer-top" target="_blank" to={ @@ -64,7 +64,7 @@ exports[`should render correctly: file 1`] = ` } > hotspots.learn_more - </Link> + </ForwardRef(Link)> </div> `; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotHeader-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotHeader-test.tsx.snap index e261772684f..a5d2957ac54 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotHeader-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotHeader-test.tsx.snap @@ -20,7 +20,7 @@ exports[`should render correctly 1`] = ` > That rule </span> - <Link + <ForwardRef(Link) className="small" target="_blank" to={ @@ -31,7 +31,7 @@ exports[`should render correctly 1`] = ` } > squid:S2077 - </Link> + </ForwardRef(Link)> </div> </div> <div diff --git a/server/sonar-web/src/main/js/apps/sessions/components/LoginForm.tsx b/server/sonar-web/src/main/js/apps/sessions/components/LoginForm.tsx index c395c1f80d0..ee96583d823 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/LoginForm.tsx +++ b/server/sonar-web/src/main/js/apps/sessions/components/LoginForm.tsx @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import Link from '../../../components/common/Link'; import { ButtonLink, SubmitButton } from '../../../components/controls/buttons'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; import { translate } from '../../../helpers/l10n'; @@ -124,9 +125,9 @@ export default class LoginForm extends React.PureComponent<Props, State> { <SubmitButton disabled={this.state.loading}> {translate('sessions.log_in')} </SubmitButton> - <a className="spacer-left" href={`${getBaseUrl()}/`}> + <Link className="spacer-left" to={`${getBaseUrl()}/`}> {translate('cancel')} - </a> + </Link> </div> </div> </form> diff --git a/server/sonar-web/src/main/js/apps/sessions/components/Unauthorized.tsx b/server/sonar-web/src/main/js/apps/sessions/components/Unauthorized.tsx index 704944e48fd..df989d43cf9 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/Unauthorized.tsx +++ b/server/sonar-web/src/main/js/apps/sessions/components/Unauthorized.tsx @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import Link from '../../../components/common/Link'; import { getCookie } from '../../../helpers/cookies'; import { translate } from '../../../helpers/l10n'; import { getBaseUrl } from '../../../helpers/system'; @@ -37,7 +38,7 @@ export default function Unauthorized() { )} <div className="big-spacer-top"> - <a href={getBaseUrl() + '/'}>{translate('layout.home')}</a> + <Link to={getBaseUrl() + '/'}>{translate('layout.home')}</Link> </div> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/__snapshots__/LoginForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/__snapshots__/LoginForm-test.tsx.snap index 3d97ba42e31..10720b42939 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/__snapshots__/LoginForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/__snapshots__/LoginForm-test.tsx.snap @@ -74,12 +74,12 @@ exports[`expands more options 2`] = ` > sessions.log_in </SubmitButton> - <a + <ForwardRef(Link) className="spacer-left" - href="/" + to="/" > cancel - </a> + </ForwardRef(Link)> </div> </div> </form> @@ -145,12 +145,12 @@ exports[`logs in with simple credentials 1`] = ` > sessions.log_in </SubmitButton> - <a + <ForwardRef(Link) className="spacer-left" - href="/" + to="/" > cancel - </a> + </ForwardRef(Link)> </div> </div> </form> @@ -216,12 +216,12 @@ exports[`should display a spinner and disabled button while loading 1`] = ` > sessions.log_in </SubmitButton> - <a + <ForwardRef(Link) className="spacer-left" - href="/" + to="/" > cancel - </a> + </ForwardRef(Link)> </div> </div> </form> diff --git a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/__snapshots__/Unauthorized-test.tsx.snap b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/__snapshots__/Unauthorized-test.tsx.snap index 5c538ff3ad3..2e4e329391b 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/__snapshots__/Unauthorized-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/__snapshots__/Unauthorized-test.tsx.snap @@ -27,11 +27,11 @@ exports[`render 1`] = ` <div className="big-spacer-top" > - <a - href="/" + <ForwardRef(Link) + to="/" > layout.home - </a> + </ForwardRef(Link)> </div> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/settings/components/AnalysisScope.tsx b/server/sonar-web/src/main/js/apps/settings/components/AnalysisScope.tsx index 0fc1f42e352..0421c0a8528 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/AnalysisScope.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/AnalysisScope.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { translate } from '../../../helpers/l10n'; import { AdditionalCategoryComponentProps } from './AdditionalCategories'; import CategoryDefinitionsList from './CategoryDefinitionsList'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/NewCodePeriod.tsx b/server/sonar-web/src/main/js/apps/settings/components/NewCodePeriod.tsx index 22068cf074b..1fc628761ea 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/NewCodePeriod.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/NewCodePeriod.tsx @@ -19,8 +19,8 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { getNewCodePeriod, setNewCodePeriod } from '../../../api/newCodePeriod'; +import Link from '../../../components/common/Link'; import { ResetButtonLink, SubmitButton } from '../../../components/controls/buttons'; import AlertSuccessIcon from '../../../components/icons/AlertSuccessIcon'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/SettingsSearchRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/SettingsSearchRenderer.tsx index fa9dac8fb38..ffe222aee7d 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/SettingsSearchRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/SettingsSearchRenderer.tsx @@ -19,7 +19,7 @@ */ import classNames from 'classnames'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { DropdownOverlay } from '../../../components/controls/Dropdown'; import OutsideClickHandler from '../../../components/controls/OutsideClickHandler'; import SearchBox from '../../../components/controls/SearchBox'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/AnalysisScope-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/AnalysisScope-test.tsx.snap index 7fccfe01e2f..8f3c70f5740 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/AnalysisScope-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/AnalysisScope-test.tsx.snap @@ -6,12 +6,12 @@ exports[`should render correctly 1`] = ` className="spacer-bottom" > settings.analysis_scope.wildcards.introduction - <Link + <ForwardRef(Link) className="spacer-left" to="/documentation/project-administration/narrowing-the-focus/" > learn_more - </Link> + </ForwardRef(Link)> </p> <table className="data spacer-bottom" diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/NewCodePeriod-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/NewCodePeriod-test.tsx.snap index d5aaaf819a7..80f68b5aa3e 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/NewCodePeriod-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/NewCodePeriod-test.tsx.snap @@ -29,11 +29,11 @@ exports[`should render correctly 1`] = ` id="settings.new_code_period.description" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to="/documentation/project-administration/new-code-period/" > learn_more - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/SettingsSearchRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/SettingsSearchRenderer-test.tsx.snap index 334d84a3098..5ef2dff5980 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/SettingsSearchRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/SettingsSearchRenderer-test.tsx.snap @@ -73,7 +73,7 @@ exports[`should render correctly when open: results 1`] = ` className="spacer-bottom spacer-top" key="foo" > - <Link + <ForwardRef(Link) onClick={[MockFunction]} onMouseEnter={[Function]} to={ @@ -96,13 +96,13 @@ exports[`should render correctly when open: results 1`] = ` > settings.key_x.foo </div> - </Link> + </ForwardRef(Link)> </li> <li className="spacer-bottom spacer-top active" key="bar" > - <Link + <ForwardRef(Link) onClick={[MockFunction]} onMouseEnter={[Function]} to={ @@ -125,7 +125,7 @@ exports[`should render correctly when open: results 1`] = ` > settings.key_x.bar </div> - </Link> + </ForwardRef(Link)> </li> </ul> </DropdownOverlay> diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionBox.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionBox.tsx index 1e5cd961d7d..e13e9a0a946 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionBox.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionBox.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import { Button } from '../../../../components/controls/buttons'; import HelpTooltip from '../../../../components/controls/HelpTooltip'; import Tooltip from '../../../../components/controls/Tooltip'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx index 0fdefb5e2dc..be83d609cbe 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import { ButtonLink } from '../../../../components/controls/buttons'; import ValidationInput, { ValidationInputErrorPlacement diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx index 9405d10f639..102dead85c2 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import { Button } from '../../../../components/controls/buttons'; import { Alert } from '../../../../components/ui/Alert'; import DeferredSpinner from '../../../../components/ui/DeferredSpinner'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx index 3751017ab6a..8cee4e30d84 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants'; import { translate } from '../../../../helpers/l10n'; import { AlmKeys, AzureBindingDefinition } from '../../../../types/alm-settings'; @@ -72,12 +72,11 @@ export default function AzureForm(props: AzureFormProps) { id="settings.almintegration.form.personal_access_token.azure.help" values={{ pat: ( - <a - href="https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate" - rel="noopener noreferrer" + <Link + to="https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate" target="_blank"> {translate('settings.almintegration.form.personal_access_token.azure.help.url')} - </a> + </Link> ), permission: <strong>{'Code > Read & Write'}</strong>, doc_link: ( diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketCloudForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketCloudForm.tsx index e281ea2f167..075775bc4c0 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketCloudForm.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketCloudForm.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import { Alert } from '../../../../components/ui/Alert'; import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants'; import { translate } from '../../../../helpers/l10n'; @@ -83,12 +83,11 @@ export default function BitbucketCloudForm(props: BitbucketCloudFormProps) { id="settings.almintegration.bitbucketcloud.info" values={{ oauth: ( - <a - href="https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/" - rel="noopener noreferrer" + <Link + to="https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/" target="_blank"> {translate('settings.almintegration.bitbucketcloud.oauth')} - </a> + </Link> ), permission: <strong>Pull Requests: Read</strong>, doc_link: ( diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketServerForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketServerForm.tsx index cf472ab7740..2920a0d03d6 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketServerForm.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketServerForm.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants'; import { translate } from '../../../../helpers/l10n'; import { AlmKeys, BitbucketServerBindingDefinition } from '../../../../types/alm-settings'; @@ -68,14 +68,13 @@ export default function BitbucketServerForm(props: BitbucketServerFormProps) { id="settings.almintegration.form.personal_access_token.bitbucket.help" values={{ pat: ( - <a - href="https://confluence.atlassian.com/bitbucketserver0515/personal-access-tokens-961275199.html" - rel="noopener noreferrer" + <Link + to="https://confluence.atlassian.com/bitbucketserver0515/personal-access-tokens-961275199.html" target="_blank"> {translate( 'settings.almintegration.form.personal_access_token.bitbucket.help.url' )} - </a> + </Link> ), permission: <strong>Read</strong>, doc_link: ( diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubForm.tsx index 4aacacfba9d..73b4f4e070e 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubForm.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubForm.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import { Alert } from '../../../../components/ui/Alert'; import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants'; import { translate } from '../../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabForm.tsx index ac2ab98c35d..e0e8f4b5b11 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabForm.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabForm.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants'; import { translate } from '../../../../helpers/l10n'; import { AlmKeys, GitlabBindingDefinition } from '../../../../types/alm-settings'; @@ -67,12 +67,11 @@ export default function GitlabForm(props: GitlabFormProps) { id="settings.almintegration.form.personal_access_token.gitlab.help" values={{ pat: ( - <a - href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html" - rel="noopener noreferrer" + <Link + to="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html" target="_blank"> {translate('settings.almintegration.form.personal_access_token.gitlab.help.url')} - </a> + </Link> ), permission: <strong>Reporter</strong>, scope: <strong>api</strong>, diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmBindingDefinitionBox-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmBindingDefinitionBox-test.tsx.snap index 6ea758b9ec2..188b67245c7 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmBindingDefinitionBox-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmBindingDefinitionBox-test.tsx.snap @@ -522,12 +522,12 @@ exports[`should render correctly: success with alert 1`] = ` id="settings.almintegration.github.additional_permission" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/github-integration/" > learn_more - </Link>, + </ForwardRef(Link)>, } } /> @@ -649,12 +649,12 @@ exports[`should render correctly: success with branches disabled 1`] = ` id="settings.almintegration.github.additional_permission" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/github-integration/" > learn_more - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmBindingDefinitionFormField-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmBindingDefinitionFormField-test.tsx.snap index 0b37d9683d2..8928255a0de 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmBindingDefinitionFormField-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmBindingDefinitionFormField-test.tsx.snap @@ -81,7 +81,7 @@ exports[`should render correctly: encryptable 1`] = ` id="settings.almintegration.form.secret.can_encrypt" values={ Object { - "learn_more": <Link + "learn_more": <ForwardRef(Link) target="_blank" to={ Object { @@ -90,7 +90,7 @@ exports[`should render correctly: encryptable 1`] = ` } > learn_more - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmTabRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmTabRenderer-test.tsx.snap index 5061a09cc58..f6ea40b3c1c 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmTabRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmTabRenderer-test.tsx.snap @@ -548,7 +548,7 @@ exports[`should render correctly with validation: pass the correct key for bitbu id="settings.almintegration.tabs.authentication-moved" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/admin/settings", @@ -557,7 +557,7 @@ exports[`should render correctly with validation: pass the correct key for bitbu } > property.category.authentication - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AzureForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AzureForm-test.tsx.snap index cade0289c9e..fb5e0271cef 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AzureForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AzureForm-test.tsx.snap @@ -41,19 +41,18 @@ exports[`should render correctly: create 1`] = ` id="settings.almintegration.form.personal_access_token.azure.help" values={ Object { - "doc_link": <Link + "doc_link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/azuredevops-integration/" > learn_more - </Link>, - "pat": <a - href="https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate" - rel="noopener noreferrer" + </ForwardRef(Link)>, + "pat": <ForwardRef(Link) target="_blank" + to="https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate" > settings.almintegration.form.personal_access_token.azure.help.url - </a>, + </ForwardRef(Link)>, "permission": <strong> Code > Read & Write </strong>, @@ -114,19 +113,18 @@ exports[`should render correctly: edit 1`] = ` id="settings.almintegration.form.personal_access_token.azure.help" values={ Object { - "doc_link": <Link + "doc_link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/azuredevops-integration/" > learn_more - </Link>, - "pat": <a - href="https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate" - rel="noopener noreferrer" + </ForwardRef(Link)>, + "pat": <ForwardRef(Link) target="_blank" + to="https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate" > settings.almintegration.form.personal_access_token.azure.help.url - </a>, + </ForwardRef(Link)>, "permission": <strong> Code > Read & Write </strong>, diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/BitbucketCloudForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/BitbucketCloudForm-test.tsx.snap index 9d990ce41b2..62a4d83d38f 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/BitbucketCloudForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/BitbucketCloudForm-test.tsx.snap @@ -45,19 +45,18 @@ exports[`should render correctly: default 1`] = ` id="settings.almintegration.bitbucketcloud.info" values={ Object { - "doc_link": <Link + "doc_link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/bitbucket-cloud-integration/" > learn_more - </Link>, - "oauth": <a - href="https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/" - rel="noopener noreferrer" + </ForwardRef(Link)>, + "oauth": <ForwardRef(Link) target="_blank" + to="https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/" > settings.almintegration.bitbucketcloud.oauth - </a>, + </ForwardRef(Link)>, "permission": <strong> Pull Requests: Read </strong>, @@ -132,19 +131,18 @@ exports[`should render correctly: invalid workspace ID 1`] = ` id="settings.almintegration.bitbucketcloud.info" values={ Object { - "doc_link": <Link + "doc_link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/bitbucket-cloud-integration/" > learn_more - </Link>, - "oauth": <a - href="https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/" - rel="noopener noreferrer" + </ForwardRef(Link)>, + "oauth": <ForwardRef(Link) target="_blank" + to="https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/" > settings.almintegration.bitbucketcloud.oauth - </a>, + </ForwardRef(Link)>, "permission": <strong> Pull Requests: Read </strong>, diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/BitbucketServerForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/BitbucketServerForm-test.tsx.snap index ff7ec2649b4..f428bc72620 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/BitbucketServerForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/BitbucketServerForm-test.tsx.snap @@ -36,19 +36,18 @@ exports[`should render correctly 1`] = ` id="settings.almintegration.form.personal_access_token.bitbucket.help" values={ Object { - "doc_link": <Link + "doc_link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/bitbucket-integration/" > learn_more - </Link>, - "pat": <a - href="https://confluence.atlassian.com/bitbucketserver0515/personal-access-tokens-961275199.html" - rel="noopener noreferrer" + </ForwardRef(Link)>, + "pat": <ForwardRef(Link) target="_blank" + to="https://confluence.atlassian.com/bitbucketserver0515/personal-access-tokens-961275199.html" > settings.almintegration.form.personal_access_token.bitbucket.help.url - </a>, + </ForwardRef(Link)>, "permission": <strong> Read </strong>, diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GithubForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GithubForm-test.tsx.snap index 2945edf3857..dc5b1dc32fd 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GithubForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GithubForm-test.tsx.snap @@ -43,12 +43,12 @@ exports[`should render correctly 1`] = ` id="settings.almintegration.github.info" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/github-integration/" > learn_more - </Link>, + </ForwardRef(Link)>, } } /> @@ -136,12 +136,12 @@ exports[`should render correctly 2`] = ` id="settings.almintegration.github.info" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/github-integration/" > learn_more - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GitlabForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GitlabForm-test.tsx.snap index cec311aa194..3b034da6c5a 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GitlabForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GitlabForm-test.tsx.snap @@ -34,19 +34,18 @@ exports[`should render correctly 1`] = ` id="settings.almintegration.form.personal_access_token.gitlab.help" values={ Object { - "doc_link": <Link + "doc_link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/gitlab-integration/" > learn_more - </Link>, - "pat": <a - href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html" - rel="noopener noreferrer" + </ForwardRef(Link)>, + "pat": <ForwardRef(Link) target="_blank" + to="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html" > settings.almintegration.form.personal_access_token.gitlab.help.url - </a>, + </ForwardRef(Link)>, "permission": <strong> Reporter </strong>, @@ -103,19 +102,18 @@ exports[`should render correctly 2`] = ` id="settings.almintegration.form.personal_access_token.gitlab.help" values={ Object { - "doc_link": <Link + "doc_link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/gitlab-integration/" > learn_more - </Link>, - "pat": <a - href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html" - rel="noopener noreferrer" + </ForwardRef(Link)>, + "pat": <ForwardRef(Link) target="_blank" + to="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html" > settings.almintegration.form.personal_access_token.gitlab.help.url - </a>, + </ForwardRef(Link)>, "permission": <strong> Reporter </strong>, diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx index e6bd3a16618..1dc541cf572 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx @@ -19,7 +19,8 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link, useSearchParams } from 'react-router-dom'; +import { useSearchParams } from 'react-router-dom'; +import Link from '../../../../components/common/Link'; import ScreenPositionHelper from '../../../../components/common/ScreenPositionHelper'; import BoxedTabs from '../../../../components/controls/BoxedTabs'; import { Alert } from '../../../../components/ui/Alert'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx index 29376b1af9f..ad01fa26e18 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx @@ -19,10 +19,10 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import withAvailableFeatures, { WithAvailableFeaturesProps } from '../../../../app/components/available-features/withAvailableFeatures'; +import Link from '../../../../components/common/Link'; import Toggle from '../../../../components/controls/Toggle'; import { Alert } from '../../../../components/ui/Alert'; import MandatoryFieldMarker from '../../../../components/ui/MandatoryFieldMarker'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx index cf65a0a9d5e..ff4d0528a6d 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx @@ -19,8 +19,8 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { components, OptionProps, SingleValueProps } from 'react-select'; +import Link from '../../../../components/common/Link'; import { Button, SubmitButton } from '../../../../components/controls/buttons'; import Select from '../../../../components/controls/Select'; import AlertSuccessIcon from '../../../../components/icons/AlertSuccessIcon'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/AlmSpecificForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/AlmSpecificForm-test.tsx.snap index 82c1f025f65..84d74c3840f 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/AlmSpecificForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/AlmSpecificForm-test.tsx.snap @@ -818,12 +818,12 @@ exports[`should render the monorepo field when the feature is supported 1`] = ` id="settings.pr_decoration.binding.form.monorepo.help" values={ Object { - "doc_link": <Link + "doc_link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/azuredevops-integration/" > learn_more - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/PRDecorationBindingRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/PRDecorationBindingRenderer-test.tsx.snap index 4a1dbfb63b8..8e6dce16295 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/PRDecorationBindingRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/PRDecorationBindingRenderer-test.tsx.snap @@ -264,7 +264,7 @@ exports[`should render correctly: when there are configuration errors (admin use id="settings.pr_decoration.binding.check_configuration.failure.check_global_settings" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/admin/settings", @@ -273,7 +273,7 @@ exports[`should render correctly: when there are configuration errors (admin use } > settings.pr_decoration.binding.check_configuration.failure.check_global_settings.link - </Link>, + </ForwardRef(Link)>, } } /> @@ -905,7 +905,7 @@ exports[`should render correctly: with no ALM instances (admin user) 1`] = ` id="settings.pr_decoration.binding.no_bindings.admin" values={ Object { - "link": <Link + "link": <ForwardRef(Link) to={ Object { "pathname": "/admin/settings", @@ -914,7 +914,7 @@ exports[`should render correctly: with no ALM instances (admin user) 1`] = ` } > settings.pr_decoration.binding.no_bindings.link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.tsx b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.tsx index 381a843057b..af24bb91804 100644 --- a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.tsx +++ b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.tsx @@ -19,8 +19,8 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { encryptValue } from '../../../api/settings'; +import Link from '../../../components/common/Link'; import { SubmitButton } from '../../../components/controls/buttons'; import { ClipboardButton } from '../../../components/controls/clipboard'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.tsx b/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.tsx index 6874d6563b7..66c6ecfb3fd 100644 --- a/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.tsx +++ b/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { SubmitButton } from '../../../components/controls/buttons'; import { ClipboardButton } from '../../../components/controls/clipboard'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/__snapshots__/EncryptionForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/__snapshots__/EncryptionForm-test.tsx.snap index c6af518e5fb..4f79df0e425 100644 --- a/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/__snapshots__/EncryptionForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/__snapshots__/EncryptionForm-test.tsx.snap @@ -50,12 +50,12 @@ exports[`should render correctly 1`] = ` id="encryption.form_note" values={ Object { - "moreInformationLink": <Link + "moreInformationLink": <ForwardRef(Link) target="_blank" to="/documentation/instance-administration/security/" > more_information - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/__snapshots__/GenerateSecretKeyForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/__snapshots__/GenerateSecretKeyForm-test.tsx.snap index 4eed71722b2..6073e39503a 100644 --- a/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/__snapshots__/GenerateSecretKeyForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/__snapshots__/GenerateSecretKeyForm-test.tsx.snap @@ -16,12 +16,12 @@ exports[`should render correctly 1`] = ` id="encryption.secret_key_description" values={ Object { - "moreInformationLink": <Link + "moreInformationLink": <ForwardRef(Link) target="_blank" to="/documentation/instance-administration/security/" > more_information - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx index 1b7cfafa7ff..621a0a624b2 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx @@ -19,7 +19,7 @@ */ import classNames from 'classnames'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import LinkIcon from '../../../components/icons/LinkIcon'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { queryToSearch } from '../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx index 8cf0c9623ff..997f5b3c05b 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx @@ -19,7 +19,7 @@ */ import classNames from 'classnames'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { queryToSearch } from '../../../helpers/urls'; import { WebApi } from '../../../types/types'; import { actionsFilter, isDomainPathActive, Query, serializeQuery } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx b/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx index b872548ae65..ce56fd9101d 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx @@ -20,9 +20,10 @@ import { maxBy } from 'lodash'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; -import { Link, Params, useParams } from 'react-router-dom'; +import { Params, useParams } from 'react-router-dom'; import { fetchWebApi } from '../../../api/web-api'; import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; +import Link from '../../../components/common/Link'; import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper'; import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { Location, Router, withRouter } from '../../../components/hoc/withRouter'; diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Action-test.tsx.snap b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Action-test.tsx.snap index af905ee7f55..c01b5c6181d 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Action-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Action-test.tsx.snap @@ -97,7 +97,7 @@ exports[`should render correctly 1`] = ` <header className="web-api-action-header boxed-group-header" > - <Link + <ForwardRef(Link) className="spacer-right link-no-underline" to={ Object { @@ -107,7 +107,7 @@ exports[`should render correctly 1`] = ` } > <LinkIcon /> - </Link> + </ForwardRef(Link)> <h3 className="web-api-action-title" > diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Menu-test.tsx.snap b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Menu-test.tsx.snap index 629742ef918..784c7812d74 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Menu-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Menu-test.tsx.snap @@ -7,7 +7,7 @@ exports[`should also render domains with an actions description matching the que <div className="list-group" > - <Link + <ForwardRef(Link) className="list-group-item" key="bar" to={ @@ -22,8 +22,8 @@ exports[`should also render domains with an actions description matching the que > bar </h3> - </Link> - <Link + </ForwardRef(Link)> + <ForwardRef(Link) className="list-group-item" key="baz" to={ @@ -38,7 +38,7 @@ exports[`should also render domains with an actions description matching the que > baz </h3> - </Link> + </ForwardRef(Link)> </div> </div> `; @@ -50,7 +50,7 @@ exports[`should not render deprecated domains 1`] = ` <div className="list-group" > - <Link + <ForwardRef(Link) className="list-group-item" key="foo" to={ @@ -65,7 +65,7 @@ exports[`should not render deprecated domains 1`] = ` > foo </h3> - </Link> + </ForwardRef(Link)> </div> </div> `; @@ -77,7 +77,7 @@ exports[`should not render internal domains 1`] = ` <div className="list-group" > - <Link + <ForwardRef(Link) className="list-group-item" key="foo" to={ @@ -92,7 +92,7 @@ exports[`should not render internal domains 1`] = ` > foo </h3> - </Link> + </ForwardRef(Link)> </div> </div> `; @@ -104,7 +104,7 @@ exports[`should render deprecated domains 1`] = ` <div className="list-group" > - <Link + <ForwardRef(Link) className="list-group-item" key="foo" to={ @@ -119,8 +119,8 @@ exports[`should render deprecated domains 1`] = ` > foo </h3> - </Link> - <Link + </ForwardRef(Link)> + <ForwardRef(Link) className="list-group-item" key="bar" to={ @@ -138,7 +138,7 @@ exports[`should render deprecated domains 1`] = ` since="5.0" /> </h3> - </Link> + </ForwardRef(Link)> </div> </div> `; @@ -150,7 +150,7 @@ exports[`should render internal domains 1`] = ` <div className="list-group" > - <Link + <ForwardRef(Link) className="list-group-item" key="foo" to={ @@ -165,8 +165,8 @@ exports[`should render internal domains 1`] = ` > foo </h3> - </Link> - <Link + </ForwardRef(Link)> + <ForwardRef(Link) className="list-group-item" key="bar" to={ @@ -182,7 +182,7 @@ exports[`should render internal domains 1`] = ` bar <InternalBadge /> </h3> - </Link> + </ForwardRef(Link)> </div> </div> `; @@ -194,7 +194,7 @@ exports[`should render only domains with an action matching the query 1`] = ` <div className="list-group" > - <Link + <ForwardRef(Link) className="list-group-item" key="foo" to={ @@ -209,7 +209,7 @@ exports[`should render only domains with an action matching the query 1`] = ` > foo </h3> - </Link> + </ForwardRef(Link)> </div> </div> `; diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/WebApiApp-test.tsx.snap b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/WebApiApp-test.tsx.snap index 1fc0062503f..7fea4a5eca3 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/WebApiApp-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/WebApiApp-test.tsx.snap @@ -70,13 +70,13 @@ exports[`should render correctly 2`] = ` <div className="web-api-page-header" > - <Link + <ForwardRef(Link) to="/web_api/" > <h1> api_documentation.page </h1> - </Link> + </ForwardRef(Link)> </div> <Search onSearch={[Function]} diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx index aa994d2db64..e581653e527 100644 --- a/server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx +++ b/server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import { translate } from '../../../helpers/l10n'; interface Props { diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/__snapshots__/PageHeader-test.tsx.snap b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/__snapshots__/PageHeader-test.tsx.snap index 62a0abeeed9..b1cbc315ff3 100644 --- a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/__snapshots__/PageHeader-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/__snapshots__/PageHeader-test.tsx.snap @@ -21,11 +21,11 @@ exports[`should render correctly 1`] = ` id="webhooks.description" values={ Object { - "url": <Link + "url": <ForwardRef(Link) to="/documentation/project-administration/webhooks/" > webhooks.documentation_link - </Link>, + </ForwardRef(Link)>, } } /> 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 7343f6a8420..eed5622d773 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx @@ -18,7 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { ButtonIcon } from '../../components/controls/buttons'; import { ClipboardIconButton } from '../../components/controls/clipboard'; import Dropdown from '../../components/controls/Dropdown'; @@ -42,6 +41,7 @@ import { import { BranchLike } from '../../types/branch-like'; import { ComponentQualifier } from '../../types/component'; import { IssueType, Measure, SourceViewerFile } from '../../types/types'; +import Link from '../common/Link'; import { WorkspaceContextShape } from '../workspace/context'; import MeasuresOverlay from './components/MeasuresOverlay'; diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeader-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeader-test.tsx.snap index 1aa0e65f921..db63a2fa2b5 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeader-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeader-test.tsx.snap @@ -69,7 +69,7 @@ exports[`should render correctly for a regular file 1`] = ` </a> </li> <li> - <Link + <ForwardRef(Link) className="js-new-window" rel="noopener noreferrer" target="_blank" @@ -81,7 +81,7 @@ exports[`should render correctly for a regular file 1`] = ` } > component_viewer.new_window - </Link> + </ForwardRef(Link)> </li> <li> <a @@ -202,7 +202,7 @@ exports[`should render correctly for a unit test 1`] = ` </a> </li> <li> - <Link + <ForwardRef(Link) className="js-new-window" rel="noopener noreferrer" target="_blank" @@ -214,7 +214,7 @@ exports[`should render correctly for a unit test 1`] = ` } > component_viewer.new_window - </Link> + </ForwardRef(Link)> </li> <li> <a @@ -361,7 +361,7 @@ exports[`should render correctly if issue details are passed 1`] = ` <span className="source-viewer-header-measure-value" > - <Link + <ForwardRef(Link) to={ Object { "hash": "", @@ -371,7 +371,7 @@ exports[`should render correctly if issue details are passed 1`] = ` } > 0 - </Link> + </ForwardRef(Link)> </span> </div> <div @@ -386,7 +386,7 @@ exports[`should render correctly if issue details are passed 1`] = ` <span className="source-viewer-header-measure-value" > - <Link + <ForwardRef(Link) to={ Object { "hash": "", @@ -396,7 +396,7 @@ exports[`should render correctly if issue details are passed 1`] = ` } > 2 - </Link> + </ForwardRef(Link)> </span> </div> <div @@ -411,7 +411,7 @@ exports[`should render correctly if issue details are passed 1`] = ` <span className="source-viewer-header-measure-value" > - <Link + <ForwardRef(Link) to={ Object { "hash": "", @@ -421,7 +421,7 @@ exports[`should render correctly if issue details are passed 1`] = ` } > 1 - </Link> + </ForwardRef(Link)> </span> </div> <div @@ -436,7 +436,7 @@ exports[`should render correctly if issue details are passed 1`] = ` <span className="source-viewer-header-measure-value" > - <Link + <ForwardRef(Link) to={ Object { "hash": "", @@ -446,7 +446,7 @@ exports[`should render correctly if issue details are passed 1`] = ` } > 2 - </Link> + </ForwardRef(Link)> </span> </div> </div> @@ -466,7 +466,7 @@ exports[`should render correctly if issue details are passed 1`] = ` </a> </li> <li> - <Link + <ForwardRef(Link) className="js-new-window" rel="noopener noreferrer" target="_blank" @@ -478,7 +478,7 @@ exports[`should render correctly if issue details are passed 1`] = ` } > component_viewer.new_window - </Link> + </ForwardRef(Link)> </li> <li> <a 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 2716924b6c2..1b392a2cb99 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 @@ -19,7 +19,7 @@ */ import { groupBy, sortBy } from 'lodash'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import QualifierIcon from '../../../components/icons/QualifierIcon'; import { Alert } from '../../../components/ui/Alert'; import { isPullRequest } from '../../../helpers/branch-like'; 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 86c8a90e4fd..aba809cc6b6 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 @@ -19,10 +19,10 @@ */ import { groupBy, keyBy, sortBy } from 'lodash'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { getFacets } from '../../../api/issues'; import { getMeasures } from '../../../api/measures'; import { getAllMetrics } from '../../../api/metrics'; +import Link from '../../../components/common/Link'; import { ResetButtonLink } from '../../../components/controls/buttons'; import Modal from '../../../components/controls/Modal'; import IssueTypeIcon from '../../../components/icons/IssueTypeIcon'; 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 6b09bf1ea0b..3327c902762 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 @@ -24,7 +24,7 @@ exports[`should render source file 1`] = ` className="little-spacer-right" qualifier="TRK" /> - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -33,7 +33,7 @@ exports[`should render source file 1`] = ` } > Project Name - </Link> + </ForwardRef(Link)> </div> <div className="display-flex-center little-spacer-top" @@ -588,7 +588,7 @@ exports[`should render source file 2`] = ` className="little-spacer-right" qualifier="TRK" /> - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -597,7 +597,7 @@ exports[`should render source file 2`] = ` } > Project Name - </Link> + </ForwardRef(Link)> </div> <div className="display-flex-center little-spacer-top" @@ -1735,7 +1735,7 @@ exports[`should render test file 1`] = ` className="little-spacer-right" qualifier="TRK" /> - <Link + <ForwardRef(Link) to={ Object { "pathname": "/dashboard", @@ -1744,7 +1744,7 @@ exports[`should render test file 1`] = ` } > Project Name - </Link> + </ForwardRef(Link)> </div> <div className="display-flex-center little-spacer-top" diff --git a/server/sonar-web/src/main/js/components/charts/BubbleChart.tsx b/server/sonar-web/src/main/js/components/charts/BubbleChart.tsx index e1b083003ef..f1bc4005a10 100644 --- a/server/sonar-web/src/main/js/components/charts/BubbleChart.tsx +++ b/server/sonar-web/src/main/js/components/charts/BubbleChart.tsx @@ -24,9 +24,9 @@ import { event, select } from 'd3-selection'; import { zoom, ZoomBehavior, zoomIdentity } from 'd3-zoom'; import { sortBy, uniq } from 'lodash'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer'; import { translate } from '../../helpers/l10n'; +import Link from '../common/Link'; import Tooltip from '../controls/Tooltip'; import './BubbleChart.css'; diff --git a/server/sonar-web/src/main/js/components/charts/TreeMapRect.tsx b/server/sonar-web/src/main/js/components/charts/TreeMapRect.tsx index 3e10e369ac0..40ac38666fa 100644 --- a/server/sonar-web/src/main/js/components/charts/TreeMapRect.tsx +++ b/server/sonar-web/src/main/js/components/charts/TreeMapRect.tsx @@ -20,8 +20,8 @@ import classNames from 'classnames'; import { scaleLinear } from 'd3-scale'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { convertToTo, Location } from '../../helpers/urls'; +import Link from '../common/Link'; import Tooltip, { Placement } from '../controls/Tooltip'; import LinkIcon from '../icons/LinkIcon'; diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/BubbleChart-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/BubbleChart-test.tsx index 4b31a600292..a42768183ab 100644 --- a/server/sonar-web/src/main/js/components/charts/__tests__/BubbleChart-test.tsx +++ b/server/sonar-web/src/main/js/components/charts/__tests__/BubbleChart-test.tsx @@ -21,8 +21,8 @@ import { select } from 'd3-selection'; import { zoom } from 'd3-zoom'; import { shallow } from 'enzyme'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import { AutoSizer, AutoSizerProps } from 'react-virtualized/dist/commonjs/AutoSizer'; +import Link from '../../../components/common/Link'; import { mockComponentMeasureEnhanced } from '../../../helpers/mocks/component'; import { mockHtmlElement } from '../../../helpers/mocks/dom'; import { click, mockEvent } from '../../../helpers/testUtils'; diff --git a/server/sonar-web/src/main/js/components/common/ActivityLink.tsx b/server/sonar-web/src/main/js/components/common/ActivityLink.tsx index 0a4f8fc8698..4bccbb4f0e3 100644 --- a/server/sonar-web/src/main/js/components/common/ActivityLink.tsx +++ b/server/sonar-web/src/main/js/components/common/ActivityLink.tsx @@ -18,7 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import HistoryIcon from '../../components/icons/HistoryIcon'; import { translate } from '../../helpers/l10n'; import { getActivityUrl, getMeasureHistoryUrl } from '../../helpers/urls'; @@ -26,6 +25,7 @@ import { BranchLike } from '../../types/branch-like'; import { GraphType } from '../../types/project-activity'; import { isCustomGraph } from '../activity-graph/utils'; import './ActivityLink.css'; +import Link from './Link'; export interface ActivityLinkProps { branchLike?: BranchLike; diff --git a/server/sonar-web/src/main/js/components/common/DocumentationTooltip.tsx b/server/sonar-web/src/main/js/components/common/DocumentationTooltip.tsx index b1e6b85ee7f..953f5fa6b04 100644 --- a/server/sonar-web/src/main/js/components/common/DocumentationTooltip.tsx +++ b/server/sonar-web/src/main/js/components/common/DocumentationTooltip.tsx @@ -18,10 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; -import { isWebUri } from 'valid-url'; import HelpTooltip from '../../components/controls/HelpTooltip'; -import DetachIcon from '../../components/icons/DetachIcon'; +import Link from './Link'; export interface DocumentationTooltipProps { children?: React.ReactNode; @@ -60,20 +58,9 @@ export default function DocumentationTooltip(props: DocumentationTooltipProps) { // they won't be "clickable"), we hide the whole links section. // See https://sarahmhigley.com/writing/tooltips-in-wcag-21/ aria-hidden={true}> - {inPlace ? ( - <Link to={href}> - <span>{label}</span> - </Link> - ) : ( - <Link - className="display-inline-flex-center" - to={href} - rel="noopener noreferrer" - target="_blank"> - {isWebUri(href) && <DetachIcon size={14} className="spacer-right" />} - <span>{label}</span> - </Link> - )} + <Link to={href} target={inPlace ? undefined : '_blank'}> + {label} + </Link> </div> ))} </> diff --git a/server/sonar-web/src/main/js/components/common/Link.tsx b/server/sonar-web/src/main/js/components/common/Link.tsx new file mode 100644 index 00000000000..527673c6ffd --- /dev/null +++ b/server/sonar-web/src/main/js/components/common/Link.tsx @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2022 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import * as React from 'react'; +import { Link as ReactRouterDomLink, LinkProps as ReactRouterDomLinkProps } from 'react-router-dom'; +import { isWebUri } from 'valid-url'; +import { translate } from '../../helpers/l10n'; +import DetachIcon from '../icons/DetachIcon'; + +type OriginalLinkProps = ReactRouterDomLinkProps & React.RefAttributes<HTMLAnchorElement>; + +export interface LinkProps extends OriginalLinkProps { + size?: number; +} + +const DEFAULT_ICON_SIZE = 14; + +function Link({ children, size, ...props }: LinkProps, ref: React.ForwardedRef<HTMLAnchorElement>) { + if (typeof props.to === 'string' && isWebUri(props.to)) { + // The new React Router DOM's <Link> component no longer supports external links. + // We have to use the <a> element instead. + const { to, ...anchorProps } = props; + return ( + <a + ref={ref} + href={to} + rel={anchorProps.target === '_blank' ? 'noopener noreferrer' : undefined} + {...anchorProps}> + {anchorProps.target === '_blank' && ( + <DetachIcon + ariaLabel={translate('opens_in_new_window')} + size={size || DEFAULT_ICON_SIZE} + className="little-spacer-right" + /> + )} + {children} + </a> + ); + } + + return ( + <ReactRouterDomLink + ref={ref} + rel={props.target === '_blank' ? 'noopener noreferrer' : undefined} + {...props}> + {children} + </ReactRouterDomLink> + ); +} + +export default React.forwardRef(Link); diff --git a/server/sonar-web/src/main/js/components/common/MeasuresLink.tsx b/server/sonar-web/src/main/js/components/common/MeasuresLink.tsx index c3515fc8bfa..b2a1f71b1c7 100644 --- a/server/sonar-web/src/main/js/components/common/MeasuresLink.tsx +++ b/server/sonar-web/src/main/js/components/common/MeasuresLink.tsx @@ -19,11 +19,11 @@ */ import classNames from 'classnames'; import * as React from 'react'; -import { Link } from 'react-router-dom'; import MeasuresIcon from '../../components/icons/MeasuresIcon'; import { translate } from '../../helpers/l10n'; import { getComponentDrilldownUrl } from '../../helpers/urls'; import { BranchLike } from '../../types/branch-like'; +import Link from './Link'; import './MeasuresLink.css'; export interface MeasuresLinkProps { diff --git a/server/sonar-web/src/main/js/components/common/__tests__/Link-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/Link-test.tsx new file mode 100644 index 00000000000..2de4d6ffdcb --- /dev/null +++ b/server/sonar-web/src/main/js/components/common/__tests__/Link-test.tsx @@ -0,0 +1,48 @@ +/* + * SonarQube + * Copyright (C) 2009-2022 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import { screen } from '@testing-library/react'; +import * as React from 'react'; +import { renderComponent } from '../../../helpers/testReactTestingUtils'; +import Link, { LinkProps } from '../Link'; + +it('should correctly render an internal link', () => { + renderLink(); + expect(screen.getByRole('link').getAttribute('rel')).not.toBe('noopener noreferrer'); + expect(screen.queryByLabelText('opens_in_new_window')).not.toBeInTheDocument(); +}); + +it('should correctly render a link that opens in a new window, but is not considered external', () => { + renderLink({ target: '_blank', to: '/path' }); + expect(screen.getByRole('link').getAttribute('rel')).toBe('noopener noreferrer'); +}); + +it('should correctly render an external link', () => { + renderLink({ target: '_blank', to: 'http://example.com' }); + expect(screen.getByRole('link').getAttribute('rel')).toBe('noopener noreferrer'); + expect(screen.getByLabelText('opens_in_new_window')).toBeInTheDocument(); +}); + +function renderLink(props: Partial<LinkProps> = {}) { + return renderComponent( + <Link to={{ pathname: 'to' }} {...props}> + click me + </Link> + ); +} diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ActivityLink-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ActivityLink-test.tsx.snap index 3a792609d92..be6e137c027 100644 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ActivityLink-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/ActivityLink-test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders correctly 1`] = ` -<Link +<ForwardRef(Link) className="activity-link" to={ Object { @@ -17,11 +17,11 @@ exports[`renders correctly 1`] = ` <span> portfolio.activity_link </span> -</Link> +</ForwardRef(Link)> `; exports[`renders correctly 2`] = ` -<Link +<ForwardRef(Link) className="activity-link" to={ Object { @@ -37,11 +37,11 @@ exports[`renders correctly 2`] = ` <span> Foo </span> -</Link> +</ForwardRef(Link)> `; exports[`renders correctly 3`] = ` -<Link +<ForwardRef(Link) className="activity-link" to={ Object { @@ -57,11 +57,11 @@ exports[`renders correctly 3`] = ` <span> portfolio.activity_link </span> -</Link> +</ForwardRef(Link)> `; exports[`renders correctly 4`] = ` -<Link +<ForwardRef(Link) className="activity-link" to={ Object { @@ -77,5 +77,5 @@ exports[`renders correctly 4`] = ` <span> portfolio.activity_link </span> -</Link> +</ForwardRef(Link)> `; diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/DocumentationTooltip-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/DocumentationTooltip-test.tsx.snap index 5c6a804f4e0..88d7984d8e3 100644 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/DocumentationTooltip-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/DocumentationTooltip-test.tsx.snap @@ -77,47 +77,33 @@ exports[`renders correctly: with links 1`] = ` aria-hidden={true} className="little-spacer-bottom" > - <Link - className="display-inline-flex-center" - rel="noopener noreferrer" + <ForwardRef(Link) target="_blank" to="http://link.tosome.place" > - <DetachIcon - className="spacer-right" - size={14} - /> - <span> - external link - </span> - </Link> + external link + </ForwardRef(Link)> </div> <div aria-hidden={true} className="little-spacer-bottom" > - <Link - className="display-inline-flex-center" - rel="noopener noreferrer" + <ForwardRef(Link) target="_blank" to="/documentation/guide" > - <span> - internal link - </span> - </Link> + internal link + </ForwardRef(Link)> </div> <div aria-hidden={true} className="little-spacer-bottom" > - <Link + <ForwardRef(Link) to="/projects" > - <span> - in place - </span> - </Link> + in place + </ForwardRef(Link)> </div> </React.Fragment> </div> diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MeasuresLink-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MeasuresLink-test.tsx.snap index 80224fda5a4..bf85f7d6c3f 100644 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MeasuresLink-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/MeasuresLink-test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders 1`] = ` -<Link +<ForwardRef(Link) className="measures-link" to={ Object { @@ -17,11 +17,11 @@ exports[`renders 1`] = ` <span> portfolio.measures_link </span> -</Link> +</ForwardRef(Link)> `; exports[`renders 2`] = ` -<Link +<ForwardRef(Link) className="measures-link" to={ Object { @@ -37,11 +37,11 @@ exports[`renders 2`] = ` <span> Foo </span> -</Link> +</ForwardRef(Link)> `; exports[`renders 3`] = ` -<Link +<ForwardRef(Link) className="measures-link" to={ Object { @@ -57,5 +57,5 @@ exports[`renders 3`] = ` <span> portfolio.measures_link </span> -</Link> +</ForwardRef(Link)> `; diff --git a/server/sonar-web/src/main/js/components/controls/ActionsDropdown.tsx b/server/sonar-web/src/main/js/components/controls/ActionsDropdown.tsx index e0184dcb0f1..371f5c28f3b 100644 --- a/server/sonar-web/src/main/js/components/controls/ActionsDropdown.tsx +++ b/server/sonar-web/src/main/js/components/controls/ActionsDropdown.tsx @@ -19,7 +19,8 @@ */ import classNames from 'classnames'; import * as React from 'react'; -import { Link, To } from 'react-router-dom'; +import { To } from 'react-router-dom'; +import Link from '../common/Link'; import DropdownIcon from '../icons/DropdownIcon'; import SettingsIcon from '../icons/SettingsIcon'; import { PopupPlacement } from '../ui/popups'; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ActionsDropdown-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ActionsDropdown-test.tsx.snap index 2ebe48a75c0..cb4b9c934d8 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ActionsDropdown-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ActionsDropdown-test.tsx.snap @@ -78,7 +78,7 @@ exports[`ActionsDropdownItem should render correctly 1`] = ` exports[`ActionsDropdownItem should render correctly 2`] = ` <li> - <Link + <ForwardRef(Link) className="foo text-danger" id="baz" to="path/name" @@ -86,7 +86,7 @@ exports[`ActionsDropdownItem should render correctly 2`] = ` <span> Hello world </span> - </Link> + </ForwardRef(Link)> </li> `; diff --git a/server/sonar-web/src/main/js/components/docs/DocLink.tsx b/server/sonar-web/src/main/js/components/docs/DocLink.tsx index 493a652f0fc..78c3228bb92 100644 --- a/server/sonar-web/src/main/js/components/docs/DocLink.tsx +++ b/server/sonar-web/src/main/js/components/docs/DocLink.tsx @@ -18,10 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import withAppStateContext from '../../app/components/app-state/withAppStateContext'; -import DetachIcon from '../../components/icons/DetachIcon'; import { AppState } from '../../types/appstate'; +import Link from '../common/Link'; interface OwnProps { appState: AppState; @@ -71,17 +70,11 @@ export class DocLink extends React.PureComponent<Props> { ); } - return ( - <> - <a href={href} rel="noopener noreferrer" target="_blank" {...other}> - {children} - </a> - <DetachIcon - className="text-muted little-spacer-left little-spacer-right text-baseline" - size={12} - /> - </> - ); + return href ? ( + <Link to={href} target="_blank" size={12} {...other}> + {children} + </Link> + ) : null; } } diff --git a/server/sonar-web/src/main/js/components/docs/DocTooltipLink.tsx b/server/sonar-web/src/main/js/components/docs/DocTooltipLink.tsx index 4074ac970aa..daf1c8c4662 100644 --- a/server/sonar-web/src/main/js/components/docs/DocTooltipLink.tsx +++ b/server/sonar-web/src/main/js/components/docs/DocTooltipLink.tsx @@ -19,9 +19,8 @@ */ import { forEach } from 'lodash'; import * as React from 'react'; -import { Link } from 'react-router-dom'; -import DetachIcon from '../../components/icons/DetachIcon'; import { Dict } from '../../types/types'; +import Link from '../common/Link'; interface OwnProps { customProps?: Dict<string>; @@ -42,18 +41,15 @@ export default function DocTooltipLink({ children, customProps, href, ...other } href = `/documentation/${href.substr(1)}`; return ( - <Link rel="noopener noreferrer" target="_blank" to={href} {...other}> + <Link target="_blank" to={href} {...other}> {children} </Link> ); } - return ( - <> - <a href={href} rel="noopener noreferrer" target="_blank" {...other}> - {children} - </a> - <DetachIcon className="little-spacer-left little-spacer-right text-baseline" size={12} /> - </> - ); + return href ? ( + <Link size={12} to={href} target="_blank" {...other}> + {children} + </Link> + ) : null; } diff --git a/server/sonar-web/src/main/js/components/docs/__tests__/__snapshots__/DocLink-test.tsx.snap b/server/sonar-web/src/main/js/components/docs/__tests__/__snapshots__/DocLink-test.tsx.snap index 2ec3dbe8289..48b6223cb29 100644 --- a/server/sonar-web/src/main/js/components/docs/__tests__/__snapshots__/DocLink-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/docs/__tests__/__snapshots__/DocLink-test.tsx.snap @@ -16,27 +16,21 @@ exports[`should render documentation anchor 1`] = ` `; exports[`should render documentation link 1`] = ` -<Link +<ForwardRef(Link) to="/documentation/foo/bar" > link text -</Link> +</ForwardRef(Link)> `; exports[`should render simple link 1`] = ` -<Fragment> - <a - href="http://sample.com" - rel="noopener noreferrer" - target="_blank" - > - link text - </a> - <DetachIcon - className="text-muted little-spacer-left little-spacer-right text-baseline" - size={12} - /> -</Fragment> +<ForwardRef(Link) + size={12} + target="_blank" + to="http://sample.com" +> + link text +</ForwardRef(Link)> `; exports[`should render sonarqube admin link on sonarqube for admin 1`] = ` @@ -49,12 +43,12 @@ exports[`should render sonarqube admin link on sonarqube for admin 1`] = ` `; exports[`should render sonarqube admin link on sonarqube for admin 2`] = ` -<Link +<ForwardRef(Link) target="_blank" to="/foo/bar" > link text -</Link> +</ForwardRef(Link)> `; exports[`should render sonarqube link on sonarqube 1`] = ` @@ -66,10 +60,10 @@ exports[`should render sonarqube link on sonarqube 1`] = ` `; exports[`should render sonarqube link on sonarqube 2`] = ` -<Link +<ForwardRef(Link) target="_blank" to="/foo/bar" > link text -</Link> +</ForwardRef(Link)> `; diff --git a/server/sonar-web/src/main/js/components/docs/__tests__/__snapshots__/DocTooltipLink-test.tsx.snap b/server/sonar-web/src/main/js/components/docs/__tests__/__snapshots__/DocTooltipLink-test.tsx.snap index 851e357803a..43cac601766 100644 --- a/server/sonar-web/src/main/js/components/docs/__tests__/__snapshots__/DocTooltipLink-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/docs/__tests__/__snapshots__/DocTooltipLink-test.tsx.snap @@ -1,31 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should render internal link 1`] = ` -<Link - rel="noopener noreferrer" +<ForwardRef(Link) target="_blank" to="/documentation/foo/bar" /> `; exports[`should render links with custom props 1`] = ` -<Link - rel="noopener noreferrer" +<ForwardRef(Link) target="_blank" to="/documentation/foo/baz" /> `; exports[`should render simple link 1`] = ` -<Fragment> - <a - href="http://sample.com" - rel="noopener noreferrer" - target="_blank" - /> - <DetachIcon - className="little-spacer-left little-spacer-right text-baseline" - size={12} - /> -</Fragment> +<ForwardRef(Link) + size={12} + target="_blank" + to="http://sample.com" +/> `; diff --git a/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopup.tsx b/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopup.tsx index 4b063dae646..256af65b302 100644 --- a/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopup.tsx +++ b/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopup.tsx @@ -18,10 +18,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { translate } from '../../helpers/l10n'; import { getBaseUrl } from '../../helpers/system'; import { SuggestionLink } from '../../types/types'; +import Link from '../common/Link'; import { DropdownOverlay } from '../controls/Dropdown'; import { SuggestionsContext } from './SuggestionsContext'; @@ -112,9 +112,12 @@ export default class EmbedDocsPopup extends React.PureComponent<Props> { </ul> <ul className="menu abs-width-240" role="group"> <li> - <a href="https://community.sonarsource.com/" rel="noopener noreferrer" target="_blank"> + <Link + className="display-flex-center" + to="https://community.sonarsource.com/" + target="_blank"> {translate('embed_docs.get_help')} - </a> + </Link> </li> </ul> <ul className="menu abs-width-240" role="group"> diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueMessageTags.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueMessageTags.tsx index f681a078916..b4dc65e4647 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueMessageTags.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueMessageTags.tsx @@ -23,6 +23,7 @@ import Tooltip from '../../../components/controls/Tooltip'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { RuleStatus } from '../../../types/rules'; import DocumentationTooltip from '../../common/DocumentationTooltip'; +import Link from '../../common/Link'; import SonarLintIcon from '../../icons/SonarLintIcon'; import { WorkspaceContext } from '../../workspace/context'; @@ -48,12 +49,11 @@ export default function IssueMessageTags(props: IssueMessageTagsProps) { defaultMessage={translate('issue.quick_fix_available_with_sonarlint')} values={{ link: ( - <a - href="https://www.sonarqube.org/sonarlint/?referrer=sonarqube-quick-fix" - rel="noopener noreferrer" + <Link + to="https://www.sonarqube.org/sonarlint/?referrer=sonarqube-quick-fix" target="_blank"> SonarLint - </a> + </Link> ) }} /> diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx index 9b04445d03c..2ada6ced27e 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; +import Link from '../../../components/common/Link'; import Tooltip from '../../../components/controls/Tooltip'; import LinkIcon from '../../../components/icons/LinkIcon'; import { getBranchLikeQuery } from '../../../helpers/branch-like'; 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 be269fd4232..8692df798b0 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 @@ -69,7 +69,7 @@ exports[`should render correctly: default 1`] = ` <div className="issue-meta" > - <Link + <ForwardRef(Link) className="js-issue-permalink link-no-underline" target="_blank" title="permalink" @@ -82,7 +82,7 @@ exports[`should render correctly: default 1`] = ` } > <LinkIcon /> - </Link> + </ForwardRef(Link)> </div> </div> </div> @@ -158,7 +158,7 @@ exports[`should render correctly: with filter 1`] = ` <div className="issue-meta" > - <Link + <ForwardRef(Link) className="js-issue-permalink link-no-underline" target="_blank" title="permalink" @@ -171,7 +171,7 @@ exports[`should render correctly: with filter 1`] = ` } > <LinkIcon /> - </Link> + </ForwardRef(Link)> </div> <div className="issue-meta" @@ -365,7 +365,7 @@ exports[`should render correctly: with multi locations 1`] = ` <div className="issue-meta" > - <Link + <ForwardRef(Link) className="js-issue-permalink link-no-underline" target="_blank" title="permalink" @@ -378,7 +378,7 @@ exports[`should render correctly: with multi locations 1`] = ` } > <LinkIcon /> - </Link> + </ForwardRef(Link)> </div> </div> </div> @@ -521,7 +521,7 @@ exports[`should render correctly: with multi locations and link 1`] = ` <div className="issue-meta" > - <Link + <ForwardRef(Link) target="_blank" to={ Object { @@ -538,12 +538,12 @@ exports[`should render correctly: with multi locations and link 1`] = ` 7 </LocationIndex> </Tooltip> - </Link> + </ForwardRef(Link)> </div> <div className="issue-meta" > - <Link + <ForwardRef(Link) className="js-issue-permalink link-no-underline" target="_blank" title="permalink" @@ -556,7 +556,7 @@ exports[`should render correctly: with multi locations and link 1`] = ` } > <LinkIcon /> - </Link> + </ForwardRef(Link)> </div> </div> </div> diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetTransitionPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetTransitionPopup.tsx index d63242fc68f..7105e258d82 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/SetTransitionPopup.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/SetTransitionPopup.tsx @@ -21,6 +21,7 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { DropdownOverlay } from '../../../components/controls/Dropdown'; import { translate } from '../../../helpers/l10n'; +import Link from '../../common/Link'; import SelectList from '../../common/SelectList'; import SelectListItem from '../../common/SelectListItem'; @@ -55,9 +56,9 @@ function translateTransition(transition: string) { id={`issue.transition.${transition}.description`} values={{ community_plug_link: ( - <a href="https://community.sonarsource.com/" rel="noopener noreferrer" target="_blank"> + <Link to="https://community.sonarsource.com/" target="_blank"> {translate('issue.transition.community_plug_link')} - </a> + </Link> ) }} /> diff --git a/server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx b/server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx index 5651f7aa78b..d4d4a060829 100644 --- a/server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx +++ b/server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx @@ -19,9 +19,9 @@ */ import * as React from 'react'; import { translate } from '../../helpers/l10n'; +import Link from '../common/Link'; import CheckIcon from '../icons/CheckIcon'; import ClearIcon from '../icons/ClearIcon'; -import DetachIcon from '../icons/DetachIcon'; export default function OtherContextOption() { return ( @@ -41,13 +41,11 @@ export default function OtherContextOption() { </p> <h2>{translate('coding_rules.context.others.title_feedback')}</h2> <p>{translate('coding_rules.context.others.feedback_description_1')}</p> - <a - href="https://portal.productboard.com/sonarsource/3-sonarqube/submit-idea" - rel="noopener noreferrer" + <Link + to="https://portal.productboard.com/sonarsource/3-sonarqube/submit-idea" target="_blank"> {translate('coding_rules.context.others.feedback_description.link')} - <DetachIcon className="spacer-left" /> - </a> + </Link> <p>{translate('coding_rules.context.others.feedback_description_2')}</p> </> ); diff --git a/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx b/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx index def276b3bee..7d7a6bf9740 100644 --- a/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx +++ b/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx @@ -18,12 +18,12 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { getBranchLikeQuery } from '../../helpers/branch-like'; import { getComponentDrilldownUrl, getComponentIssuesUrl } from '../../helpers/urls'; import { BranchLike } from '../../types/branch-like'; import { MetricKey } from '../../types/metrics'; import { Dict } from '../../types/types'; +import Link from '../common/Link'; const ISSUE_MEASURES = [ MetricKey.violations, diff --git a/server/sonar-web/src/main/js/components/shared/__tests__/__snapshots__/DrilldownLink-test.tsx.snap b/server/sonar-web/src/main/js/components/shared/__tests__/__snapshots__/DrilldownLink-test.tsx.snap index e09cd6d4cd1..df74dc65e71 100644 --- a/server/sonar-web/src/main/js/components/shared/__tests__/__snapshots__/DrilldownLink-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/shared/__tests__/__snapshots__/DrilldownLink-test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should render correctly 1`] = ` -<Link +<ForwardRef(Link) to={ Object { "pathname": "/component_measures", @@ -10,11 +10,11 @@ exports[`should render correctly 1`] = ` } > label -</Link> +</ForwardRef(Link)> `; exports[`should render issuesLink correctly 1`] = ` -<Link +<ForwardRef(Link) to={ Object { "hash": "", @@ -24,5 +24,5 @@ exports[`should render issuesLink correctly 1`] = ` } > label -</Link> +</ForwardRef(Link)> `; diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ExtensionInstallationStepContent.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ExtensionInstallationStepContent.tsx index e5430f35184..eff9bb3e535 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ExtensionInstallationStepContent.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ExtensionInstallationStepContent.tsx @@ -20,6 +20,7 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { translate } from '../../../helpers/l10n'; +import Link from '../../common/Link'; export default function ExtensionInstallationStepContent() { return ( @@ -31,14 +32,13 @@ export default function ExtensionInstallationStepContent() { id="onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.sentence" values={{ link: ( - <a - href="https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube" - rel="noopener noreferrer" + <Link + to="https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube" target="_blank"> {translate( 'onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.sentence.link' )} - </a> + </Link> ), button: ( <strong> diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/ExtensionInstallationStepContent-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/ExtensionInstallationStepContent-test.tsx.snap index 9a8c93a3e5f..e8b50f4347e 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/ExtensionInstallationStepContent-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/__snapshots__/ExtensionInstallationStepContent-test.tsx.snap @@ -10,13 +10,12 @@ exports[`should render correctly 1`] = ` "button": <strong> onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.sentence.button </strong>, - "link": <a - href="https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube" > onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.sentence.link - </a>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/AlertClassicEditor.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/AlertClassicEditor.tsx index ae64c89960d..1aa48b199d7 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/AlertClassicEditor.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/AlertClassicEditor.tsx @@ -19,11 +19,11 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { Alert } from '../../../../components/ui/Alert'; import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants'; import { translate } from '../../../../helpers/l10n'; import { AlmKeys } from '../../../../types/alm-settings'; +import Link from '../../../common/Link'; export default function AlertClassicEditor() { return ( diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PublishSteps.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PublishSteps.tsx index 665d729a0d5..a259ac50553 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PublishSteps.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PublishSteps.tsx @@ -19,13 +19,13 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import withAppStateContext from '../../../../app/components/app-state/withAppStateContext'; import { Alert } from '../../../../components/ui/Alert'; import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants'; import { translate } from '../../../../helpers/l10n'; import { AlmKeys } from '../../../../types/alm-settings'; import { AppState } from '../../../../types/appstate'; +import Link from '../../../common/Link'; import SentenceWithHighlights from '../../components/SentenceWithHighlights'; export interface PublishStepsProps { diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/AlertClassicEditor-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/AlertClassicEditor-test.tsx.snap index a9a6864ee29..21628b7c6ee 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/AlertClassicEditor-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/AlertClassicEditor-test.tsx.snap @@ -10,12 +10,12 @@ exports[`should render correctly 1`] = ` id="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.info" values={ Object { - "doc_link": <Link + "doc_link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/azuredevops-integration/" > onboarding.tutorial.with.azure_pipelines.BranchAnalysis.info.doc_link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/PublishSteps-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/PublishSteps-test.tsx.snap index 13c0f03e6f9..091a7fb5cd3 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/PublishSteps-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/__tests__/__snapshots__/PublishSteps-test.tsx.snap @@ -67,12 +67,12 @@ exports[`should render correctly 2`] = ` id="onboarding.tutorial.with.azure_pipelines.BranchAnalysis.branch_protection" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/azuredevops-integration/" > onboarding.tutorial.with.azure_pipelines.BranchAnalysis.branch_protection.link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/components/EditTokenModal.tsx b/server/sonar-web/src/main/js/components/tutorials/components/EditTokenModal.tsx index 6f09c905b84..622f0a2b486 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/EditTokenModal.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/EditTokenModal.tsx @@ -19,7 +19,6 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { generateToken, getTokens, revokeToken } from '../../../api/user-tokens'; import { Button, DeleteButton } from '../../../components/controls/buttons'; import { ClipboardIconButton } from '../../../components/controls/clipboard'; @@ -35,6 +34,7 @@ import { import { TokenExpiration, TokenType } from '../../../types/token'; import { Component } from '../../../types/types'; import { LoggedInUser } from '../../../types/users'; +import Link from '../../common/Link'; import Select from '../../controls/Select'; import { getUniqueTokenName } from '../utils'; diff --git a/server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx b/server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx index 57925ce1208..f9f41a4bd2b 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx @@ -21,6 +21,7 @@ import classNames from 'classnames'; import React from 'react'; import { translate } from '../../../helpers/l10n'; import { getBaseUrl } from '../../../helpers/system'; +import Link from '../../common/Link'; import { OSs, TutorialModes } from '../types'; import './GithubCFamilyExampleRepositories.css'; @@ -68,9 +69,9 @@ export default function GithubCFamilyExampleRepositories( height={20} src={`${getBaseUrl()}/images/alm/github.svg`} /> - <a className="spacer-left big" rel="noopener noreferrer" target="_blank" href={link}> + <Link className="spacer-left big" target="_blank" to={link}> sonarsource-cfamily-examples - </a> + </Link> </div> <p className="spacer-top"> {translate('onboarding.tutorial.cfamily.examples_repositories_description')} diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/GithubCFamilyExampleRepositories-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/GithubCFamilyExampleRepositories-test.tsx.snap index 15c783d362b..14cb44eb1f0 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/GithubCFamilyExampleRepositories-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/GithubCFamilyExampleRepositories-test.tsx.snap @@ -13,14 +13,13 @@ exports[`should render correctly 1`] = ` height={20} src="/images/alm/github.svg" /> - <a + <ForwardRef(Link) className="spacer-left big" - href="https://github.com/orgs/sonarsource-cfamily-examples/repositories?q=sq" - rel="noopener noreferrer" target="_blank" + to="https://github.com/orgs/sonarsource-cfamily-examples/repositories?q=sq" > sonarsource-cfamily-examples - </a> + </ForwardRef(Link)> </div> <p className="spacer-top" @@ -43,14 +42,13 @@ exports[`should render correctly 2`] = ` height={20} src="/images/alm/github.svg" /> - <a + <ForwardRef(Link) className="spacer-left big" - href="https://github.com/orgs/sonarsource-cfamily-examples/repositories?q=sq+macos+azure" - rel="noopener noreferrer" target="_blank" + to="https://github.com/orgs/sonarsource-cfamily-examples/repositories?q=sq+macos+azure" > sonarsource-cfamily-examples - </a> + </ForwardRef(Link)> </div> <p className="spacer-top" diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/PreRequisitesStep.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/PreRequisitesStep.tsx index 6e068484065..f2c4a4d2339 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/PreRequisitesStep.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/PreRequisitesStep.tsx @@ -19,13 +19,13 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { rawSizes } from '../../../app/theme'; import { Button } from '../../../components/controls/buttons'; import ChevronRightIcon from '../../../components/icons/ChevronRightIcon'; import { Alert } from '../../../components/ui/Alert'; import { translate } from '../../../helpers/l10n'; import { AlmKeys } from '../../../types/alm-settings'; +import Link from '../../common/Link'; import SentenceWithHighlights from '../components/SentenceWithHighlights'; import Step from '../components/Step'; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepBitbucket.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepBitbucket.tsx index e2cba1c6793..16c635a7421 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepBitbucket.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepBitbucket.tsx @@ -28,6 +28,7 @@ import { ProjectAlmBindingResponse } from '../../../types/alm-settings'; import CodeSnippet from '../../common/CodeSnippet'; +import Link from '../../common/Link'; import LabelActionPair from '../components/LabelActionPair'; import SentenceWithHighlights from '../components/SentenceWithHighlights'; import { buildBitbucketCloudLink } from '../utils'; @@ -79,9 +80,9 @@ export default function WebhookStepBitbucket(props: WebhookStepBitbucketProps) { id="onboarding.tutorial.with.jenkins.webhook.step1.sentence" values={{ link: linkUrl ? ( - <a href={linkUrl} rel="noopener noreferrer" target="_blank"> + <Link to={linkUrl} target="_blank"> {translate('onboarding.tutorial.with.jenkins.webhook', alm, 'step1.link')} - </a> + </Link> ) : ( <strong> {translate('onboarding.tutorial.with.jenkins.webhook', alm, 'step1.link')} diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGithub.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGithub.tsx index d5248bd8b8c..685f8a13b05 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGithub.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGithub.tsx @@ -22,6 +22,7 @@ import { FormattedMessage } from 'react-intl'; import { translate } from '../../../helpers/l10n'; import { AlmSettingsInstance, ProjectAlmBindingResponse } from '../../../types/alm-settings'; import CodeSnippet from '../../common/CodeSnippet'; +import Link from '../../common/Link'; import LabelActionPair from '../components/LabelActionPair'; import SentenceWithHighlights from '../components/SentenceWithHighlights'; import { buildGithubLink } from '../utils'; @@ -50,9 +51,9 @@ export default function WebhookStepGithub(props: WebhookStepGithubProps) { id="onboarding.tutorial.with.jenkins.webhook.step1.sentence" values={{ link: linkUrl ? ( - <a href={linkUrl} rel="noopener noreferrer" target="_blank"> + <Link to={linkUrl} target="_blank"> {translate('onboarding.tutorial.with.jenkins.webhook.github.step1.link')} - </a> + </Link> ) : ( <strong> {translate('onboarding.tutorial.with.jenkins.webhook.github.step1.link')} diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/PreRequisitesStep-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/PreRequisitesStep-test.tsx.snap index 091b72035d8..eba200ef8ff 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/PreRequisitesStep-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/PreRequisitesStep-test.tsx.snap @@ -46,12 +46,12 @@ exports[`should render correctly: content 1`] = ` id="onboarding.tutorial.with.jenkins.prereqs.step_by_step_guide" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/jenkins/" > onboarding.tutorial.with.jenkins.prereqs.step_by_step_guide.link - </Link>, + </ForwardRef(Link)>, } } /> @@ -106,12 +106,12 @@ exports[`should render correctly: content for branches disabled 1`] = ` id="onboarding.tutorial.with.jenkins.prereqs.step_by_step_guide" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/jenkins/" > onboarding.tutorial.with.jenkins.prereqs.step_by_step_guide.link - </Link>, + </ForwardRef(Link)>, } } /> @@ -169,12 +169,12 @@ exports[`should render correctly: content for branches disabled, gitlab 1`] = ` id="onboarding.tutorial.with.jenkins.prereqs.step_by_step_guide" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/jenkins/" > onboarding.tutorial.with.jenkins.prereqs.step_by_step_guide.link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStepBitbucket-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStepBitbucket-test.tsx.snap index e12a985c465..cdc06c83744 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStepBitbucket-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStepBitbucket-test.tsx.snap @@ -8,13 +8,12 @@ exports[`should render correctly for bitbucket 1`] = ` id="onboarding.tutorial.with.jenkins.webhook.step1.sentence" values={ Object { - "link": <a - href="http://bbs.enterprise.com/plugins/servlet/webhooks/projects/PROJECT_KEY/repos/repo-slug/create" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="http://bbs.enterprise.com/plugins/servlet/webhooks/projects/PROJECT_KEY/repos/repo-slug/create" > onboarding.tutorial.with.jenkins.webhook.bitbucket.step1.link - </a>, + </ForwardRef(Link)>, } } /> @@ -91,13 +90,12 @@ exports[`should render correctly for bitbucket: with branches disabled 1`] = ` id="onboarding.tutorial.with.jenkins.webhook.step1.sentence" values={ Object { - "link": <a - href="http://bbs.enterprise.com/plugins/servlet/webhooks/projects/PROJECT_KEY/repos/repo-slug/create" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="http://bbs.enterprise.com/plugins/servlet/webhooks/projects/PROJECT_KEY/repos/repo-slug/create" > onboarding.tutorial.with.jenkins.webhook.bitbucket.step1.link - </a>, + </ForwardRef(Link)>, } } /> @@ -243,13 +241,12 @@ exports[`should render correctly for bitbucketcloud 1`] = ` id="onboarding.tutorial.with.jenkins.webhook.step1.sentence" values={ Object { - "link": <a - href="http://bitbucket.org/workspace/repo-slug/admin/addon/admin/bitbucket-webhooks/bb-webhooks-repo-admin" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="http://bitbucket.org/workspace/repo-slug/admin/addon/admin/bitbucket-webhooks/bb-webhooks-repo-admin" > onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step1.link - </a>, + </ForwardRef(Link)>, } } /> @@ -322,13 +319,12 @@ exports[`should render correctly for bitbucketcloud: with branches disabled 1`] id="onboarding.tutorial.with.jenkins.webhook.step1.sentence" values={ Object { - "link": <a - href="http://bitbucket.org/workspace/repo-slug/admin/addon/admin/bitbucket-webhooks/bb-webhooks-repo-admin" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="http://bitbucket.org/workspace/repo-slug/admin/addon/admin/bitbucket-webhooks/bb-webhooks-repo-admin" > onboarding.tutorial.with.jenkins.webhook.bitbucketcloud.step1.link - </a>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStepGithub-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStepGithub-test.tsx.snap index da3946e015c..65331dfacaf 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStepGithub-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStepGithub-test.tsx.snap @@ -8,13 +8,12 @@ exports[`should render correctly 1`] = ` id="onboarding.tutorial.with.jenkins.webhook.step1.sentence" values={ Object { - "link": <a - href="http://github.enterprise.com/PROJECT_KEY/settings/hooks" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="http://github.enterprise.com/PROJECT_KEY/settings/hooks" > onboarding.tutorial.with.jenkins.webhook.github.step1.link - </a>, + </ForwardRef(Link)>, } } /> @@ -82,13 +81,12 @@ exports[`should render correctly: with branches disabled 1`] = ` id="onboarding.tutorial.with.jenkins.webhook.step1.sentence" values={ Object { - "link": <a - href="http://github.enterprise.com/PROJECT_KEY/settings/hooks" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="http://github.enterprise.com/PROJECT_KEY/settings/hooks" > onboarding.tutorial.with.jenkins.webhook.github.step1.link - </a>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/other/DoneNextSteps.tsx b/server/sonar-web/src/main/js/components/tutorials/other/DoneNextSteps.tsx index df037f76a29..292bdc4387e 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/DoneNextSteps.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/DoneNextSteps.tsx @@ -19,9 +19,9 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { translate } from '../../../helpers/l10n'; import { Component } from '../../../types/types'; +import Link from '../../common/Link'; export interface DoneNextStepsProps { component: Component; diff --git a/server/sonar-web/src/main/js/components/tutorials/other/TokenStep.tsx b/server/sonar-web/src/main/js/components/tutorials/other/TokenStep.tsx index d6d90862506..63f9725f011 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/TokenStep.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/TokenStep.tsx @@ -19,7 +19,6 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { generateToken, getTokens, revokeToken } from '../../../api/user-tokens'; import { translate } from '../../../helpers/l10n'; import { @@ -30,6 +29,7 @@ import { import { TokenExpiration, TokenType, UserToken } from '../../../types/token'; import { LoggedInUser } from '../../../types/users'; import DocumentationTooltip from '../../common/DocumentationTooltip'; +import Link from '../../common/Link'; import { Button, DeleteButton, SubmitButton } from '../../controls/buttons'; import Radio from '../../controls/Radio'; import Select from '../../controls/Select'; diff --git a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/DoneNextSteps-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/DoneNextSteps-test.tsx.snap index 31694bcce7b..c5c553d1340 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/DoneNextSteps-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/DoneNextSteps-test.tsx.snap @@ -25,20 +25,20 @@ exports[`should render correctly: default 1`] = ` id="onboarding.analysis.auto_refresh_after_analysis.check_these_links" values={ Object { - "link_branches": <Link + "link_branches": <ForwardRef(Link) rel="noopener noreferrer" target="_blank" to="/documentation/branches/overview/" > onboarding.analysis.auto_refresh_after_analysis.check_these_links.branches - </Link>, - "link_pr_analysis": <Link + </ForwardRef(Link)>, + "link_pr_analysis": <ForwardRef(Link) rel="noopener noreferrer" target="_blank" to="/documentation/analysis/pull-request/" > onboarding.analysis.auto_refresh_after_analysis.check_these_links.pr_analysis - </Link>, + </ForwardRef(Link)>, } } /> @@ -71,20 +71,20 @@ exports[`should render correctly: project admin 1`] = ` id="onboarding.analysis.auto_refresh_after_analysis.check_these_links" values={ Object { - "link_branches": <Link + "link_branches": <ForwardRef(Link) rel="noopener noreferrer" target="_blank" to="/documentation/branches/overview/" > onboarding.analysis.auto_refresh_after_analysis.check_these_links.branches - </Link>, - "link_pr_analysis": <Link + </ForwardRef(Link)>, + "link_pr_analysis": <ForwardRef(Link) rel="noopener noreferrer" target="_blank" to="/documentation/analysis/pull-request/" > onboarding.analysis.auto_refresh_after_analysis.check_these_links.pr_analysis - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/TokenStep-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/TokenStep-test.tsx.snap index 2c05c134d6a..caeabbe63ae 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/TokenStep-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/TokenStep-test.tsx.snap @@ -144,12 +144,12 @@ exports[`generates token 1`] = ` id="onboarding.token.text" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/account/security" > onboarding.token.text.user_account - </Link>, + </ForwardRef(Link)>, } } /> @@ -300,12 +300,12 @@ exports[`generates token 2`] = ` id="onboarding.token.text" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/account/security" > onboarding.token.text.user_account - </Link>, + </ForwardRef(Link)>, } } /> @@ -364,12 +364,12 @@ exports[`generates token 3`] = ` id="onboarding.token.text" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/account/security" > onboarding.token.text.user_account - </Link>, + </ForwardRef(Link)>, } } /> @@ -438,12 +438,12 @@ exports[`revokes token 1`] = ` id="onboarding.token.text" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/account/security" > onboarding.token.text.user_account - </Link>, + </ForwardRef(Link)>, } } /> @@ -511,12 +511,12 @@ exports[`revokes token 2`] = ` id="onboarding.token.text" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/account/security" > onboarding.token.text.user_account - </Link>, + </ForwardRef(Link)>, } } /> @@ -680,12 +680,12 @@ exports[`revokes token 3`] = ` id="onboarding.token.text" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/account/security" > onboarding.token.text.user_account - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetExecute.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetExecute.tsx index b2840c55b8e..2a97d7cb8b2 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetExecute.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetExecute.tsx @@ -19,11 +19,11 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { translate } from '../../../../helpers/l10n'; import { Component } from '../../../../types/types'; import CodeSnippet from '../../../common/CodeSnippet'; import InstanceMessage from '../../../common/InstanceMessage'; +import Link from '../../../common/Link'; import DoneNextSteps from '../DoneNextSteps'; export interface DotNetExecuteProps { diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx index daab033765a..b8846a24cb8 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx @@ -20,6 +20,7 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { translate } from '../../../../helpers/l10n'; +import Link from '../../../common/Link'; import { DotNetProps } from './DotNet'; import DotNetExecute from './DotNetExecute'; @@ -45,12 +46,11 @@ export default function DotNetFramework(props: DotNetProps) { values={{ code: <code>%PATH%</code>, link: ( - <a - href="https://redirect.sonarsource.com/doc/download-scanner-msbuild.html" - rel="noopener noreferrer" + <Link + to="https://redirect.sonarsource.com/doc/download-scanner-msbuild.html" target="_blank"> {translate('onboarding.analysis.msbuild.docs_link')} - </a> + </Link> ) }} /> diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx index ba9866a8b58..b9e5ed78304 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx @@ -21,6 +21,7 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { translate } from '../../../../helpers/l10n'; import CodeSnippet from '../../../common/CodeSnippet'; +import Link from '../../../common/Link'; import { ClipboardButton } from '../../../controls/clipboard'; import { OSs } from '../../types'; @@ -45,12 +46,11 @@ export default function DownloadScanner(props: DownloadScannerProps) { dir: <code>bin</code>, env_var: <code>{os === OSs.Windows ? '%PATH%' : 'PATH'}</code>, link: ( - <a - href="https://redirect.sonarsource.com/doc/download-scanner.html" - rel="noopener noreferrer" + <Link + to="https://redirect.sonarsource.com/doc/download-scanner.html" target="_blank"> {translate('onboarding.analysis.sq_scanner.docs_link')} - </a> + </Link> ) }} /> diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecBuildWrapper.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecBuildWrapper.tsx index a359e2bae1a..8d752b03e12 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecBuildWrapper.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecBuildWrapper.tsx @@ -19,9 +19,9 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { translate } from '../../../../helpers/l10n'; import CodeSnippet from '../../../common/CodeSnippet'; +import Link from '../../../common/Link'; import { OSs } from '../../types'; export interface ExecBuildWrapperProps { diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx index 32cb66a4e71..c1d2c035f18 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx @@ -19,11 +19,11 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { translate } from '../../../../helpers/l10n'; import { Component } from '../../../../types/types'; import CodeSnippet from '../../../common/CodeSnippet'; import InstanceMessage from '../../../common/InstanceMessage'; +import Link from '../../../common/Link'; import { OSs } from '../../types'; import { quote } from '../../utils'; import DoneNextSteps from '../DoneNextSteps'; diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx index b640f69b70a..afe3ed0030d 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx @@ -19,11 +19,11 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { translate } from '../../../../helpers/l10n'; import { Component } from '../../../../types/types'; import CodeSnippet from '../../../common/CodeSnippet'; import InstanceMessage from '../../../common/InstanceMessage'; +import Link from '../../../common/Link'; import DoneNextSteps from '../DoneNextSteps'; export interface JavaGradleProps { diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx index f56b9be740e..5a939f2a36c 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx @@ -19,11 +19,11 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { translate } from '../../../../helpers/l10n'; import { Component } from '../../../../types/types'; import CodeSnippet from '../../../common/CodeSnippet'; import InstanceMessage from '../../../common/InstanceMessage'; +import Link from '../../../common/Link'; import DoneNextSteps from '../DoneNextSteps'; export interface JavaMavenProps { diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DotNetExecute-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DotNetExecute-test.tsx.snap index a921c78ff66..8c2722936e3 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DotNetExecute-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DotNetExecute-test.tsx.snap @@ -28,12 +28,12 @@ exports[`should render correctly 1`] = ` id="onboarding.analysis.docs" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/scan/sonarscanner-for-msbuild/" > onboarding.analysis.msbuild.docs_link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DotNetFramework-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DotNetFramework-test.tsx.snap index 13edb7d7370..df672edf162 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DotNetFramework-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DotNetFramework-test.tsx.snap @@ -19,13 +19,12 @@ exports[`should render correctly 1`] = ` "code": <code> %PATH% </code>, - "link": <a - href="https://redirect.sonarsource.com/doc/download-scanner-msbuild.html" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="https://redirect.sonarsource.com/doc/download-scanner-msbuild.html" > onboarding.analysis.msbuild.docs_link - </a>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DownloadScanner-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DownloadScanner-test.tsx.snap index 60bf449f25b..bcd72311a9d 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DownloadScanner-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/DownloadScanner-test.tsx.snap @@ -21,13 +21,12 @@ exports[`should render correctly for "linux": local 1`] = ` "env_var": <code> PATH </code>, - "link": <a - href="https://redirect.sonarsource.com/doc/download-scanner.html" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="https://redirect.sonarsource.com/doc/download-scanner.html" > onboarding.analysis.sq_scanner.docs_link - </a>, + </ForwardRef(Link)>, } } /> @@ -112,13 +111,12 @@ exports[`should render correctly for "mac": local 1`] = ` "env_var": <code> PATH </code>, - "link": <a - href="https://redirect.sonarsource.com/doc/download-scanner.html" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="https://redirect.sonarsource.com/doc/download-scanner.html" > onboarding.analysis.sq_scanner.docs_link - </a>, + </ForwardRef(Link)>, } } /> @@ -203,13 +201,12 @@ exports[`should render correctly for "win": local 1`] = ` "env_var": <code> %PATH% </code>, - "link": <a - href="https://redirect.sonarsource.com/doc/download-scanner.html" - rel="noopener noreferrer" + "link": <ForwardRef(Link) target="_blank" + to="https://redirect.sonarsource.com/doc/download-scanner.html" > onboarding.analysis.sq_scanner.docs_link - </a>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/ExecBuildWrapper-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/ExecBuildWrapper-test.tsx.snap index 68e585ff320..4060e8cf706 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/ExecBuildWrapper-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/ExecBuildWrapper-test.tsx.snap @@ -23,12 +23,12 @@ exports[`Shoud renders for "linux" correctly 1`] = ` id="onboarding.analysis.build_wrapper.docs" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/languages/cfamily/" > onboarding.analysis.build_wrapper.docs_link - </Link>, + </ForwardRef(Link)>, } } /> @@ -59,12 +59,12 @@ exports[`Shoud renders for "mac" correctly 1`] = ` id="onboarding.analysis.build_wrapper.docs" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/languages/cfamily/" > onboarding.analysis.build_wrapper.docs_link - </Link>, + </ForwardRef(Link)>, } } /> @@ -95,12 +95,12 @@ exports[`Shoud renders for "win" correctly 1`] = ` id="onboarding.analysis.build_wrapper.docs" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/languages/cfamily/" > onboarding.analysis.build_wrapper.docs_link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/ExecScanner-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/ExecScanner-test.tsx.snap index 5b50e97c353..b4b780f819f 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/ExecScanner-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/ExecScanner-test.tsx.snap @@ -33,12 +33,12 @@ exports[`should render correctly for "linux" 1`] = ` id="onboarding.analysis.sq_scanner.docs" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/scan/sonarscanner/" > onboarding.analysis.sq_scanner.docs_link - </Link>, + </ForwardRef(Link)>, } } /> @@ -103,12 +103,12 @@ exports[`should render correctly for "mac" 1`] = ` id="onboarding.analysis.sq_scanner.docs" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/scan/sonarscanner/" > onboarding.analysis.sq_scanner.docs_link - </Link>, + </ForwardRef(Link)>, } } /> @@ -173,12 +173,12 @@ exports[`should render correctly for "win" 1`] = ` id="onboarding.analysis.sq_scanner.docs" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/scan/sonarscanner/" > onboarding.analysis.sq_scanner.docs_link - </Link>, + </ForwardRef(Link)>, } } /> @@ -243,12 +243,12 @@ exports[`should render correctly for cfamily 1`] = ` id="onboarding.analysis.sq_scanner.docs" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/scan/sonarscanner/" > onboarding.analysis.sq_scanner.docs_link - </Link>, + </ForwardRef(Link)>, } } /> @@ -313,12 +313,12 @@ exports[`should render correctly for remote execution 1`] = ` id="onboarding.analysis.sq_scanner.docs" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/scan/sonarscanner/" > onboarding.analysis.sq_scanner.docs_link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap index fc132dddb80..a980bc7303e 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/JavaGradle-test.tsx.snap @@ -28,12 +28,12 @@ exports[`renders correctly 1`] = ` id="onboarding.analysis.java.gradle.latest_version" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/scan/sonarscanner-for-gradle/" > here - </Link>, + </ForwardRef(Link)>, } } /> @@ -62,12 +62,12 @@ exports[`renders correctly 1`] = ` id="onboarding.analysis.docs" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/scan/sonarscanner-for-gradle/" > onboarding.analysis.java.gradle.docs_link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap index 970c7f620cc..f91c2cc29cc 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/__snapshots__/JavaMaven-test.tsx.snap @@ -32,12 +32,12 @@ exports[`renders correctly 1`] = ` id="onboarding.analysis.docs" values={ Object { - "link": <Link + "link": <ForwardRef(Link) target="_blank" to="/documentation/analysis/scan/sonarscanner-for-maven/" > onboarding.analysis.java.maven.docs_link - </Link>, + </ForwardRef(Link)>, } } /> diff --git a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx index d78e057f2f6..b66d51822bb 100644 --- a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx +++ b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx @@ -24,6 +24,7 @@ import { translate } from '../../helpers/l10n'; import { AppState } from '../../types/appstate'; import { EditionKey } from '../../types/editions'; import { SystemUpgrade } from '../../types/system'; +import Link from '../common/Link'; import { ResetButtonLink } from '../controls/buttons'; import Modal from '../controls/Modal'; import { Alert, AlertVariant } from '../ui/Alert'; @@ -106,13 +107,12 @@ export class SystemUpgradeForm extends React.PureComponent<Props, State> { </div> <div className="modal-foot"> {upgrading && <i className="spinner spacer-right" />} - <a - className="pull-left" - href="https://www.sonarqube.org/downloads/?referrer=sonarqube" - rel="noopener noreferrer" + <Link + className="pull-left link-no-underline display-flex-center" + to="https://www.sonarqube.org/downloads/?referrer=sonarqube" target="_blank"> {translate('system.see_sonarqube_downloads')} - </a> + </Link> <ResetButtonLink onClick={this.props.onClose}>{translate('cancel')}</ResetButtonLink> </div> </Modal> diff --git a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx index 55b5a316ead..7309a165e90 100644 --- a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx +++ b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx @@ -27,6 +27,7 @@ import { import { translate, translateWithParameters } from '../../helpers/l10n'; import { EditionKey } from '../../types/editions'; import { SystemUpgrade } from '../../types/system'; +import Link from '../common/Link'; import DateFormatter from '../intl/DateFormatter'; import SystemUpgradeIntermediate from './SystemUpgradeIntermediate'; @@ -56,13 +57,12 @@ export default function SystemUpgradeItem(props: SystemUpgradeItemProps) { <h3 className="h1 spacer-bottom"> <strong>{header}</strong> {!isPatch && ( - <a + <Link className="spacer-left medium" - href="https://www.sonarqube.org/whats-new/?referrer=sonarqube" - rel="noopener noreferrer" + to="https://www.sonarqube.org/whats-new/?referrer=sonarqube" target="_blank"> {translate('system.see_whats_new')} - </a> + </Link> )} </h3> <p> @@ -82,13 +82,9 @@ export default function SystemUpgradeItem(props: SystemUpgradeItemProps) { </DateFormatter> )} {lastUpgrade.changeLogUrl && ( - <a - className="spacer-left" - href={lastUpgrade.changeLogUrl} - rel="noopener noreferrer" - target="_blank"> + <Link className="spacer-left" to={lastUpgrade.changeLogUrl} target="_blank"> {translate('system.release_notes')} - </a> + </Link> )} </div> <SystemUpgradeIntermediate className="spacer-top" upgrades={systemUpgrades.slice(1)} /> @@ -101,13 +97,12 @@ export default function SystemUpgradeItem(props: SystemUpgradeItemProps) { target="_blank"> {translateWithParameters('system.download_x', lastUpgrade.version)} </a> - <a + <Link className="spacer-left" - href="https://redirect.sonarsource.com/doc/upgrading.html" - rel="noopener noreferrer" + to="https://redirect.sonarsource.com/doc/upgrading.html" target="_blank"> {translate('system.how_to_upgrade')} - </a> + </Link> </div> </div> ); diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap b/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap index 1a0e6083eb7..8908270162d 100644 --- a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap @@ -79,14 +79,13 @@ exports[`should display correctly for new_minor_version 1`] = ` <div className="modal-foot" > - <a - className="pull-left" - href="https://www.sonarqube.org/downloads/?referrer=sonarqube" - rel="noopener noreferrer" + <ForwardRef(Link) + className="pull-left link-no-underline display-flex-center" target="_blank" + to="https://www.sonarqube.org/downloads/?referrer=sonarqube" > system.see_sonarqube_downloads - </a> + </ForwardRef(Link)> <ResetButtonLink onClick={[MockFunction]} > @@ -181,14 +180,13 @@ exports[`should display correctly for new_patch 1`] = ` <div className="modal-foot" > - <a - className="pull-left" - href="https://www.sonarqube.org/downloads/?referrer=sonarqube" - rel="noopener noreferrer" + <ForwardRef(Link) + className="pull-left link-no-underline display-flex-center" target="_blank" + to="https://www.sonarqube.org/downloads/?referrer=sonarqube" > system.see_sonarqube_downloads - </a> + </ForwardRef(Link)> <ResetButtonLink onClick={[MockFunction]} > @@ -283,14 +281,13 @@ exports[`should display correctly for pre_lts 1`] = ` <div className="modal-foot" > - <a - className="pull-left" - href="https://www.sonarqube.org/downloads/?referrer=sonarqube" - rel="noopener noreferrer" + <ForwardRef(Link) + className="pull-left link-no-underline display-flex-center" target="_blank" + to="https://www.sonarqube.org/downloads/?referrer=sonarqube" > system.see_sonarqube_downloads - </a> + </ForwardRef(Link)> <ResetButtonLink onClick={[MockFunction]} > @@ -385,14 +382,13 @@ exports[`should display correctly for previous_lts 1`] = ` <div className="modal-foot" > - <a - className="pull-left" - href="https://www.sonarqube.org/downloads/?referrer=sonarqube" - rel="noopener noreferrer" + <ForwardRef(Link) + className="pull-left link-no-underline display-flex-center" target="_blank" + to="https://www.sonarqube.org/downloads/?referrer=sonarqube" > system.see_sonarqube_downloads - </a> + </ForwardRef(Link)> <ResetButtonLink onClick={[MockFunction]} > @@ -481,14 +477,13 @@ exports[`should display correctly for undefined 1`] = ` <div className="modal-foot" > - <a - className="pull-left" - href="https://www.sonarqube.org/downloads/?referrer=sonarqube" - rel="noopener noreferrer" + <ForwardRef(Link) + className="pull-left link-no-underline display-flex-center" target="_blank" + to="https://www.sonarqube.org/downloads/?referrer=sonarqube" > system.see_sonarqube_downloads - </a> + </ForwardRef(Link)> <ResetButtonLink onClick={[MockFunction]} > diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap b/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap index 849ff677a1d..67c4841b456 100644 --- a/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap @@ -10,14 +10,13 @@ exports[`should display correctly 1`] = ` <strong> system.latest_version </strong> - <a + <ForwardRef(Link) className="spacer-left medium" - href="https://www.sonarqube.org/whats-new/?referrer=sonarqube" - rel="noopener noreferrer" target="_blank" + to="https://www.sonarqube.org/whats-new/?referrer=sonarqube" > system.see_whats_new - </a> + </ForwardRef(Link)> </h3> <p> <FormattedMessage @@ -47,14 +46,13 @@ exports[`should display correctly 1`] = ` > <Component /> </DateFormatter> - <a + <ForwardRef(Link) className="spacer-left" - href="http://changelog.url/" - rel="noopener noreferrer" target="_blank" + to="http://changelog.url/" > system.release_notes - </a> + </ForwardRef(Link)> </div> <SystemUpgradeIntermediate className="spacer-top" @@ -91,14 +89,13 @@ exports[`should display correctly 1`] = ` > system.download_x.5.6.7 </a> - <a + <ForwardRef(Link) className="spacer-left" - href="https://redirect.sonarsource.com/doc/upgrading.html" - rel="noopener noreferrer" target="_blank" + to="https://redirect.sonarsource.com/doc/upgrading.html" > system.how_to_upgrade - </a> + </ForwardRef(Link)> </div> </div> `; @@ -113,14 +110,13 @@ exports[`should display correctly 2`] = ` <strong> system.lts_version </strong> - <a + <ForwardRef(Link) className="spacer-left medium" - href="https://www.sonarqube.org/whats-new/?referrer=sonarqube" - rel="noopener noreferrer" target="_blank" + to="https://www.sonarqube.org/whats-new/?referrer=sonarqube" > system.see_whats_new - </a> + </ForwardRef(Link)> </h3> <p> <FormattedMessage @@ -150,14 +146,13 @@ exports[`should display correctly 2`] = ` > <Component /> </DateFormatter> - <a + <ForwardRef(Link) className="spacer-left" - href="http://changelog.url/" - rel="noopener noreferrer" target="_blank" + to="http://changelog.url/" > system.release_notes - </a> + </ForwardRef(Link)> </div> <SystemUpgradeIntermediate className="spacer-top" @@ -194,14 +189,13 @@ exports[`should display correctly 2`] = ` > system.download_x.5.6.7 </a> - <a + <ForwardRef(Link) className="spacer-left" - href="https://redirect.sonarsource.com/doc/upgrading.html" - rel="noopener noreferrer" target="_blank" + to="https://redirect.sonarsource.com/doc/upgrading.html" > system.how_to_upgrade - </a> + </ForwardRef(Link)> </div> </div> `; @@ -245,14 +239,13 @@ exports[`should display correctly 3`] = ` > <Component /> </DateFormatter> - <a + <ForwardRef(Link) className="spacer-left" - href="http://changelog.url/" - rel="noopener noreferrer" target="_blank" + to="http://changelog.url/" > system.release_notes - </a> + </ForwardRef(Link)> </div> <SystemUpgradeIntermediate className="spacer-top" @@ -289,14 +282,13 @@ exports[`should display correctly 3`] = ` > system.download_x.5.6.7 </a> - <a + <ForwardRef(Link) className="spacer-left" - href="https://redirect.sonarsource.com/doc/upgrading.html" - rel="noopener noreferrer" target="_blank" + to="https://redirect.sonarsource.com/doc/upgrading.html" > system.how_to_upgrade - </a> + </ForwardRef(Link)> </div> </div> `; @@ -311,14 +303,13 @@ exports[`should display correctly 4`] = ` <strong> system.latest_version </strong> - <a + <ForwardRef(Link) className="spacer-left medium" - href="https://www.sonarqube.org/whats-new/?referrer=sonarqube" - rel="noopener noreferrer" target="_blank" + to="https://www.sonarqube.org/whats-new/?referrer=sonarqube" > system.see_whats_new - </a> + </ForwardRef(Link)> </h3> <p> <FormattedMessage @@ -348,14 +339,13 @@ exports[`should display correctly 4`] = ` > <Component /> </DateFormatter> - <a + <ForwardRef(Link) className="spacer-left" - href="http://changelog.url/" - rel="noopener noreferrer" target="_blank" + to="http://changelog.url/" > system.release_notes - </a> + </ForwardRef(Link)> </div> <SystemUpgradeIntermediate className="spacer-top" @@ -392,14 +382,13 @@ exports[`should display correctly 4`] = ` > system.download_x.5.6.7 </a> - <a + <ForwardRef(Link) className="spacer-left" - href="https://redirect.sonarsource.com/doc/upgrading.html" - rel="noopener noreferrer" target="_blank" + to="https://redirect.sonarsource.com/doc/upgrading.html" > system.how_to_upgrade - </a> + </ForwardRef(Link)> </div> </div> `; @@ -414,14 +403,13 @@ exports[`should display correctly 5`] = ` <strong> system.latest_version </strong> - <a + <ForwardRef(Link) className="spacer-left medium" - href="https://www.sonarqube.org/whats-new/?referrer=sonarqube" - rel="noopener noreferrer" target="_blank" + to="https://www.sonarqube.org/whats-new/?referrer=sonarqube" > system.see_whats_new - </a> + </ForwardRef(Link)> </h3> <p> <FormattedMessage @@ -451,14 +439,13 @@ exports[`should display correctly 5`] = ` > <Component /> </DateFormatter> - <a + <ForwardRef(Link) className="spacer-left" - href="http://changelog.url/" - rel="noopener noreferrer" target="_blank" + to="http://changelog.url/" > system.release_notes - </a> + </ForwardRef(Link)> </div> <SystemUpgradeIntermediate className="spacer-top" @@ -495,14 +482,13 @@ exports[`should display correctly 5`] = ` > system.download_x.5.6.7 </a> - <a + <ForwardRef(Link) className="spacer-left" - href="https://redirect.sonarsource.com/doc/upgrading.html" - rel="noopener noreferrer" target="_blank" + to="https://redirect.sonarsource.com/doc/upgrading.html" > system.how_to_upgrade - </a> + </ForwardRef(Link)> </div> </div> `; @@ -517,14 +503,13 @@ exports[`should display correctly 6`] = ` <strong> system.latest_version </strong> - <a + <ForwardRef(Link) className="spacer-left medium" - href="https://www.sonarqube.org/whats-new/?referrer=sonarqube" - rel="noopener noreferrer" target="_blank" + to="https://www.sonarqube.org/whats-new/?referrer=sonarqube" > system.see_whats_new - </a> + </ForwardRef(Link)> </h3> <p> <FormattedMessage @@ -554,14 +539,13 @@ exports[`should display correctly 6`] = ` > <Component /> </DateFormatter> - <a + <ForwardRef(Link) className="spacer-left" - href="http://changelog.url/" - rel="noopener noreferrer" target="_blank" + to="http://changelog.url/" > system.release_notes - </a> + </ForwardRef(Link)> </div> <SystemUpgradeIntermediate className="spacer-top" @@ -598,14 +582,13 @@ exports[`should display correctly 6`] = ` > system.download_x.5.6.7 </a> - <a + <ForwardRef(Link) className="spacer-left" - href="https://redirect.sonarsource.com/doc/upgrading.html" - rel="noopener noreferrer" target="_blank" + to="https://redirect.sonarsource.com/doc/upgrading.html" > system.how_to_upgrade - </a> + </ForwardRef(Link)> </div> </div> `; @@ -620,14 +603,13 @@ exports[`should display correctly 7`] = ` <strong> system.latest_version </strong> - <a + <ForwardRef(Link) className="spacer-left medium" - href="https://www.sonarqube.org/whats-new/?referrer=sonarqube" - rel="noopener noreferrer" target="_blank" + to="https://www.sonarqube.org/whats-new/?referrer=sonarqube" > system.see_whats_new - </a> + </ForwardRef(Link)> </h3> <p> <FormattedMessage @@ -657,14 +639,13 @@ exports[`should display correctly 7`] = ` > <Component /> </DateFormatter> - <a + <ForwardRef(Link) className="spacer-left" - href="http://changelog.url/" - rel="noopener noreferrer" target="_blank" + to="http://changelog.url/" > system.release_notes - </a> + </ForwardRef(Link)> </div> <SystemUpgradeIntermediate className="spacer-top" @@ -682,14 +663,13 @@ exports[`should display correctly 7`] = ` > system.download_x.5.6.7 </a> - <a + <ForwardRef(Link) className="spacer-left" - href="https://redirect.sonarsource.com/doc/upgrading.html" - rel="noopener noreferrer" target="_blank" + to="https://redirect.sonarsource.com/doc/upgrading.html" > system.how_to_upgrade - </a> + </ForwardRef(Link)> </div> </div> `; diff --git a/server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts b/server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts index 21ea123bd26..0c2c61e5ee2 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts @@ -19,7 +19,7 @@ */ import { SystemUpgrade } from '../../types/system'; -export function mockUpgrades(override: Partial<SystemUpgrade>): SystemUpgrade { +export function mockSystemUpgrade(override: Partial<SystemUpgrade> = {}): SystemUpgrade { return { version: '5.6.7', description: 'Version 5.6.7 description', diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index e8b7b629d87..633911af4fe 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -279,6 +279,7 @@ no_results_search=We couldn't find any results matching selected criteria. no_results_search.favorites=We couldn't find any results matching selected criteria in your favorites. no_results_search.2=Try to change filters to get some results. no_results_search.favorites.2=Would you like to search among {url} projects? +opens_in_new_window=Opens in a new window page_extension_failed=Page extension failed. page_not_found=The page you were looking for does not exist. please_contact_administrator=Please contact the instance administrator. |