mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed issues for Workspaces:
1) Unable to add ad-hoc server with External Database. 2) Server list not updating when password is saved on the Welcome page. 3) Icons for Query Tool and PSQL missing on the Welcome page. 4) Error when removing connection parameters.
This commit is contained in:
@@ -95,23 +95,24 @@ def adhoc_connect_server():
|
||||
connection_params = convert_connection_parameter(
|
||||
data.get('connection_params', []))
|
||||
|
||||
if 'hostaddr' in connection_params and \
|
||||
not is_valid_ipaddress(connection_params['hostaddr']):
|
||||
return make_json_response(
|
||||
success=0,
|
||||
status=400,
|
||||
errormsg=gettext('Not a valid Host address')
|
||||
)
|
||||
if connection_params is not None:
|
||||
if 'hostaddr' in connection_params and \
|
||||
not is_valid_ipaddress(connection_params['hostaddr']):
|
||||
return make_json_response(
|
||||
success=0,
|
||||
status=400,
|
||||
errormsg=gettext('Not a valid Host address')
|
||||
)
|
||||
|
||||
# To check ssl configuration
|
||||
_, connection_params = check_ssl_fields(connection_params)
|
||||
# set the connection params again in the data
|
||||
if 'connection_params' in data:
|
||||
data['connection_params'] = connection_params
|
||||
# To check ssl configuration
|
||||
_, connection_params = check_ssl_fields(connection_params)
|
||||
# set the connection params again in the data
|
||||
if 'connection_params' in data:
|
||||
data['connection_params'] = connection_params
|
||||
|
||||
# Fetch all the new data in case of non-existing servers
|
||||
new_host = data.get('host', None)
|
||||
new_port = data.get('port', None)
|
||||
new_port = int(data.get('port', 0))
|
||||
new_db = data.get('database_name', None)
|
||||
if new_db is None:
|
||||
new_db = data.get('did')
|
||||
|
@@ -149,12 +149,15 @@ class AdHocConnectionSchema extends BaseUISchema {
|
||||
optionsReloadBasis: `${self.flatServers.map((s) => s.connected).join('')}${state.connection_refresh}`,
|
||||
}),
|
||||
depChange: (state, source)=>{
|
||||
if(source == 'connection_refresh') return;
|
||||
/* Once the option is selected get the name */
|
||||
/* Force sid to null, and set only if connected */
|
||||
// Check for connection status
|
||||
let selectedServer = _.find(
|
||||
self.flatServers, (s) => s.value == state.sid
|
||||
);
|
||||
if(source.includes('connection_refresh')) {
|
||||
return {
|
||||
connected: selectedServer?.connected
|
||||
};
|
||||
}
|
||||
return {
|
||||
server_name: null,
|
||||
did: null,
|
||||
@@ -205,7 +208,7 @@ class AdHocConnectionSchema extends BaseUISchema {
|
||||
disabled: (state) => state.sid,
|
||||
},{
|
||||
id: 'did', label: gettext('Database'), deps: ['sid', 'connected'],
|
||||
noEmpty: true, controlProps: {creatable: true},
|
||||
controlProps: {creatable: true},
|
||||
type: (state) => {
|
||||
if (state?.sid) {
|
||||
return {
|
||||
@@ -303,15 +306,6 @@ class AdHocConnectionSchema extends BaseUISchema {
|
||||
setError('host', null);
|
||||
}
|
||||
}
|
||||
|
||||
if(isEmptyString(state.username)) {
|
||||
errmsg = gettext('Username must be specified.');
|
||||
setError('username', errmsg);
|
||||
return true;
|
||||
} else {
|
||||
setError('username', null);
|
||||
}
|
||||
|
||||
if(isEmptyString(state.port)) {
|
||||
errmsg = gettext('Port must be specified.');
|
||||
setError('port', errmsg);
|
||||
@@ -319,8 +313,24 @@ class AdHocConnectionSchema extends BaseUISchema {
|
||||
} else {
|
||||
setError('port', null);
|
||||
}
|
||||
|
||||
if(isEmptyString(state.did)) {
|
||||
errmsg = gettext('Database must be specified.');
|
||||
setError('did', errmsg);
|
||||
return true;
|
||||
} else {
|
||||
setError('did', null);
|
||||
}
|
||||
|
||||
if(isEmptyString(state.user)) {
|
||||
errmsg = gettext('User must be specified.');
|
||||
setError('user', errmsg);
|
||||
return true;
|
||||
} else {
|
||||
setError('user', null);
|
||||
}
|
||||
} else {
|
||||
_.each(['host', 'db', 'username', 'port'], (item) => {
|
||||
_.each(['host', 'port', 'did', 'user'], (item) => {
|
||||
setError(item, null);
|
||||
});
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@ import { useSchemaState } from './hooks';
|
||||
import { getForQueryParams } from './common';
|
||||
import { QueryToolIcon } from '../components/ExternalIcon';
|
||||
import TerminalRoundedIcon from '@mui/icons-material/TerminalRounded';
|
||||
import { WORKSPACES } from '../../../browser/static/js/constants';
|
||||
|
||||
|
||||
/* If its the dialog */
|
||||
@@ -167,9 +168,9 @@ export default function SchemaDialogView({
|
||||
return <PublishIcon />;
|
||||
} else if(props.customSaveBtnIconType == 'done') {
|
||||
return <DoneIcon />;
|
||||
} else if(props.customSaveBtnIconType == 'Query Tool') {
|
||||
} else if(props.customSaveBtnIconType == WORKSPACES.QUERY_TOOL) {
|
||||
return <QueryToolIcon />;
|
||||
} else if(props.customSaveBtnIconType == 'PSQL') {
|
||||
} else if(props.customSaveBtnIconType == WORKSPACES.PSQL_TOOL) {
|
||||
return <TerminalRoundedIcon style={{width:'unset'}}/>;
|
||||
}
|
||||
return <SaveIcon />;
|
||||
|
@@ -67,6 +67,9 @@ const StyledPgReactDataGrid = styled(PgReactDataGrid)(({stripedRows, theme})=>({
|
||||
outlineColor: theme.palette.primary.main,
|
||||
backgroundColor: theme.palette.primary.light,
|
||||
color: theme.otherVars.qtDatagridSelectFg,
|
||||
'&.rdg-cell-copied[aria-selected=false][role="gridcell"]': {
|
||||
backgroundColor: theme.palette.primary.light + '!important',
|
||||
}
|
||||
},
|
||||
... stripedRows && {'& .rdg-row.rdg-row-even': {
|
||||
backgroundColor: theme.palette.grey[400],
|
||||
|
Reference in New Issue
Block a user