mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed an issue where multiple query tool tabs getting closed for the single close event. Fixes #6710
This commit is contained in:
parent
22f20a38ec
commit
7deda52bd9
@ -38,3 +38,4 @@ Bug fixes
|
|||||||
| `Issue #6682 <https://redmine.postgresql.org/issues/6682>`_ - Renamed 'Auto rollback?' to 'Auto rollback on error?'.
|
| `Issue #6682 <https://redmine.postgresql.org/issues/6682>`_ - Renamed 'Auto rollback?' to 'Auto rollback on error?'.
|
||||||
| `Issue #6684 <https://redmine.postgresql.org/issues/6684>`_ - Fixed the JSON editor issue of hiding the first record.
|
| `Issue #6684 <https://redmine.postgresql.org/issues/6684>`_ - Fixed the JSON editor issue of hiding the first record.
|
||||||
| `Issue #6685 <https://redmine.postgresql.org/issues/6685>`_ - Ensure that deleting a database should not automatically connect to the next database.
|
| `Issue #6685 <https://redmine.postgresql.org/issues/6685>`_ - Ensure that deleting a database should not automatically connect to the next database.
|
||||||
|
| `Issue #6710 <https://redmine.postgresql.org/issues/6710>`_ - Fixed an issue where multiple query tool tabs getting closed for the single close event.
|
||||||
|
@ -282,12 +282,14 @@ define('pgadmin.datagrid', [
|
|||||||
queryToolPanel.focus();
|
queryToolPanel.focus();
|
||||||
|
|
||||||
// Listen on the panel closed event.
|
// Listen on the panel closed event.
|
||||||
queryToolPanel.on(wcDocker.EVENT.CLOSED, function() {
|
if (queryToolPanel.isVisible()) {
|
||||||
$.ajax({
|
queryToolPanel.on(wcDocker.EVENT.CLOSED, function() {
|
||||||
url: url_for('datagrid.close', {'trans_id': trans_id}),
|
$.ajax({
|
||||||
method: 'DELETE',
|
url: url_for('datagrid.close', {'trans_id': trans_id}),
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
queryToolPanel.on(wcDocker.EVENT.VISIBILITY_CHANGED, function() {
|
queryToolPanel.on(wcDocker.EVENT.VISIBILITY_CHANGED, function() {
|
||||||
queryToolPanel.trigger(wcDocker.EVENT.RESIZED);
|
queryToolPanel.trigger(wcDocker.EVENT.RESIZED);
|
||||||
|
@ -519,7 +519,7 @@ define('tools.querytool', [
|
|||||||
_.each(pgWindow.default.pgAdmin.Browser.docker.findPanels('frm_datagrid'), function(p) {
|
_.each(pgWindow.default.pgAdmin.Browser.docker.findPanels('frm_datagrid'), function(p) {
|
||||||
if (p.isVisible()) {
|
if (p.isVisible()) {
|
||||||
p.on(wcDocker.EVENT.CLOSING, function() {
|
p.on(wcDocker.EVENT.CLOSING, function() {
|
||||||
return self.handler.check_needed_confirmations_before_closing_panel(true);
|
return self.handler.check_needed_confirmations_before_closing_panel(true, p);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set focus on query tool of active panel
|
// Set focus on query tool of active panel
|
||||||
@ -4908,7 +4908,7 @@ define('tools.querytool', [
|
|||||||
|
|
||||||
/* Checks if there is any unsaved data changes, unsaved changes in the query
|
/* Checks if there is any unsaved data changes, unsaved changes in the query
|
||||||
or uncommitted transactions before closing a panel */
|
or uncommitted transactions before closing a panel */
|
||||||
check_needed_confirmations_before_closing_panel: function(is_close_event_call = false) {
|
check_needed_confirmations_before_closing_panel: function(is_close_event_call = false, panel= null) {
|
||||||
var self = this, msg;
|
var self = this, msg;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4950,7 +4950,7 @@ define('tools.querytool', [
|
|||||||
// No other function should call close() except through this function
|
// No other function should call close() except through this function
|
||||||
// in order to perform necessary checks
|
// in order to perform necessary checks
|
||||||
self.ignore_on_close = undefined;
|
self.ignore_on_close = undefined;
|
||||||
self.close();
|
self.close(panel);
|
||||||
}
|
}
|
||||||
// Return false so that the panel does not close unless close()
|
// Return false so that the panel does not close unless close()
|
||||||
// is called explicitly (when all needed prompts are issued).
|
// is called explicitly (when all needed prompts are issued).
|
||||||
@ -5123,21 +5123,30 @@ define('tools.querytool', [
|
|||||||
alertify.confirmSave(gettext('Save changes?'), msg, is_unsaved_data);
|
alertify.confirmSave(gettext('Save changes?'), msg, is_unsaved_data);
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function() {
|
close: function(closePanel=null) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
pgBrowser.Events.off('pgadmin:user:logged-in', this.initTransaction);
|
pgBrowser.Events.off('pgadmin:user:logged-in', this.initTransaction);
|
||||||
_.each(pgWindow.default.pgAdmin.Browser.docker.findPanels('frm_datagrid'), function(panel) {
|
// close specific panel
|
||||||
if (panel.isVisible()) {
|
if (closePanel) {
|
||||||
window.onbeforeunload = null;
|
self._close(closePanel);
|
||||||
panel.off(wcDocker.EVENT.CLOSING);
|
} else {
|
||||||
// remove col_size object on panel close
|
// Iterate the all query tool instance and close the visible query tool instance.
|
||||||
if (!_.isUndefined(self.col_size)) {
|
_.each(pgWindow.default.pgAdmin.Browser.docker.findPanels('frm_datagrid'), function(panel) {
|
||||||
delete self.col_size;
|
self._close(panel);
|
||||||
}
|
});
|
||||||
pgWindow.default.pgAdmin.Browser.docker.removePanel(panel);
|
}
|
||||||
|
},
|
||||||
|
_close: function(closePanel) {
|
||||||
|
if (closePanel.isVisible()) {
|
||||||
|
window.onbeforeunload = null;
|
||||||
|
closePanel.off(wcDocker.EVENT.CLOSING);
|
||||||
|
// remove col_size object on panel close
|
||||||
|
if (!_.isUndefined(self.col_size)) {
|
||||||
|
delete self.col_size;
|
||||||
}
|
}
|
||||||
});
|
pgWindow.default.pgAdmin.Browser.docker.removePanel(closePanel);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/* This function is used to raise notify messages and update
|
/* This function is used to raise notify messages and update
|
||||||
* the notification grid.
|
* the notification grid.
|
||||||
|
Loading…
Reference in New Issue
Block a user