From 45032fa196523f2df243a21682abd788e64a1062 Mon Sep 17 00:00:00 2001 From: Philippe Perrin Date: Fri, 14 Jan 2022 10:07:56 +0100 Subject: Remove usages of the deprecated package querystring --- .../src/main/js/apps/projectDump/components/Import.tsx | 18 +++++++++--------- .../__tests__/__snapshots__/Import-test.tsx.snap | 17 ++++++++++++++--- 2 files changed, 23 insertions(+), 12 deletions(-) (limited to 'server/sonar-web/src/main/js/apps/projectDump') 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 87acd4efea4..9c4160f8cef 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 @@ -18,15 +18,15 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import classNames from 'classnames'; -import { stringify } from 'querystring'; import * as React from 'react'; +import { Link } from 'react-router'; import { doImport } from '../../../api/project-dump'; import { Button } from '../../../components/controls/buttons'; 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 { getComponentBackgroundTaskUrl } from '../../../helpers/urls'; import { DumpStatus, DumpTask } from '../../../types/project-dump'; import { TaskStatuses, TaskTypes } from '../../../types/tasks'; @@ -119,19 +119,19 @@ export default class Import extends React.Component { renderWhenImportFailed() { const { componentKey } = this.props; - const detailsUrl = `${getBaseUrl()}/project/background_tasks?${stringify({ - id: encodeURIComponent(componentKey), - status: TaskStatuses.Failed, - taskType: TaskTypes.ProjectImport - })}`; + const detailsUrl = getComponentBackgroundTaskUrl( + componentKey, + TaskStatuses.Failed, + TaskTypes.ProjectImport + ); return (
{translate('project_dump.failed_import')} - + {translate('project_dump.see_details')} - + {this.renderImportForm()} 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 c5cbbc7c15b..6073edbe109 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,12 +41,23 @@ exports[`should render correctly: failed 1`] = ` variant="error" > project_dump.failed_import - project_dump.see_details - +