From c4a52687b60708d27619e1ee24dea0430a83be97 Mon Sep 17 00:00:00 2001 From: Yogesh Mahajan Date: Tue, 16 Jul 2024 16:32:52 +0530 Subject: [PATCH] Ensure that pgAdmin works when opened in an iframe. #7681 --- web/pgadmin/static/js/BrowserComponent.jsx | 3 ++- web/pgadmin/static/js/helpers/Notifier.jsx | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/web/pgadmin/static/js/BrowserComponent.jsx b/web/pgadmin/static/js/BrowserComponent.jsx index b2cdc2955..9f962ce2f 100644 --- a/web/pgadmin/static/js/BrowserComponent.jsx +++ b/web/pgadmin/static/js/BrowserComponent.jsx @@ -22,6 +22,7 @@ import { getBrowser } from './utils'; import PropTypes from 'prop-types'; import Processes from '../../misc/bgprocess/static/js/Processes'; import { useBeforeUnload } from './custom_hooks'; +import pgWindow from 'sources/window'; const objectExplorerGroup = { @@ -125,7 +126,7 @@ export default function BrowserComponent({pgAdmin}) { return ( - setUiReady(true)}/> + setUiReady(true)}/> {browser != 'Electron' && }
{ - // if open in an iframe then use top pgAdmin - if(window.self != window.top) { + // if opened in an iframe then use top pgAdmin + // pgAdmin itself can open in iframe, skip this in that case. + if(window.self != window.top && pgWindow != window ) { pgAdmin.Browser.notifier = new Notifier(modal, pgWindow.pgAdmin.Browser.notifier.snackbar); onReady?.(); getInstance?.(pgAdmin.Browser.notifier); @@ -196,7 +197,8 @@ export function NotifierProvider({ pgAdmin, pgWindow, getInstance, children, onR }, []); // if open in a window, then create your own Snackbar - if(window.self == window.top) { + // if pgAdmin is opened inside an iframe then it also same as new window. + if(window.self == window.top || (window.self != window.top && pgWindow != window )) { return (