Skip to content

Commit

Permalink
Ensure pgadmin works when embded in iframe.pgadmin-org#7681
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshmahajan-1903 committed Jul 16, 2024
1 parent b303693 commit 2b44616
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion web/pgadmin/static/js/BrowserComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -125,7 +126,7 @@ export default function BrowserComponent({pgAdmin}) {
return (
<PgAdminContext.Provider value={pgAdmin}>
<ModalProvider>
<NotifierProvider pgAdmin={pgAdmin} onReady={()=>setUiReady(true)}/>
<NotifierProvider pgAdmin={pgAdmin} pgWindow={pgWindow} onReady={()=>setUiReady(true)}/>
{browser != 'Electron' && <AppMenuBar />}
<div style={{height: (browser != 'Electron' ? 'calc(100% - 30px)' : '100%')}}>
<Layout
Expand Down
4 changes: 2 additions & 2 deletions web/pgadmin/static/js/helpers/Notifier.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ export function NotifierProvider({ pgAdmin, pgWindow, getInstance, children, onR

useEffect(()=>{
// if open in an iframe then use top pgAdmin
if(window.self != window.top) {
if(window.self != window.top && pgWindow != window ) {
pgAdmin.Browser.notifier = new Notifier(modal, pgWindow.pgAdmin.Browser.notifier.snackbar);
onReady?.();
getInstance?.(pgAdmin.Browser.notifier);
}
}, []);

// if open in a window, then create your own Snackbar
if(window.self == window.top) {
if(window.self == window.top || (window.self != window.top && pgWindow == window )) {
return (
<Root>
<SnackbarProvider
Expand Down

0 comments on commit 2b44616

Please sign in to comment.