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

fix(database-modal): Show a different placeholder text in Snowflake connection form #21172

Merged
merged 2 commits into from
Aug 24, 2022

Conversation

agl-developer
Copy link
Contributor

When adding a new database and selecting Snowflake, the database and account fields had the same placeholder. This PR adds a placeholder prop so values can be sent dynamically by field

SUMMARY

Adds an option to set a dynamic placeholder based on field.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before
Clipboard 2022-12-05 at 4 33 08 PM

After
Screenshot 2022-08-23 162042

TESTING INSTRUCTIONS

  • Click "Data" in the top nav and select "Databases"
  • Click the "+ Database" in the top right corner of the page
  • Select Snowflake database

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

When adding a new database and selecting Snowflake, the database and account fields had the same placeholder. This PR adds a placeholder prop so values can be sent dynamically by field
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️
We hope to see you in our Slack community too!

Copy link
Member

@codyml codyml left a comment

Choose a reason for hiding this comment

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

Left two non-blocking comments, otherwise looks good!

@@ -1607,6 +1615,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
}
getValidation={() => getValidation(db)}
validationErrors={validationErrors}
getPlaceholder={field => getPlaceholder(field)}
Copy link
Member

Choose a reason for hiding this comment

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

Could this be done without defining a new inline function each render?

Suggested change
getPlaceholder={field => getPlaceholder(field)}
getPlaceholder={getPlaceholder}

@@ -85,10 +86,10 @@ export const databaseField = ({
value={db?.parameters?.database}
validationMethods={{ onBlur: getValidation }}
errorMessage={validationErrors?.database}
placeholder={t('e.g. world_population')}
placeholder={t(placeholder ?? 'e.g. world_population')}
Copy link
Member

Choose a reason for hiding this comment

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

I don't have a great sense of how translation strings work, but I wonder if this might break the build step of extracting translatable strings to have the argument of t() be dynamically set at render time. If you or someone else knows for sure definitely correct me, but would it be safer to have this just be placeholder ?? t('e.g. world_population') and instead call t() for placeholder where the string literal is defined in superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx?

@codecov
Copy link

codecov bot commented Aug 24, 2022

Codecov Report

Merging #21172 (28130b9) into master (6a0b7e5) will decrease coverage by 0.00%.
The diff coverage is 25.00%.

@@            Coverage Diff             @@
##           master   #21172      +/-   ##
==========================================
- Coverage   66.37%   66.36%   -0.01%     
==========================================
  Files        1781     1781              
  Lines       67871    67890      +19     
  Branches     7239     7248       +9     
==========================================
+ Hits        45047    45057      +10     
- Misses      20966    20971       +5     
- Partials     1858     1862       +4     
Flag Coverage Δ
javascript 52.30% <25.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...eModal/DatabaseConnectionForm/CommonParameters.tsx 85.71% <0.00%> (-4.29%) ⬇️
...ase/DatabaseModal/DatabaseConnectionForm/index.tsx 90.90% <0.00%> (-9.10%) ⬇️
...c/views/CRUD/data/database/DatabaseModal/index.tsx 32.20% <33.33%> (+0.67%) ⬆️
superset-frontend/src/hooks/useTabId.ts 0.00% <0.00%> (ø)
...et-frontend/src/components/TableSelector/index.tsx 78.26% <0.00%> (ø)
...onents/ErrorMessage/ErrorMessageWithStackTrace.tsx 60.00% <0.00%> (ø)
superset-frontend/src/SqlLab/actions/sqlLab.js 61.37% <0.00%> (+0.26%) ⬆️
...rontend/src/components/ErrorMessage/ErrorAlert.tsx 90.24% <0.00%> (+0.77%) ⬆️
...d/src/SqlLab/components/SqlEditorLeftBar/index.tsx 50.00% <0.00%> (+1.51%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the PR!

@github-actions
Copy link
Contributor

Storybook has completed and can be viewed at

@rusackas rusackas merged commit da3401a into apache:master Aug 24, 2022
sadpandajoe added a commit to preset-io/superset that referenced this pull request Aug 31, 2022
@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/M 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants