Fixed following issues reported while testing application restore changes: #8901

1. Preserve updated tab titles on session restore
2. Ensure query tools opened via the 'Generate Script' are editable.
3. On restore, ensure the query content is correctly loaded into the query tool when it is opened from tools like ERD.
This commit is contained in:
Yogesh Mahajan
2025-07-17 16:28:57 +05:30
committed by GitHub
parent fe2332f606
commit 82730da392
6 changed files with 10 additions and 3 deletions
@@ -73,6 +73,8 @@ export function ApplicationStateProvider({children}){
// file has external chages
return {loadFile: loadFile, fileName: fileName, data: toolContent, modifiedExternally: true};
}
}else if(connectionInfo.file_deleted){
return {loadFile: loadFile, fileName: null, data: toolContent};
}else{
loadFile = true;
return {loadFile: loadFile, fileName: fileName, data: null};
-1
View File
@@ -35,5 +35,4 @@ ToolErrorView.propTypes = {
error: PropTypes.string,
panelId: PropTypes.string,
panelDocker: PropTypes.object,
toolDataId: PropTypes.string
};
+3
View File
@@ -39,6 +39,9 @@ ToolForm.propTypes = {
};
export function getToolTabParams(panelId, toolUrl, formParams, tabParams, restore=false) {
if(tabParams?.internal?.orig_title){
tabParams.title = tabParams.internal.title;
}
return {
id: panelId,
title: panelId,
@@ -397,6 +397,8 @@ export default class ERDTool extends React.Component {
this.diagram.clearSelection();
this.registerModelEvents();
if(toolContent.fileName)this.setState({current_file: toolContent.fileName});
this.setState({dirty: true});
this.eventBus.fireEvent(ERD_EVENTS.DIRTY, true, toolContent.data);
}
}
};
@@ -288,12 +288,13 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.HANDLE_API_ERROR, err);
setQtStatePartial({ editor_disabled: true });
});
} else if (qtState.params.sql_id) {
} else if (qtState.params.sql_id && qtState.params.restore != 'true') {
let sqlValue = localStorage.getItem(qtState.params.sql_id);
localStorage.removeItem(qtState.params.sql_id);
if (sqlValue) {
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.EDITOR_SET_SQL, sqlValue);
}
setQtStatePartial({ editor_disabled: false });
} else if (qtState.params.restore == 'true') {
restoreToolContent();
} else {
@@ -104,7 +104,7 @@ export function showERDSqlTool(parentData, erdSqlId, queryToolTitle, queryToolMo
},
database: {
_id: parentData.did,
label: parentData.database,
_label: parentData.database,
},
};