mirror of
https://github.com/apache/superset.git
synced 2026-04-20 16:44:46 +00:00
fix: turn on SSL in database edit form show 500 error (#16151)
* fix error for query.update * converrt before making request * fix query params * remove unchanged files * this * update tsconfig
This commit is contained in:
@@ -539,20 +539,10 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
||||
const dbToUpdate = JSON.parse(JSON.stringify(update));
|
||||
|
||||
if (dbToUpdate.configuration_method === CONFIGURATION_METHOD.DYNAMIC_FORM) {
|
||||
// Validate DB before saving
|
||||
await getValidation(dbToUpdate, true);
|
||||
if (validationErrors && !isEmpty(validationErrors)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dbToUpdate?.parameters?.query) {
|
||||
// convert query params into dictionary
|
||||
dbToUpdate.parameters.query = JSON.parse(
|
||||
`{"${decodeURI((dbToUpdate?.parameters?.query as string) || '')
|
||||
.replace(/"/g, '\\"')
|
||||
.replace(/&/g, '","')
|
||||
.replace(/=/g, '":"')}"}`,
|
||||
);
|
||||
const urlParams = new URLSearchParams(dbToUpdate?.parameters?.query);
|
||||
dbToUpdate.parameters.query = Object.fromEntries(urlParams);
|
||||
} else if (
|
||||
dbToUpdate?.parameters?.query === '' &&
|
||||
'query' in dbModel.parameters.properties
|
||||
@@ -560,6 +550,12 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
||||
dbToUpdate.parameters.query = {};
|
||||
}
|
||||
|
||||
// Validate DB before saving
|
||||
await getValidation(dbToUpdate, true);
|
||||
if (validationErrors && !isEmpty(validationErrors)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const engine = dbToUpdate.backend || dbToUpdate.engine;
|
||||
if (engine === 'bigquery' && dbToUpdate.parameters?.credentials_info) {
|
||||
// wrap encrypted_extra in credentials_info only for BigQuery
|
||||
|
||||
Reference in New Issue
Block a user