mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-21 08:24:14 -06:00
Ensure that pgAdmin works when opened in an iframe. #7681
This commit is contained in:
parent
a06c13623d
commit
c4a52687b6
@ -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 (
|
||||
<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
|
||||
|
@ -187,8 +187,9 @@ export function NotifierProvider({ pgAdmin, pgWindow, getInstance, children, onR
|
||||
const modal = useModal();
|
||||
|
||||
useEffect(()=>{
|
||||
// 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 (
|
||||
<Root>
|
||||
<SnackbarProvider
|
||||
|
Loading…
Reference in New Issue
Block a user