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: save database with new dynamic form #14583

Merged
merged 4 commits into from
May 21, 2021

Conversation

eschutho
Copy link
Member

@eschutho eschutho commented May 12, 2021

SUMMARY

This PR loads the form dynamically and saves the database with the new form. The dynamic form is hidden behind a local flag, so it does not currently show up in the UI.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

existing visualization is mostly the same with a few small tweaks
Screenshot_5_11_21__6_41_PM
The tabs now reach across the fill width of the modal

Screenshot_5_11_21__6_41_PM

Display name used to say "Name your dataset" as the placeholder. It's changed to "Name your database"

with button enabled (same as before)
_DEV__Superset

Screen.Recording.2021-05-12.at.5.04.51.PM.mov

Go from dynamic form to SQLAlchemy form

Screen.Recording.2021-05-20.at.5.55.30.PM.mov

Tab animation

To test this locally with the dynamic form change this value:

setDB({
        type: ActionType.dbSelected,
        payload: {
          parameters: { engine: 'postgresql' },
          configuration_method: CONFIGURATION_METHOD.SQLALCHEMY_URI,
        },

to CONFIGURATION_METHOD.DYNAMIC_FORM

NEW FORM (hidden behind the hard-coded value above)
_DEV__Superset
On creation/form load

Screenshot_5_11_21__6_53_PM

Required fields are filled out and button is enabled

_DEV__Superset

After "connect"

TEST PLAN

new unit tests.. because some values are still hard coded, we can't test the new flow too much yet.

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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

@eschutho
Copy link
Member Author

This PR includes #14456

@codecov
Copy link

codecov bot commented May 12, 2021

Codecov Report

Merging #14583 (ae9bb8f) into master (9729ffd) will decrease coverage by 0.03%.
The diff coverage is 67.08%.

❗ Current head ae9bb8f differs from pull request most recent head 6eae68c. Consider uploading reports for the commit 6eae68c to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14583      +/-   ##
==========================================
- Coverage   77.45%   77.42%   -0.04%     
==========================================
  Files         959      960       +1     
  Lines       48719    48791      +72     
  Branches     6115     6122       +7     
==========================================
+ Hits        37736    37777      +41     
- Misses      10777    10811      +34     
+ Partials      206      203       -3     
Flag Coverage Δ
hive 81.10% <100.00%> (+<0.01%) ⬆️
mysql 81.38% <100.00%> (+<0.01%) ⬆️
postgres 81.40% <100.00%> (+<0.01%) ⬆️
python 81.78% <100.00%> (+<0.01%) ⬆️
sqlite 81.02% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset-frontend/src/SqlLab/App.jsx 0.00% <0.00%> (ø)
...uperset-frontend/src/components/Form/FormLabel.tsx 64.70% <0.00%> (-4.05%) ⬇️
...components/DashboardBuilder/DashboardContainer.tsx 100.00% <ø> (ø)
...ashboard/components/gridComponents/ChartHolder.jsx 77.77% <ø> (+0.94%) ⬆️
...nents/nativeFilters/FilterBar/FilterSets/index.tsx 77.00% <ø> (ø)
superset-frontend/src/dashboard/reducers/types.ts 0.00% <ø> (ø)
...filters/components/GroupBy/GroupByFilterPlugin.tsx 0.00% <0.00%> (ø)
...d/src/filters/components/GroupBy/transformProps.ts 22.22% <0.00%> (-11.12%) ⬇️
...t-frontend/src/filters/components/GroupBy/types.ts 100.00% <ø> (ø)
...src/filters/components/Range/RangeFilterPlugin.tsx 0.00% <0.00%> (ø)
... and 38 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9729ffd...6eae68c. Read the comment docs.

@eschutho eschutho force-pushed the elizabeth/save-db-form branch 2 times, most recently from 9e31ec2 to 18af9ca Compare May 13, 2021 00:27
@eschutho eschutho mentioned this pull request May 13, 2021
8 tasks
antDTabsStyles,
antDModalStyles(theme),
antDModalNoPaddingStyles,
formHelperStyles(theme),
Copy link
Member Author

Choose a reason for hiding this comment

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

in a future version, I'd like to pass a prop to the modal for theming, or use something like Modal.noPadding to make the changes more global. Inspired by @rusackas.

@eschutho eschutho force-pushed the elizabeth/save-db-form branch 2 times, most recently from 040821f to 429a793 Compare May 19, 2021 01:24
// the values should align with the database
// model enum in superset/superset/models/core.py
export enum CONFIGURATION_METHOD {
SQLALCHEMY_URI = 'sqlalchemy_form',
Copy link
Member

@AAfghahi AAfghahi May 21, 2021

Choose a reason for hiding this comment

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

nit
This was changed to SQLALCHEMY_FORM in the backend:
https://github.com/preset-io/superset/blob/master/superset/models/core.py#L103

Copy link
Member Author

Choose a reason for hiding this comment

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

it shouldn't matter what the key is on the front end, but yeah, maybe for consistency I'll change it in a future iteration. Thanks for pointing that out!

Copy link
Member

Choose a reason for hiding this comment

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

yup! I meant for just consistency.

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 also figure out a way to centralize this enum across the backend and frontend

};

const FORM_FIELD_MAP = {
host: {
Copy link
Member

Choose a reason for hiding this comment

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

nit: go with component based mapping like @betodealmeida was mentioning in our meeting this can be a later iteration but definitely think we implement this pattern
https://app.clubhouse.io/preset/story/15898/make-databaseconnectionform-tsx-have-component-based-mapping

@hughhhh hughhhh self-requested a review May 21, 2021 21:38
@hughhhh hughhhh merged commit c7aee4e into apache:master May 21, 2021
@eschutho eschutho deleted the elizabeth/save-db-form branch May 24, 2021 17:28
amitmiran137 pushed a commit to nielsen-oss/superset that referenced this pull request May 25, 2021
* master: (163 commits)
  fix(native-filters): Manage default value of filters by superset (apache#14785)
  fix: Additional ResultSet tests (apache#14741)
  chore: added BasicParametersMixin to Redshift (apache#14752)
  fix: make dataset list sort case insensitive (apache#14528)
  fix: use encodeURIComponent when getting table metadata (apache#14790)
  fix: ensure engine is outside parameters (apache#14787)
  database modal should close on connect with tab layout (apache#14771)
  feat(native-filters): add search all filter options (apache#14710)
  fix: extra query in Dashboard when native filter enabled (apache#14770)
  chore: Improves the native filters UI/UX - iteration 2 (apache#14753)
  fix(native filters): Fix explore state (apache#14779)
  fix(explore): DndColumnSelect not handling controls with "multi: false" (apache#14737)
  feat: Create BigQuery Parameters for DatabaseModal (apache#14721)
  feat: enable user impersonation in GSheets (apache#14767)
  fix: add DB should not say it's Postgres (apache#14766)
  Revert "fix(dashboard): multiple query trigger when native filter enabled (apache#14734)" (apache#14762)
  feat: save database with new dynamic form (apache#14583)
  fix: save non-parameter DBs (apache#14759)
  chore: Removes ColorSchemeControl.less (apache#14199)
  fix(explore): Icons width (apache#14717)
  ...
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
* split db modal file

* split db modal file

* hook up available databases

* add comment
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
* split db modal file

* split db modal file

* hook up available databases

* add comment
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
* split db modal file

* split db modal file

* hook up available databases

* add comment
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 12, 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 preset-io size/XL 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants