kevalbhatt commented on code in PR #417:
URL: https://github.com/apache/atlas/pull/417#discussion_r3163817719
##########
dashboard/src/utils/Utils.ts:
##########
@@ -797,6 +799,66 @@ const globalSearchParams = {
dslParams: {}
};
+export const handleLogout = async (
Review Comment:
better to create the logoutUtil?
##########
dashboard/src/views/ErrorPage.tsx:
##########
@@ -16,35 +16,54 @@
*/
import { useState, useEffect } from "react";
-import { useNavigate } from "react-router-dom";
import errorIcon from "/img/error-404-icon.png";
import { Stack, Typography } from "@mui/material";
import { CustomButton } from "@components/muiComponents";
+import { useLocation } from "react-router-dom";
+import { useNavigate } from "react-router-dom";
+
export const ErrorPage = (props: { errorCode: string }) => {
let navigate = useNavigate();
- const [errorCode, setErrorCode] = useState<string | null>(null);
+ const location = useLocation();
+ const code = location.state?.errorCode || props.errorCode || "404";
+
+ const [errorCode, setErrorCode] = useState<string>("");
const [errorInfo, setErrorInfo] = useState<any>(null);
useEffect(() => {
- if (props.errorCode == "checkSSOTrue") {
+ if (code == "checkSSOTrue") {
setErrorCode("Sign Out Is Not Complete!");
setErrorInfo(
<Typography>
- Authentication to this instance of Ranger is managed externally(for
- example,Apache Knox). You can still open this instance of Ranger from
+ Authentication to this instance of Atlas is managed externally(for
+ example,Apache Knox). You can still open this instance of Atlas from
the same web browser without re-authentication.To prevent
- additionalPage not found (404). access to Ranger,
+ additionalPage not found (404). access to Atlas,
<strong>close all browser windows and exit the browser</strong>.
</Typography>
);
Review Comment:
`useEffect` may not be necessary here since this is derived state. You could
compute `errorCode` and `errorInfo` directly from `code` during render to keep
things simpler and avoid an extra render.
##########
dashboard/src/views/ErrorPage.tsx:
##########
@@ -74,7 +93,7 @@ export const ErrorPage = (props: { errorCode: string }) => {
</Stack>
</Stack>
<Stack direction="row" spacing={2} className="mt-2">
- {props.errorCode !== "checkSSOTrue" && (
+ {code !== "checkSSOTrue" && (
Review Comment:
nit;
```tsx
<CustomButton
size="small"
variant="contained"
color="primary"
onClick={
code === "checkSSOTrue"
? handleBackWithReload
: () => navigate("/search")
}
>
{code === "checkSSOTrue" ? "Go Back" : "Return to Dashboard"}
</CustomButton>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]