This is an automated email from the ASF dual-hosted git repository.

johnbodley pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 51fec1a  fix: Ensure consistent naming for testconn (#11246)
51fec1a is described below

commit 51fec1ab163de138005362a73557ea0df725de82
Author: John Bodley <[email protected]>
AuthorDate: Tue Oct 13 09:53:03 2020 -0700

    fix: Ensure consistent naming for testconn (#11246)
    
    Co-authored-by: John Bodley <[email protected]>
---
 superset/templates/superset/models/database/macros.html | 4 ++--
 superset/views/core.py                                  | 7 +++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/superset/templates/superset/models/database/macros.html 
b/superset/templates/superset/models/database/macros.html
index f6a054e..ae67e4b 100644
--- a/superset/templates/superset/models/database/macros.html
+++ b/superset/templates/superset/models/database/macros.html
@@ -41,12 +41,12 @@
           uri: $.trim($("#sqlalchemy_uri").val()),
           name: $('#database_name').val(),
           impersonate_user: $('#impersonate_user').is(':checked'),
-          extras: extra ? JSON.parse(extra) : {},
+          extra: extra ? JSON.parse(extra) : {},
           encrypted_extra: encryptedExtra ? JSON.parse(encryptedExtra) : {},
           server_cert: $("#server_cert").val(),
         })
       } catch(parse_error){
-        alert("Malformed JSON in the extras field: " + parse_error);
+        alert("Malformed JSON in the extra fields: " + parse_error);
         return false
       }
 
diff --git a/superset/views/core.py b/superset/views/core.py
index c6847b7..9f16f85 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1135,12 +1135,11 @@ class Superset(BaseSupersetView):  # pylint: 
disable=too-many-public-methods
                 if existing_database and uri == 
existing_database.safe_sqlalchemy_uri():
                     uri = existing_database.sqlalchemy_uri_decrypted
 
-            # this is the database instance that will be tested
+            # This is the database instance that will be tested. Note the 
extra fields
+            # are represented as JSON encoded strings in the model.
             database = models.Database(
-                # extras is sent as json, but required to be a string in the 
Database
-                # model
                 server_cert=request.json.get("server_cert"),
-                extra=json.dumps(request.json.get("extras", {})),
+                extra=json.dumps(request.json.get("extra", {})),
                 impersonate_user=request.json.get("impersonate_user"),
                 encrypted_extra=json.dumps(request.json.get("encrypted_extra", 
{})),
             )

Reply via email to