Fixed an issue where notifier not working when opening query tool in a new

window and then open it in the new tab.
This commit is contained in:
Akshay Joshi 2021-12-08 18:15:13 +05:30
parent 91a288c2bb
commit f24348b2b0
3 changed files with 8 additions and 7 deletions

View File

@ -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')){

View File

@ -132,7 +132,7 @@ var Notifier = {
notify(content, autoHideDuration) {
if (content) {
if(!notifierInitialized) {
initializeNotifier(document.getElementById('notifierContainer'));
initializeNotifier();
}
let options = {autoHideDuration, content:(key) => (
<FinalNotifyContent>{React.cloneElement(content, {onClose:()=>{snackbarRef.closeSnackbar(key);}})}</FinalNotifyContent>
@ -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;

View File

@ -74,8 +74,6 @@
<![endif]-->
{% block body %}{% endblock %}
<div id="notifierContainer"></div>
<div id="modalContainer"></div>
<script type="application/javascript">
{% block init_script %}{% endblock %}
</script>