Fixed an issue when switching between connections in the Query Tool dropdown,

the background and foreground colors should be changed. Fixes #7374
This commit is contained in:
Aditya Toshniwal 2022-05-26 15:31:18 +05:30 committed by Akshay Joshi
parent aaab5c51a7
commit b507eb8857
4 changed files with 15 additions and 1 deletions

View File

@ -25,6 +25,7 @@ Bug fixes
| `Issue #7368 <https://redmine.postgresql.org/issues/7368>`_ - Ensure that unwanted APIs should not be getting called for BigAnimal.
| `Issue #7372 <https://redmine.postgresql.org/issues/7372>`_ - Tell Docker to always pull the latest base images when building containers.
| `Issue #7373 <https://redmine.postgresql.org/issues/7373>`_ - Fixed an issue with geometry window zoom mouse scroll not working.
| `Issue #7374 <https://redmine.postgresql.org/issues/7374>`_ - Fixed an issue when switching between connections in the Query Tool dropdown, the background and foreground colors should be changed.
| `Issue #7376 <https://redmine.postgresql.org/issues/7376>`_ - Fixed an issue where a popup for unsaved changes appears when clicking on the open file button for a blank query editor.
| `Issue #7380 <https://redmine.postgresql.org/issues/7380>`_ - Added support for multi-cell selection in the query tool grid.
| `Issue #7383 <https://redmine.postgresql.org/issues/7383>`_ - Fixed an issue where Preferences are not saved when the dialog is maximized.

View File

@ -2061,6 +2061,8 @@ def get_new_connection_data(sgid=None, sid=None):
"value": server.serialize['id'],
'image': server_icon_and_background(connected, manager,
server),
'fgcolor': server.serialize['fgcolor'],
'bgcolor': server.serialize['bgcolor'],
'connected': connected})
msg = "Success"

View File

@ -514,6 +514,8 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
sid: connectionData.sid,
did: connectionData.did,
title: connectionData.title,
fgcolor: connectionData.fgcolor,
bgcolor: connectionData.bgcolor,
},
connected: respData.data.trans_id ? true : false,
obtaining_conn: false,
@ -561,6 +563,8 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
conn_title: getTitle(pgAdmin, null, null, true, data.server_name, data.database_name, data.role || data.user, true),
server_name: data.server_name,
database_name: data.database_name,
bgcolor: data.bgcolor,
fgcolor: data.fgcolor,
is_selected: true,
};

View File

@ -124,12 +124,15 @@ class NewConnectionSchema extends BaseUISchema {
depChange: (state)=>{
/* Once the option is selected get the name */
/* Force sid to null, and set only if connected */
let selectedServer = _.find(this.flatServers, (s)=>s.value==state.sid);
return {
server_name: _.find(this.flatServers, (s)=>s.value==state.sid)?.label,
server_name: selectedServer?.label,
did: null,
user: null,
role: null,
sid: null,
fgcolor: selectedServer?.fgcolor,
bgcolor: selectedServer?.bgcolor,
};
},
deferredDepChange: (state, source, topState, actionObj)=>{
@ -181,6 +184,10 @@ class NewConnectionSchema extends BaseUISchema {
id: 'server_name', label: '', type: 'text', visible: false,
},{
id: 'database_name', label: '', type: 'text', visible: false,
},{
id: 'bgcolor', label: '', type: 'text', visible: false,
},{
id: 'fgcolor', label: '', type: 'text', visible: false,
},
];
}