You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2021/06/19 22:37:11 UTC
[superset] 01/01: wrap configuration method
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch pexdax/wrap-configuration
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 572ba049406b6c52c7a7470708d4369ef319ad80
Author: hughhhh <hu...@gmail.com>
AuthorDate: Sat Jun 19 18:35:20 2021 -0400
wrap configuration method
---
.../CRUD/data/database/DatabaseModal/index.tsx | 41 +++++++++++-----------
1 file changed, 20 insertions(+), 21 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 210b054..5ef0609 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -356,28 +356,27 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
const onSave = async () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { id, ...update } = db || {};
- if (update?.parameters?.query) {
- // convert query params into dictionary
- update.parameters.query = JSON.parse(
- `{"${decodeURI((update?.parameters?.query as string) || '')
- .replace(/"/g, '\\"')
- .replace(/&/g, '","')
- .replace(/=/g, '":"')}"}`,
- );
- } else if (update?.parameters?.query === '') {
- update.parameters.query = {};
- }
- const engine = update.backend || update.engine;
- if (
- engine === 'bigquery' &&
- update.configuration_method === CONFIGURATION_METHOD.DYNAMIC_FORM &&
- update.parameters?.credentials_info
- ) {
- // wrap encrypted_extra in credentials_info only for BigQuery
- update.encrypted_extra = JSON.stringify({
- credentials_info: JSON.parse(update.parameters?.credentials_info),
- });
+ if (update.configuration_method === CONFIGURATION_METHOD.DYNAMIC_FORM) {
+ if (update?.parameters?.query) {
+ // convert query params into dictionary
+ update.parameters.query = JSON.parse(
+ `{"${decodeURI((update?.parameters?.query as string) || '')
+ .replace(/"/g, '\\"')
+ .replace(/&/g, '","')
+ .replace(/=/g, '":"')}"}`,
+ );
+ } else if (update?.parameters?.query === '') {
+ update.parameters.query = {};
+ }
+
+ const engine = update.backend || update.engine;
+ if (engine === 'bigquery' && update.parameters?.credentials_info) {
+ // wrap encrypted_extra in credentials_info only for BigQuery
+ update.encrypted_extra = JSON.stringify({
+ credentials_info: JSON.parse(update.parameters?.credentials_info),
+ });
+ }
}
if (db?.id) {