From: stanislavh Date: Wed, 5 Jul 2023 12:03:51 +0000 (+0200) Subject: SONAR-19633 Some links are badly formatted when SQ is configured with a root URL X-Git-Tag: 10.2.0.77647~455 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=085bee632b84b3e1e034fb4de27788c5fd91e133;p=sonarqube.git SONAR-19633 Some links are badly formatted when SQ is configured with a root URL --- 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 2e3f9fe9dcb..c97edfef2fc 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 @@ -25,7 +25,6 @@ import DateFromNow from '../../../components/intl/DateFromNow'; import DateTimeFormatter from '../../../components/intl/DateTimeFormatter'; import { Alert } from '../../../components/ui/Alert'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { getBaseUrl } from '../../../helpers/system'; import { DumpStatus, DumpTask } from '../../../types/project-dump'; interface Props { @@ -100,7 +99,7 @@ export default class Export extends React.Component { renderWhenExportFailed() { const { componentKey } = this.props; - const detailsUrl = `${getBaseUrl()}/project/background_tasks?id=${encodeURIComponent( + const detailsUrl = `/project/background_tasks?id=${encodeURIComponent( componentKey )}&status=FAILED&taskType=PROJECT_EXPORT`; 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 ae138ecec41..a8569f1c1cd 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 @@ -22,7 +22,6 @@ 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'; import { Exporter, Profile } from '../types'; interface Props { @@ -30,42 +29,34 @@ interface Props { profile: Profile; } -export default class ProfileExporters extends React.PureComponent { - getExportUrl(exporter: Exporter) { - const { profile } = this.props; - return `${getBaseUrl()}${getQualityProfileExporterUrl(exporter, profile)}`; - } - - render() { - const { exporters, profile } = this.props; - const exportersForLanguage = exporters.filter((e) => e.languages.includes(profile.language)); +export default function ProfileExporters({ exporters, profile }: Props) { + const exportersForLanguage = exporters.filter((e) => e.languages.includes(profile.language)); - if (exportersForLanguage.length === 0) { - return null; - } + if (exportersForLanguage.length === 0) { + return null; + } - return ( -
-

{translate('quality_profiles.exporters')}

-
- - {translate('quality_profiles.exporters.deprecated')} - -
    - {exportersForLanguage.map((exporter, index) => ( -
  • 0 ? 'spacer-top' : undefined} - data-key={exporter.key} - key={exporter.key} - > - - {exporter.name} - -
  • - ))} -
-
+ return ( +
+

{translate('quality_profiles.exporters')}

+
+ + {translate('quality_profiles.exporters.deprecated')} + +
    + {exportersForLanguage.map((exporter, index) => ( +
  • 0 ? 'spacer-top' : undefined} + data-key={exporter.key} + key={exporter.key} + > + + {exporter.name} + +
  • + ))} +
- ); - } +
+ ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileExporters-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileExporters-test.tsx index 06119751512..ca8d96a1520 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileExporters-test.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileExporters-test.tsx @@ -20,6 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockQualityProfile, mockQualityProfileExporter } from '../../../../helpers/testMocks'; +import { FCProps } from '../../../../types/misc'; import ProfileExporters from '../ProfileExporters'; it('should render correctly', () => { @@ -27,9 +28,9 @@ it('should render correctly', () => { expect(wrapper).toMatchSnapshot(); }); -function shallowRender(props: Partial = {}) { +function shallowRender(props: Partial> = {}) { const profile = mockQualityProfile(); - return shallow( + return shallow(
- + {translate('settings.authentication.saml.form.test')}