From 9e078c0fa8d9b259c27319c59307c8ee282fdcd1 Mon Sep 17 00:00:00 2001 From: Yogesh Mahajan Date: Wed, 30 Nov 2022 13:59:45 +0530 Subject: [PATCH] Fixed issue of opening query tool from new query tool icon beside connection status. #5575 --- web/pgadmin/tools/sqleditor/static/js/show_query_tool.js | 4 ++-- web/pgadmin/tools/sqleditor/static/js/show_view_data.js | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/web/pgadmin/tools/sqleditor/static/js/show_query_tool.js b/web/pgadmin/tools/sqleditor/static/js/show_query_tool.js index 1406a36b0e6..b8bd6179b33 100644 --- a/web/pgadmin/tools/sqleditor/static/js/show_query_tool.js +++ b/web/pgadmin/tools/sqleditor/static/js/show_query_tool.js @@ -32,8 +32,8 @@ export function generateUrl(trans_id, parentData, sqlId) { if(parentData.database.label) { url_endpoint += `&database_name=${parentData.database.label}`; } - if(parentData.server.user.name){ - url_endpoint += `&user=${parentData.server.user.name}`; + if(!parentData.server.user_name && parentData.server.user?.name) { + url_endpoint += `&user=${parentData.server.user?.name}`; } } diff --git a/web/pgadmin/tools/sqleditor/static/js/show_view_data.js b/web/pgadmin/tools/sqleditor/static/js/show_view_data.js index e3b3bf61219..e5c97b90cda 100644 --- a/web/pgadmin/tools/sqleditor/static/js/show_view_data.js +++ b/web/pgadmin/tools/sqleditor/static/js/show_view_data.js @@ -134,9 +134,12 @@ function generateUrl(trans_id, connectionData, nodeData, parentData) { +`&sgid=${parentData.server_group._id}` +`&sid=${parentData.server._id}` +`&did=${parentData.database._id}` - +`&user=${parentData.server.user.name}` +`&server_type=${parentData.server.server_type}`; + if(!parentData.server.user_name && parentData.server.user?.name) { + url_endpoint += `&user=${parentData.server.user?.name}`; + } + return url_endpoint; }