diff --git a/web/pgadmin/misc/workspaces/__init__.py b/web/pgadmin/misc/workspaces/__init__.py
index 6b695cc9615..c1238853782 100644
--- a/web/pgadmin/misc/workspaces/__init__.py
+++ b/web/pgadmin/misc/workspaces/__init__.py
@@ -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')
diff --git a/web/pgadmin/misc/workspaces/static/js/AdHocConnection.jsx b/web/pgadmin/misc/workspaces/static/js/AdHocConnection.jsx
index 12dd56955da..b37e70fa06c 100644
--- a/web/pgadmin/misc/workspaces/static/js/AdHocConnection.jsx
+++ b/web/pgadmin/misc/workspaces/static/js/AdHocConnection.jsx
@@ -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,24 +306,31 @@ class AdHocConnectionSchema extends BaseUISchema {
setError('host', null);
}
}
+ if(isEmptyString(state.port)) {
+ errmsg = gettext('Port must be specified.');
+ setError('port', errmsg);
+ return true;
+ } else {
+ setError('port', null);
+ }
- if(isEmptyString(state.username)) {
- errmsg = gettext('Username must be specified.');
- setError('username', errmsg);
+ if(isEmptyString(state.did)) {
+ errmsg = gettext('Database must be specified.');
+ setError('did', errmsg);
return true;
} else {
- setError('username', null);
+ setError('did', null);
}
- if(isEmptyString(state.port)) {
- errmsg = gettext('Port must be specified.');
- setError('port', errmsg);
+ if(isEmptyString(state.user)) {
+ errmsg = gettext('User must be specified.');
+ setError('user', errmsg);
return true;
} else {
- setError('port', null);
+ setError('user', null);
}
} else {
- _.each(['host', 'db', 'username', 'port'], (item) => {
+ _.each(['host', 'port', 'did', 'user'], (item) => {
setError(item, null);
});
}
diff --git a/web/pgadmin/static/js/SchemaView/SchemaDialogView.jsx b/web/pgadmin/static/js/SchemaView/SchemaDialogView.jsx
index b6945c9943b..f24d5252bbf 100644
--- a/web/pgadmin/static/js/SchemaView/SchemaDialogView.jsx
+++ b/web/pgadmin/static/js/SchemaView/SchemaDialogView.jsx
@@ -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 ;
} else if(props.customSaveBtnIconType == 'done') {
return ;
- } else if(props.customSaveBtnIconType == 'Query Tool') {
+ } else if(props.customSaveBtnIconType == WORKSPACES.QUERY_TOOL) {
return ;
- } else if(props.customSaveBtnIconType == 'PSQL') {
+ } else if(props.customSaveBtnIconType == WORKSPACES.PSQL_TOOL) {
return ;
}
return ;
diff --git a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/index.jsx b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/index.jsx
index 924a2bea02f..d6de3d52fa7 100644
--- a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/index.jsx
+++ b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolDataGrid/index.jsx
@@ -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],