aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/projectDump
diff options
context:
space:
mode:
authorPhilippe Perrin <philippe.perrin@sonarsource.com>2022-01-14 10:07:56 +0100
committersonartech <sonartech@sonarsource.com>2022-01-17 20:02:50 +0000
commit45032fa196523f2df243a21682abd788e64a1062 (patch)
tree1cb875a7bb260306f022d9eccb7efb538e203d49 /server/sonar-web/src/main/js/apps/projectDump
parent1938bdcb2573c9ee9cbeade90d2e5134acd02e7f (diff)
downloadsonarqube-45032fa196523f2df243a21682abd788e64a1062.tar.gz
sonarqube-45032fa196523f2df243a21682abd788e64a1062.zip
Remove usages of the deprecated package querystring
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projectDump')
-rw-r--r--server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/projectDump/components/__tests__/__snapshots__/Import-test.tsx.snap17
2 files changed, 23 insertions, 12 deletions
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<Props> {
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 (
<div className="boxed-group-inner">
<Alert id="export-in-progress" variant="error">
{translate('project_dump.failed_import')}
- <a className="spacer-left" href={detailsUrl}>
+ <Link className="spacer-left" to={detailsUrl}>
{translate('project_dump.see_details')}
- </a>
+ </Link>
</Alert>
{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
- <a
+ <Link
className="spacer-left"
- href="/project/background_tasks?id=key&status=FAILED&taskType=PROJECT_IMPORT"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/project/background_tasks",
+ "query": Object {
+ "id": "key",
+ "status": "FAILED",
+ "taskType": "PROJECT_IMPORT",
+ },
+ }
+ }
>
project_dump.see_details
- </a>
+ </Link>
</Alert>
<div>
<div