From 6bd0ea7a0255692271398c09890de721a3bffd72 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Wed, 8 Mar 2023 16:59:36 +0530 Subject: [PATCH] Fixed an issue where the file name in the query tool tab was not changing if another file is opened. #5909 --- docs/en_US/release_notes_6_21.rst | 1 + .../sqleditor/static/js/components/QueryToolComponent.jsx | 1 - .../sqleditor/static/js/components/sections/MainToolBar.jsx | 3 +++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/en_US/release_notes_6_21.rst b/docs/en_US/release_notes_6_21.rst index c827b4eda..8d4c334ee 100644 --- a/docs/en_US/release_notes_6_21.rst +++ b/docs/en_US/release_notes_6_21.rst @@ -46,3 +46,4 @@ Bug fixes | `Issue #5870 `_ - Ensure that the database migration does not fail with a NoSuchTableError exception. | `Issue #5872 `_ - Handle MERGE operation in query tool explain introduced in PostgreSQL 15. | `Issue #5889 `_ - Fixed an issue where the database server is not connected using a service file. + | `Issue #5909 `_ - Fixed an issue where the file name in the query tool tab was not changing if another file is opened. diff --git a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolComponent.jsx b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolComponent.jsx index eccc39ce0..ab7af95cc 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolComponent.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolComponent.jsx @@ -431,7 +431,6 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN setPanelTitle(panel, fileName, {...qtState, current_file: fileName}); } eventBus.current.fireEvent(QUERY_TOOL_EVENTS.EDITOR_LAST_FOCUS); - eventBus.current.fireEvent(QUERY_TOOL_EVENTS.QUERY_CHANGED, isDirtyRef.current); }; const events = [ [QUERY_TOOL_EVENTS.TRIGGER_LOAD_FILE, ()=>{ diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/MainToolBar.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/MainToolBar.jsx index 8037ad1e5..d5b3985fa 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/MainToolBar.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/MainToolBar.jsx @@ -251,6 +251,9 @@ export function MainToolBar({containerRef, onFilterClick, onManageMacros}) { eventBus.registerListener(QUERY_TOOL_EVENTS.QUERY_CHANGED, (isDirty)=>{ setDisableButton('save', !isDirty); }); + eventBus.registerListener(QUERY_TOOL_EVENTS.LOAD_FILE_DONE, ()=>{ + setDisableButton('save', true); + }); eventBus.registerListener(QUERY_TOOL_EVENTS.DATAGRID_CHANGED, (isDirty)=>{ setDisableButton('save-data', !isDirty); });