Ensure that the Query Editor should be focused when switching between query tool tabs. Fixes #7441

This commit is contained in:
Aditya Toshniwal
2022-06-13 14:26:01 +05:30
committed by Akshay Joshi
parent ea3203f466
commit 725726f083
3 changed files with 13 additions and 0 deletions

View File

@@ -318,6 +318,17 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.WARN_SAVE_DATA_CLOSE);
});
panel?.on(window.wcDocker.EVENT.VISIBILITY_CHANGED, function() {
/* Focus the appropriate panel on visible */
if(panel.isVisible()) {
if(LayoutHelper.isTabVisible(docker.current, PANELS.QUERY)) {
LayoutHelper.focus(docker.current, PANELS.QUERY);
} else if(LayoutHelper.isTabVisible(docker.current, PANELS.HISTORY)) {
LayoutHelper.focus(docker.current, PANELS.HISTORY);
}
}
});
pgAdmin.Browser.Events.on('pgadmin-storage:finish_btn:select_file', (fileName)=>{
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.LOAD_FILE, fileName);
}, pgAdmin);