Fixed an issue where query tool title did not change after 'Save As' until any new change is made. #6193

This commit is contained in:
Aditya Toshniwal
2023-12-21 17:40:24 +05:30
parent c85a9be621
commit c8d6ff8a6d
5 changed files with 5 additions and 3 deletions

View File

@@ -457,7 +457,7 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
current_file: fileName,
});
isDirtyRef.current = false;
setPanelTitle(qtPanelDocker, qtPanelId, fileName, {...qtState, current_file: fileName});
setPanelTitle(qtPanelDocker, qtPanelId, fileName, {...qtState, current_file: fileName}, isDirtyRef.current);
}
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.EDITOR_LAST_FOCUS);
};

View File

@@ -256,6 +256,9 @@ export function MainToolBar({containerRef, onFilterClick, onManageMacros}) {
eventBus.registerListener(QUERY_TOOL_EVENTS.LOAD_FILE_DONE, ()=>{
setDisableButton('save', true);
});
eventBus.registerListener(QUERY_TOOL_EVENTS.SAVE_FILE_DONE, ()=>{
setDisableButton('save', true);
});
eventBus.registerListener(QUERY_TOOL_EVENTS.DATAGRID_CHANGED, (isDirty)=>{
setDisableButton('save-data', !isDirty);
});

View File

@@ -396,7 +396,6 @@ export default function Query() {
}).then(()=>{
lastSavedText.current = editorValue;
eventBus.fireEvent(QUERY_TOOL_EVENTS.SAVE_FILE_DONE, fileName, true);
eventBus.fireEvent(QUERY_TOOL_EVENTS.QUERY_CHANGED, isDirty());
pgAdmin.Browser.notifier.success(gettext('File saved successfully.'));
}).catch((err)=>{
eventBus.fireEvent(QUERY_TOOL_EVENTS.SAVE_FILE_DONE, null, false);