Ensure that disabling "Save Application State" in Preferences prevents tool data from being saved and stops it from being restored on application restart. #9067
parent
ecb652c7c5
commit
7d0241008b
|
|
@ -24,7 +24,6 @@ New features
|
|||
| `Issue #6456 <https://github.com/pgadmin-org/pgadmin4/issues/6456>`_ - Added GENERIC_PLAN, MEMORY, SERIALIZE option to EXPLAIN/EXPLAIN ANALYZE command.
|
||||
| `Issue #8917 <https://github.com/pgadmin-org/pgadmin4/issues/8917>`_ - Add support for server tag-based filtering in the Object Explorer.
|
||||
| `Issue #8931 <https://github.com/pgadmin-org/pgadmin4/issues/8931>`_ - Added support for builtin locale provider while creating Collation.
|
||||
| `Issue #8935 <https://github.com/pgadmin-org/pgadmin4/issues/8935>`_ - Added all new connection string parameters introduced in PostgreSQL 16 and later.
|
||||
|
||||
Housekeeping
|
||||
************
|
||||
|
|
@ -47,4 +46,5 @@ Bug fixes
|
|||
| `Issue #8982 <https://github.com/pgadmin-org/pgadmin4/issues/8982>`_ - Fixed an issue where adding breakpoints caused errors, and stepping out of a nested function removed breakpoints from the parent function.
|
||||
| `Issue #9007 <https://github.com/pgadmin-org/pgadmin4/issues/9007>`_ - Ensure the scratch pad in the Query Tool is not restored after it is closed.
|
||||
| `Issue #9008 <https://github.com/pgadmin-org/pgadmin4/issues/9008>`_ - Update the documentation for parameters that require file paths.
|
||||
| `Issue #9047 <https://github.com/pgadmin-org/pgadmin4/issues/9047>`_ - Fixed an issue where downloading images on the ERD tool was not working in desktop mode.
|
||||
| `Issue #9047 <https://github.com/pgadmin-org/pgadmin4/issues/9047>`_ - Fixed an issue where downloading images on the ERD tool was not working in desktop mode.
|
||||
| `Issue #9067 <https://github.com/pgadmin-org/pgadmin4/issues/9067>`_ - Ensure that disabling "Save Application State" in Preferences prevents tool data from being saved and stops it from being restored on application restart.
|
||||
|
|
@ -215,11 +215,11 @@ class AdHocConnectionSchema extends BaseUISchema {
|
|||
disabled: (state) => state.sid,
|
||||
},{
|
||||
id: 'did', label: gettext('Database'), deps: ['sid', 'connected'],
|
||||
controlProps: {creatable: true},
|
||||
type: (state) => {
|
||||
if (state?.sid) {
|
||||
return {
|
||||
type: 'select',
|
||||
controlProps: {creatable: true},
|
||||
options: () => this.getOtherOptions(
|
||||
state.sid, 'get_new_connection_database'
|
||||
),
|
||||
|
|
@ -238,11 +238,11 @@ class AdHocConnectionSchema extends BaseUISchema {
|
|||
}
|
||||
}, {
|
||||
id: 'user', label: gettext('User'), deps: ['sid', 'connected'],
|
||||
controlProps: {creatable: true},
|
||||
type: (state) => {
|
||||
if (state?.sid) {
|
||||
return {
|
||||
type: 'select',
|
||||
controlProps: {creatable: true},
|
||||
options: () => this.getOtherOptions(
|
||||
state.sid, 'get_new_connection_user'
|
||||
),
|
||||
|
|
@ -266,9 +266,9 @@ class AdHocConnectionSchema extends BaseUISchema {
|
|||
}
|
||||
},{
|
||||
id: 'role', label: gettext('Role'), deps: ['sid', 'connected'],
|
||||
controlProps: {creatable: true},
|
||||
type: (state)=>({
|
||||
type: 'select',
|
||||
controlProps: {creatable: true},
|
||||
options: () => this.getOtherOptions(
|
||||
state.sid, 'get_new_connection_role'
|
||||
),
|
||||
|
|
|
|||
|
|
@ -396,6 +396,7 @@ export default function Layout({groups, noContextGroups, getLayoutInstance, layo
|
|||
const layoutDockerObj = React.useMemo(()=>new LayoutDocker(layoutId, props.defaultLayout, resetToTabPanel, noContextGroups), []);
|
||||
const prefStore = usePreferences();
|
||||
const dynamicTabsStyleRef = useRef();
|
||||
const saveAppStateRef = useRef(prefStore?.getPreferencesForModule('misc')?.save_app_state);
|
||||
const { deleteToolData } = useApplicationState();
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -411,6 +412,8 @@ export default function Layout({groups, noContextGroups, getLayoutInstance, layo
|
|||
|
||||
useEffect(()=>{
|
||||
const dynamicTabs = prefStore.getPreferencesForModule('browser')?.dynamic_tabs;
|
||||
const saveAppState = prefStore?.getPreferencesForModule('misc')?.save_app_state;
|
||||
|
||||
// Add a class to set max width for non dynamic Tabs
|
||||
if(!dynamicTabs && !dynamicTabsStyleRef.current) {
|
||||
const css = '.dock-tab:not(div.dock-tab-active) { max-width: 180px; }',
|
||||
|
|
@ -423,6 +426,12 @@ export default function Layout({groups, noContextGroups, getLayoutInstance, layo
|
|||
dynamicTabsStyleRef.current.remove();
|
||||
dynamicTabsStyleRef.current = null;
|
||||
}
|
||||
|
||||
if(!saveAppState && saveAppStateRef.current){
|
||||
layoutDockerObj.saveLayout();
|
||||
}
|
||||
saveAppStateRef.current = saveAppState;
|
||||
|
||||
}, [prefStore]);
|
||||
|
||||
const getTabMenuItems = (panelId)=>{
|
||||
|
|
@ -470,10 +479,8 @@ export default function Layout({groups, noContextGroups, getLayoutInstance, layo
|
|||
const saveTab = (tab) => {
|
||||
// 'tab' here is the full TabData object, potentially with 'title', 'content', etc.
|
||||
// We only want to save the 'id' and any custom properties needed by loadTab.
|
||||
const savedTab = {
|
||||
id: tab.id,
|
||||
};
|
||||
if (tab.metaData && !BROWSER_PANELS.DEBUGGER_TOOL.includes(tab.id.split('_')[0])) {
|
||||
const savedTab = { id: tab.id };
|
||||
if (saveAppStateRef.current && tab.metaData && !BROWSER_PANELS.DEBUGGER_TOOL.includes(tab.id.split('_')[0])) {
|
||||
// add custom properties that were part of the original TabBase
|
||||
const updatedMetaData = {
|
||||
...tab.metaData,
|
||||
|
|
|
|||
Loading…
Reference in New Issue