diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
184 files changed, 665 insertions, 747 deletions
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)>, } } /> |