mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-13 09:32:01 -06:00
Ensure that the query tool tab should be closed after server disconnection when auto-commit/auto-rollback is set to false. Fixes #5519
This commit is contained in:
parent
07f2df7e66
commit
566f03beca
@ -1,5 +1,5 @@
|
|||||||
************
|
************
|
||||||
Version 5.1
|
Version 5.2
|
||||||
************
|
************
|
||||||
|
|
||||||
Release date: 2021-04-22
|
Release date: 2021-04-22
|
||||||
@ -18,6 +18,7 @@ Housekeeping
|
|||||||
Bug fixes
|
Bug fixes
|
||||||
*********
|
*********
|
||||||
|
|
||||||
|
| `Issue #5519 <https://redmine.postgresql.org/issues/5519>`_ - Ensure that the query tool tab should be closed after server disconnection when auto-commit/auto-rollback is set to false.
|
||||||
| `Issue #6293 <https://redmine.postgresql.org/issues/6293>`_ - Fixed an issue where the procedure creation is failed when providing the Volatility option.
|
| `Issue #6293 <https://redmine.postgresql.org/issues/6293>`_ - Fixed an issue where the procedure creation is failed when providing the Volatility option.
|
||||||
| `Issue #6344 <https://redmine.postgresql.org/issues/6344>`_ - Fixed cannot unpack non-iterable response object error when selecting any partition.
|
| `Issue #6344 <https://redmine.postgresql.org/issues/6344>`_ - Fixed cannot unpack non-iterable response object error when selecting any partition.
|
||||||
| `Issue #6356 <https://redmine.postgresql.org/issues/6356>`_ - Mark the Apache HTTPD config file as such in the web DEB and RPM packages.
|
| `Issue #6356 <https://redmine.postgresql.org/issues/6356>`_ - Mark the Apache HTTPD config file as such in the web DEB and RPM packages.
|
||||||
|
@ -287,7 +287,7 @@ define('pgadmin.node.server', [
|
|||||||
function() { disconnect(); },
|
function() { disconnect(); },
|
||||||
function() { return true;}
|
function() { return true;}
|
||||||
).set('labels', {
|
).set('labels', {
|
||||||
ok: gettext('Ok'),
|
ok: gettext('OK'),
|
||||||
cancel: gettext('Cancel'),
|
cancel: gettext('Cancel'),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -258,7 +258,7 @@ let NewConnectionDialog = {
|
|||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
Alertify.alert().setting({
|
Alertify.alert().setting({
|
||||||
'title': gettext('Connection lost'),
|
'title': gettext('Connection lost'),
|
||||||
'label':gettext('Ok'),
|
'label':gettext('OK'),
|
||||||
'message': gettext('Connection to the server has been lost.'),
|
'message': gettext('Connection to the server has been lost.'),
|
||||||
'onok': function(){
|
'onok': function(){
|
||||||
//Close the window after connection is lost
|
//Close the window after connection is lost
|
||||||
|
@ -244,7 +244,7 @@ function initFilterDialog(alertify, pgBrowser) {
|
|||||||
alertify.alert()
|
alertify.alert()
|
||||||
.setting({
|
.setting({
|
||||||
'title': gettext('Validation Error'),
|
'title': gettext('Validation Error'),
|
||||||
'label':gettext('Ok'),
|
'label':gettext('OK'),
|
||||||
'message': gettext(res.data.result),
|
'message': gettext(res.data.result),
|
||||||
'onok': function(){
|
'onok': function(){
|
||||||
filter_editor.focus();
|
filter_editor.focus();
|
||||||
|
@ -119,6 +119,7 @@ class SqlEditorModule(PgAdminModule):
|
|||||||
'sqleditor.get_new_connection_data',
|
'sqleditor.get_new_connection_data',
|
||||||
'sqleditor.get_new_connection_database',
|
'sqleditor.get_new_connection_database',
|
||||||
'sqleditor.get_new_connection_user',
|
'sqleditor.get_new_connection_user',
|
||||||
|
'sqleditor._check_server_connection_status',
|
||||||
'sqleditor.get_new_connection_role',
|
'sqleditor.get_new_connection_role',
|
||||||
'sqleditor.connect_server',
|
'sqleditor.connect_server',
|
||||||
'sqleditor.connect_server_with_user',
|
'sqleditor.connect_server_with_user',
|
||||||
@ -1479,6 +1480,49 @@ def get_filter_data(trans_id):
|
|||||||
return FilterDialog.get(status, error_msg, conn, trans_obj, session_ob)
|
return FilterDialog.get(status, error_msg, conn, trans_obj, session_ob)
|
||||||
|
|
||||||
|
|
||||||
|
@blueprint.route(
|
||||||
|
'/get_server_connection/<int:sgid>/<int:sid>',
|
||||||
|
methods=["GET"], endpoint='_check_server_connection_status'
|
||||||
|
)
|
||||||
|
@login_required
|
||||||
|
def _check_server_connection_status(sgid, sid=None):
|
||||||
|
"""
|
||||||
|
This function returns the server connection details
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
driver = get_driver(PG_DEFAULT_DRIVER)
|
||||||
|
from pgadmin.browser.server_groups.servers import \
|
||||||
|
server_icon_and_background
|
||||||
|
server = Server.query.filter_by(
|
||||||
|
id=sid).first()
|
||||||
|
|
||||||
|
manager = driver.connection_manager(server.id)
|
||||||
|
conn = manager.connection()
|
||||||
|
connected = conn.connected()
|
||||||
|
|
||||||
|
msg = "Success"
|
||||||
|
return make_json_response(
|
||||||
|
data={
|
||||||
|
'status': True,
|
||||||
|
'msg': msg,
|
||||||
|
'result': {
|
||||||
|
'server': connected
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
return make_json_response(
|
||||||
|
data={
|
||||||
|
'status': False,
|
||||||
|
'msg': ERROR_FETCHING_DATA,
|
||||||
|
'result': {
|
||||||
|
'server': False
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route(
|
@blueprint.route(
|
||||||
'/new_connection_dialog/<int:sgid>/<int:sid>',
|
'/new_connection_dialog/<int:sgid>/<int:sid>',
|
||||||
methods=["GET"], endpoint='get_new_connection_data'
|
methods=["GET"], endpoint='get_new_connection_data'
|
||||||
|
@ -4809,7 +4809,7 @@ define('tools.querytool', [
|
|||||||
else if (!ignore_unsaved_query && self.is_query_tool
|
else if (!ignore_unsaved_query && self.is_query_tool
|
||||||
&& self.is_query_changed
|
&& self.is_query_changed
|
||||||
&& self.preferences.prompt_save_query_changes) {
|
&& self.preferences.prompt_save_query_changes) {
|
||||||
msg = gettext('The text has changed. Do you want to save changes?');
|
msg = gettext('The query text has changed. Do you want to save changes?');
|
||||||
self.unsaved_changes_user_confirmation(msg, false);
|
self.unsaved_changes_user_confirmation(msg, false);
|
||||||
} // If a transaction is currently ongoing
|
} // If a transaction is currently ongoing
|
||||||
else if (self.preferences.prompt_commit_transaction
|
else if (self.preferences.prompt_commit_transaction
|
||||||
@ -4938,14 +4938,45 @@ define('tools.querytool', [
|
|||||||
break;
|
break;
|
||||||
case 1: // Don't Save
|
case 1: // Don't Save
|
||||||
self.close_on_save = false;
|
self.close_on_save = false;
|
||||||
if(this.is_unsaved_data)
|
$.ajax({
|
||||||
self.ignore_on_close.unsaved_data = true;
|
url: url_for('sqleditor._check_server_connection_status', {
|
||||||
else
|
'sid': self.url_params.sid,
|
||||||
self.ignore_on_close.unsaved_query = true;
|
'sgid': self.url_params.sgid,
|
||||||
// Go back to check for any other needed confirmations before closing
|
}),
|
||||||
if (!self.check_needed_confirmations_before_closing_panel()){
|
headers: {
|
||||||
closeEvent.cancel = true;
|
'Cache-Control' : 'no-cache',
|
||||||
}
|
},
|
||||||
|
}).done(function (res) {
|
||||||
|
let response = res.data.result.server;
|
||||||
|
if (response) {
|
||||||
|
closeEvent.cancel = true;
|
||||||
|
if (this.is_unsaved_data)
|
||||||
|
self.ignore_on_close.unsaved_data = true;
|
||||||
|
else
|
||||||
|
self.ignore_on_close.unsaved_query = true;
|
||||||
|
|
||||||
|
// Go back to check for any other needed confirmations before closing
|
||||||
|
if (!self.check_needed_confirmations_before_closing_panel()) {
|
||||||
|
closeEvent.cancel = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alertify.confirm(
|
||||||
|
gettext('Warning'),
|
||||||
|
gettext('The current transaction has been rolled back because the server was disconnected.'),
|
||||||
|
function() {
|
||||||
|
// Close the query tool if server is disconnected.
|
||||||
|
setTimeout(() => { self.close(); }, 200);
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
).set('labels', {
|
||||||
|
ok: gettext('OK')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).fail(function() {
|
||||||
|
/* failure should be ignored */
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case 2: //Save
|
case 2: //Save
|
||||||
self.close_on_save = true;
|
self.close_on_save = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user