Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion airflow-core/src/airflow/ui/src/pages/Security.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
import { Box } from "@chakra-ui/react";
import { useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom";

import { useAuthLinksServiceGetAuthMenus } from "openapi/queries";
import { ProgressBar } from "src/components/ui";
Expand All @@ -37,6 +38,16 @@ export const Security = () => {

const link = authLinks?.extra_menu_items.find((mi) => mi.text.toLowerCase().replace(" ", "-") === page);

const navigate = useNavigate();

const onLoad = () => {
const iframe: HTMLIFrameElement | null = document.querySelector("#security-iframe");

if (iframe?.contentWindow && !iframe.contentWindow.location.pathname.startsWith("/auth/")) {
navigate("/");
}
};

if (!link) {
if (isLoading) {
return (
Expand All @@ -51,7 +62,17 @@ export const Security = () => {

return (
<Box flexGrow={1} m={-3}>
<iframe sandbox={SANDBOX} src={link.href} style={{ height: "100%", width: "100%" }} title={link.text} />
{
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
<iframe
id="security-iframe"
onLoad={onLoad}
sandbox={SANDBOX}
src={link.href}
style={{ height: "100%", width: "100%" }}
title={link.text}
/>
}
</Box>
);
};