mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-09-03 20:52:57 -05: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:
committed by
Akshay Joshi
parent
07f2df7e66
commit
566f03beca
@@ -119,6 +119,7 @@ class SqlEditorModule(PgAdminModule):
|
||||
'sqleditor.get_new_connection_data',
|
||||
'sqleditor.get_new_connection_database',
|
||||
'sqleditor.get_new_connection_user',
|
||||
'sqleditor._check_server_connection_status',
|
||||
'sqleditor.get_new_connection_role',
|
||||
'sqleditor.connect_server',
|
||||
'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)
|
||||
|
||||
|
||||
@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(
|
||||
'/new_connection_dialog/<int:sgid>/<int:sid>',
|
||||
methods=["GET"], endpoint='get_new_connection_data'
|
||||
|
||||
Reference in New Issue
Block a user