From f24348b2b031fc1808307ea5a903fe96e002a877 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Wed, 8 Dec 2021 18:15:13 +0530 Subject: [PATCH] =?UTF-8?q?Fixed=20an=20issue=20where=20notifier=20not=20w?= =?UTF-8?q?orking=20when=20opening=20query=20tool=20in=20a=20new=20window?= =?UTF-8?q?=20and=20then=20open=20it=20in=20the=20new=20tab.=C2=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/pgadmin/browser/static/js/browser.js | 5 ++++- web/pgadmin/static/js/helpers/Notifier.jsx | 8 ++++---- web/pgadmin/templates/base.html | 2 -- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index f0bb97877..d15970592 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////// import { generateNodeUrl } from './node_ajax'; -import Notify from '../../../static/js/helpers/Notifier'; +import Notify, {initializeModalProvider, initializeNotifier} from '../../../static/js/helpers/Notifier'; define('pgadmin.browser', [ 'sources/gettext', 'sources/url_for', 'require', 'jquery', 'underscore', @@ -439,6 +439,9 @@ define('pgadmin.browser', [ } initializeBrowserTree(obj); + initializeModalProvider(); + initializeNotifier(); + // Syntax highlight the SQL Pane if(document.getElementById('sql-textarea')){ diff --git a/web/pgadmin/static/js/helpers/Notifier.jsx b/web/pgadmin/static/js/helpers/Notifier.jsx index 0bb8b1554..ef05eff0f 100644 --- a/web/pgadmin/static/js/helpers/Notifier.jsx +++ b/web/pgadmin/static/js/helpers/Notifier.jsx @@ -132,7 +132,7 @@ var Notifier = { notify(content, autoHideDuration) { if (content) { if(!notifierInitialized) { - initializeNotifier(document.getElementById('notifierContainer')); + initializeNotifier(); } let options = {autoHideDuration, content:(key) => ( {React.cloneElement(content, {onClose:()=>{snackbarRef.closeSnackbar(key);}})} @@ -221,7 +221,7 @@ var Notifier = { }, alert: (title, text, okLabel=gettext('OK'), onOkClick)=>{ if(!modalInitialized) { - initializeModalProvider(document.getElementById('modalContainer')); + initializeModalProvider(); } modalRef.showModal(title, (closeModal)=>{ const onOkClickClose = ()=>{ @@ -235,7 +235,7 @@ var Notifier = { }, confirm: (title, text, onOkClick, onCancelClick, okLabel=gettext('Yes'), cancelLabel=gettext('No'))=>{ if(!modalInitialized) { - initializeModalProvider(document.getElementById('modalContainer')); + initializeModalProvider(); } modalRef.showModal(title, (closeModal)=>{ const onCancelClickClose = ()=>{ @@ -255,7 +255,7 @@ var Notifier = { if(window.frameElement) { Notifier = pgWindow.Notifier || Notifier; -} else { +} else if(!pgWindow.Notifier){ pgWindow.Notifier = Notifier; } export default Notifier; diff --git a/web/pgadmin/templates/base.html b/web/pgadmin/templates/base.html index 665cab9e4..fad6ec5f1 100644 --- a/web/pgadmin/templates/base.html +++ b/web/pgadmin/templates/base.html @@ -74,8 +74,6 @@ {% block body %}{% endblock %} -
-