diff --git a/ui/package.json b/ui/package.json
index d4dcb645e..46d5fed28 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -18,7 +18,6 @@
"file-saver": "^2.0.5",
"lodash": "^4.17.21",
"prop-types": "^15.8.1",
- "query-string": "^8.1.0",
"react": "^18.2.0",
"react-bootstrap": "^2.7.0",
"react-bootstrap-typeahead": "^6.0.0",
diff --git a/ui/src/app/core/components/ProtectRoute.test.js b/ui/src/app/core/components/ProtectRoute.test.js
index 58cc8cc5c..9041acdae 100644
--- a/ui/src/app/core/components/ProtectRoute.test.js
+++ b/ui/src/app/core/components/ProtectRoute.test.js
@@ -1,6 +1,6 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
-import { BrowserRouter, MemoryRouter, Route, Routes, useNavigate } from 'react-router-dom';
+import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
import { ProtectRoute } from './ProtectRoute';
const mockIsAdmin = jest.fn();
@@ -10,21 +10,13 @@ jest.mock('../user/UserContext', () => ({
useCurrentUser: () => ({role: 'ROLE_ADMIN'}),
}));
-const renderWithRouter = (ui) => {
- return render(
-
- {ui}
-
- )
-}
-
describe('AdminRoute user is admin', () => {
beforeEach(() => {
mockIsAdmin.mockReturnValue(true);
});
it('should render the component if user is an admin', () => {
- render(hi there, { wrapper: MemoryRouter });
+ render(hi there, { wrapper: BrowserRouter });
expect(screen.getByText('hi there')).toBeInTheDocument();
});
});
@@ -35,9 +27,11 @@ describe('AdminRoute user is NOT admin', () => {
});
it('should redirect the user to the dashboard if not admin', () => {
- renderWithRouter(
- hi there } />
- , {route: '/foo'});
+ render(
+ } />
+ dashboard } />
+ hi there } />
+ , { wrapper: BrowserRouter });
expect(screen.getByText('dashboard')).toBeInTheDocument();
});
});
\ No newline at end of file
diff --git a/ui/src/app/core/hooks/usePrompt.js b/ui/src/app/core/hooks/usePrompt.js
index 804706a53..3220f6a4b 100644
--- a/ui/src/app/core/hooks/usePrompt.js
+++ b/ui/src/app/core/hooks/usePrompt.js
@@ -15,8 +15,6 @@ export function usePrompt(when, message, {
let blocker = useBlocker(when);
const [show, setShow] = React.useState(false);
- console.log(blocker);
-
React.useEffect(() => {
if (blocker.state === "blocked" && !when) {
blocker.reset();
diff --git a/ui/src/app/form/component/fields/FilterTargetField.js b/ui/src/app/form/component/fields/FilterTargetField.js
index 9fabd0661..be48a3473 100644
--- a/ui/src/app/form/component/fields/FilterTargetField.js
+++ b/ui/src/app/form/component/fields/FilterTargetField.js
@@ -8,7 +8,6 @@ import { useTranslator } from '../../../i18n/hooks';
import { InfoIcon } from '../InfoIcon';
import { AsyncTypeahead } from 'react-bootstrap-typeahead';
import useFetch from 'use-http';
-import queryString from 'query-string';
import API_BASE_PATH from '../../../App.constant';
import isNil from 'lodash/isNil';
import capitalize from 'lodash/capitalize';
@@ -19,6 +18,7 @@ import Editor from 'react-simple-code-editor';
import { FilterTargetPreview } from '../../../metadata/hoc/FilterTargetPreview';
import { remove } from 'lodash';
+import { createSearchParams } from 'react-router-dom';
const ToggleButton = ({ isOpen, onClick, disabled }) => (