From 332a56b715bebc840cca640f7d7906e22c45232d Mon Sep 17 00:00:00 2001 From: Anushka Singh Date: Thu, 8 Aug 2024 14:06:11 -0400 Subject: [PATCH] Issue1468: Submit request redirect (#1469) ### Feature or Bugfix - Feature ### Detail - Submit request redirects to share request page instead of catalog page ### Relates - https://github.com/data-dot-all/dataall/issues/1468 ### Testing - Submit request button redirects to share page and not catalog anymore. ### Security Please answer the questions below briefly where applicable, or write `N/A`. Based on [OWASP 10](https://owasp.org/Top10/en/). - Does this PR introduce or modify any input fields or queries - this includes fetching data from storage outside the application (e.g. a database, an S3 bucket)? - Is the input sanitized? - What precautions are you taking before deserializing the data you consume? - Is injection prevented by parametrizing queries? - Have you ensured no `eval` or similar functions are used? - Does this PR introduce any functionality or component that requires authorization? - How have you ensured it respects the existing AuthN/AuthZ mechanisms? - Are you logging failed auth attempts? - Are you using or adding any cryptographic features? - Do you use a standard proven implementations? - Are the used keys controlled by the customer? Where are they stored? - Are you introducing any new policies/roles/users? - Have you used the least-privilege principle? How? By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. --- frontend/src/modules/Shared/Shares/ShareEditForm.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/modules/Shared/Shares/ShareEditForm.js b/frontend/src/modules/Shared/Shares/ShareEditForm.js index 39943b9eb..9798f1ade 100644 --- a/frontend/src/modules/Shared/Shares/ShareEditForm.js +++ b/frontend/src/modules/Shared/Shares/ShareEditForm.js @@ -26,7 +26,7 @@ import { import { SET_ERROR } from '../../../globalErrors'; import { DeleteOutlined } from '@mui/icons-material'; import PropTypes from 'prop-types'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, useLocation } from 'react-router-dom'; const ItemRow = (props) => { const { @@ -214,6 +214,7 @@ export const ShareEditForm = (props) => { showViewShare } = props; const navigate = useNavigate(); + const location = useLocation(); const [sharedItems, setSharedItems] = useState(Defaults.pagedResponse); const [shareStatus, setShareStatus] = useState(''); const [filter, setFilter] = useState(Defaults.filter); @@ -276,6 +277,10 @@ export const ShareEditForm = (props) => { if (onApply) { onApply(); } + const targetPath = `/console/shares/${share.shareUri}`; + if (location.pathname !== targetPath) { + navigate(targetPath); + } }; const draftRequest = async () => {