-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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): make to display validation error msg when all cases #20095
fix(database): make to display validation error msg when all cases #20095
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20095 +/- ##
=======================================
Coverage 66.35% 66.35%
=======================================
Files 1767 1767
Lines 67356 67360 +4
Branches 7147 7149 +2
=======================================
+ Hits 44694 44698 +4
Misses 20834 20834
Partials 1828 1828
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! Left a comment.
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
Outdated
Show resolved
Hide resolved
@@ -1088,7 +1088,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({ | |||
let alertErrors: string[] = []; | |||
if (isEmpty(dbErrors) === false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also modify this condition to keep the code readable to be consistent? Thanks!
/testenv up |
@yousoph Ephemeral environment spinning up at http://54.214.197.133:8080. Credentials are |
/testenv up |
@rusackas Ephemeral environment spinning up at http://54.149.117.75:8080. Credentials are |
@@ -1086,22 +1090,24 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({ | |||
// eslint-disable-next-line consistent-return | |||
const errorAlert = () => { | |||
let alertErrors: string[] = []; | |||
if (isEmpty(dbErrors) === false) { | |||
if (isEmpty(dbErrors)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (isEmpty(dbErrors)) { | |
if (!isEmpty(dbErrors)) { |
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
Outdated
Show resolved
Hide resolved
@prosdev0107
|
@yousoph |
/testenv up |
@yousoph Ephemeral environment spinning up at http://34.219.229.127:8080. Credentials are |
Thanks for the changes! Looking good to me |
@@ -1086,22 +1092,24 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({ | |||
// eslint-disable-next-line consistent-return | |||
const errorAlert = () => { | |||
let alertErrors: string[] = []; | |||
if (isEmpty(dbErrors) === false) { | |||
if (!isEmpty(dbErrors)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, this was if (isEmpty(dbErrors) === false)
This new line of if (!isEmpty(dbErrors))
is logically the same, which is great...
However, now I'm a little worried. Our QA round didn't catch anything wrong when this logic was indeed wrong. So... what does this exactly DO, and how do we test it to make sure it's working as expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests to cover this area of code and prove it works would be ideal. Spinning up an ephemeral for manual testing now that CI has passed. Please let us know what manual testing steps would help here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rusackas
I tried to add the unit test for this case but couldn't do it because of that getValidation function is a call in a hooks and so it is invalid hook call in jest file. And so I add manual testing steps into the Test instructions
/testenv up |
@rusackas Ephemeral environment spinning up at http://35.85.218.215:8080. Credentials are |
Hi @prosdev0107. Thanks for the PR. I have two suggestions: Can we treat invalid usernames and passwords with a generic message? Right now the message confirms that my username is valid and only my password is invalid which raises security concerns. Maybe something like "Invalid credentials" for both the username and password? The second suggestion is to automatically scroll to the bottom when there's an error because it's not very clear right now. |
@michael-s-molina I believe the message is actually generic right now - even if your username is wrong, it gives you the same message saying that the password provided doesn't work for the username entered |
I'm not sure if this is another error but when I try with an unknown user I get another message: |
Oops, you're right! It does look like it's a diff error when the username is wrong |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error message is from the database driver, considering security risks(you couldn't know what message will output from drivers), I suggest doing some exception catch in Superset.
others, LGTM
@yousoph is this OK to merge if the errors displayed are at the whim of the database? We can catch/throw an exception as Yongjie suggests - but maybe we can do that in a separate PR? ¯\_(ツ)_/¯ Otherwise, @prosdev0107 I think this just needs a rebase or conflict resolution |
Conflicts resolved... let's merge if/when CI passes |
Ephemeral environment shutdown and build artifacts deleted. |
…cases (apache#20095)" This reverts commit d568999.
…cases (apache#20095)" This reverts commit d568999.
… error msg when all … (apache#21277) (cherry picked from commit 4b22137)
…pache#20095) * fix(database): make to display validation error msg when all cases * fix(db): make to update the alert error condition * fix(db): make to add error detail display * fix(db): make to update error alert display by superset error style guide. * fix(db): make to style modal header title with h4 * fix(db): make to place see more on bottom instead of top * fix(db): make to fix shortly * fix(db): make to fix lint issue Co-authored-by: Evan Rusackas <[email protected]>
SUMMARY
The dynamic form to connect to PostgreSQL is not returning connection errors to the user.
No errors display when the error_type is
GENERIC_DB_ENGINE_ERROR
and so error alerts are displayed at this case.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE:
<removed by @eschutho>
AFTER:
db-error-display.mov
TESTING INSTRUCTIONS
How to reproduce the bug
Please follow the steps with this sample data.
ADDITIONAL INFORMATION