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

@@ -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,
},
];
}