You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/08/16 05:48:59 UTC
[superset] 09/34: fix: turn on SSL in database edit form show 500
error (#16151)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch 1.3
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 3bf5852d6722a2bd7d22482d98d0ec703cd54c52
Author: Hugh A. Miles II <hu...@gmail.com>
AuthorDate: Tue Aug 10 13:31:28 2021 -0400
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
(cherry picked from commit 3f86a54ac17a62cbb8fba1b8e08abfcb2ab4f501)
---
.../views/CRUD/data/database/DatabaseModal/index.tsx | 20 ++++++++------------
superset-frontend/tsconfig.json | 2 +-
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
index 2e0ca30..7453a6a 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -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
diff --git a/superset-frontend/tsconfig.json b/superset-frontend/tsconfig.json
index cc79cf3..ed0ce53 100644
--- a/superset-frontend/tsconfig.json
+++ b/superset-frontend/tsconfig.json
@@ -7,7 +7,7 @@
"forceConsistentCasingInFileNames": true,
"importHelpers": false,
"jsx": "preserve",
- "lib": ["dom", "esnext"],
+ "lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"noImplicitAny": true,