mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added more information to the 'Database connected/disconnected' message. Fixes #4943.
This commit is contained in:
committed by
Akshay Joshi
parent
9bda583d5b
commit
53f418b9a2
@@ -30,6 +30,7 @@ from pgadmin.utils.ajax import make_json_response, \
|
||||
make_response as ajax_response, internal_server_error, unauthorized
|
||||
from pgadmin.utils.driver import get_driver
|
||||
from pgadmin.tools.sqleditor.utils.query_history import QueryHistory
|
||||
from pgadmin.model import Server
|
||||
|
||||
|
||||
class DatabaseModule(CollectionNodeModule):
|
||||
@@ -468,7 +469,9 @@ class DatabaseView(PGChildNodeView):
|
||||
info=_("Database connected."),
|
||||
data={
|
||||
'icon': 'pg-icon-database',
|
||||
'connected': True
|
||||
'connected': True,
|
||||
'info_prefix': '{0}/{1}'.
|
||||
format(Server.query.filter_by(id=sid)[0].name, conn.db)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -478,7 +481,7 @@ class DatabaseView(PGChildNodeView):
|
||||
# Release Connection
|
||||
from pgadmin.utils.driver import get_driver
|
||||
manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(sid)
|
||||
|
||||
conn = manager.connection(did=did, auto_reconnect=True)
|
||||
status = manager.release(did=did)
|
||||
|
||||
if not status:
|
||||
@@ -489,7 +492,9 @@ class DatabaseView(PGChildNodeView):
|
||||
info=_("Database disconnected."),
|
||||
data={
|
||||
'icon': 'icon-database-not-connected',
|
||||
'connected': False
|
||||
'connected': False,
|
||||
'info_prefix': '{0}/{1}'.
|
||||
format(Server.query.filter_by(id=sid)[0].name, conn.db)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -200,6 +200,9 @@ define('pgadmin.node.database', [
|
||||
.done(function(res) {
|
||||
if (res.success == 1) {
|
||||
var prv_i = t.parent(i);
|
||||
if(res.data.info_prefix) {
|
||||
res.info = `${_.escape(res.data.info_prefix)} - ${res.info}`;
|
||||
}
|
||||
Alertify.success(res.info);
|
||||
t.removeIcon(i);
|
||||
data.connected = false;
|
||||
@@ -519,6 +522,9 @@ define('pgadmin.node.database', [
|
||||
data.icon = res.data.icon;
|
||||
tree.addIcon(item, {icon: data.icon});
|
||||
}
|
||||
if(res.data.info_prefix) {
|
||||
res.info = `${_.escape(res.data.info_prefix)} - ${res.info}`;
|
||||
}
|
||||
|
||||
Alertify.success(res.info);
|
||||
obj.trigger('connected', obj, item, data);
|
||||
|
||||
Reference in New Issue
Block a user