Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ssh_tunnel): SQLAlchemy Form UI #22513

Merged
merged 151 commits into from
Jan 11, 2023

Conversation

Antonio-RiveroMartnez
Copy link
Member

@Antonio-RiveroMartnez Antonio-RiveroMartnez commented Dec 22, 2022

SUMMARY

Add our a new SSHTunnelForm component that will be used to set tunnels for our Databases, right now only works when using SQLAlchemy URIs.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

  1. Make sure the SSH_TUNNELING feature flag is enabled
  2. open the create database modal
  3. click on SQL Alchemy link so the SQLA form is displayed
  4. Enable the new SSH Tunnel switch
  5. Make use of the form so you can connect a DB with a SSH Tunnel attached to it

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

- Add visual test to confirm the new SSH Tunnel form fields are present if we click the toggle button
- Add extra UI tests for our SSH Tunnel Form
- Add new test to consider changing the login method used in SSH Tunnel Form
The masked values should be unmasked before the ssh tunnel is updated.
"""
if properties.get("password") == PASSWORD_MASK:
properties["password"] = model.password
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should move this logic to the frontend, basically if the field hasn't been updated we shouldn't send it in the payload

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, our API supports PATCH kind of updates, however, the response of the GET already has the masked password thus it's stored in the reducer, so when calling the API to update let's say the server_port, we send the whole ssh_tunnel object, not just updated properties. Because of that, the API would assume you're trying to update the password when you were not. Pretty much like we are doing for other masked values in our forms.

- Hide the entire form behind the feature flag
- Fix TestConnection when editing a DB with SSH Tunnel attached to it
- Add new unmask_password_info util method for SSH Tunnels
- Add ssh_tunnel id in our response for the GET endpoint of DB so we can call test_connection endpoint without depending on DB's name
@@ -73,6 +73,7 @@ export interface FieldPropTypes {
onRemoveTableCatalog: (idx: number) => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also we need to check the available endpoint to see if a given engine allows ssh tunneling
https://github.com/apache/superset/blob/master/superset/db_engine_specs/base.py#L196

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! Ok, yeah, IIRC there a engine_information property we are getting in the UI with the supports_file_upload, so we might need to include this one there and use it. Thanks!

- Use the allow_ssh_tunneling flag from the db_engine along with the feature flag to display the SSH Tunnel form, so, if a DB engine does not support SSH Tunnels, nothing gets displayed. Right now, only Postgres does
- Fix tests with proper flag values
- More fixes to tests
Copy link
Member

@hughhhh hughhhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

- Fix test
@hughhhh hughhhh merged commit 5399365 into apache:master Jan 11, 2023
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XL 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants