-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Adding controls for verifying options #7468
Adding controls for verifying options #7468
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7468 +/- ##
==========================================
+ Coverage 65.17% 65.22% +0.04%
==========================================
Files 433 434 +1
Lines 21428 21459 +31
Branches 2360 2368 +8
==========================================
+ Hits 13966 13996 +30
- Misses 7342 7343 +1
Partials 120 120
Continue to review full report at Codecov.
|
superset/assets/src/explore/components/controls/withVerification.jsx
Outdated
Show resolved
Hide resolved
superset/assets/src/explore/components/controls/withVerification.jsx
Outdated
Show resolved
Hide resolved
superset/assets/src/explore/components/controls/withVerification.jsx
Outdated
Show resolved
Hide resolved
superset/assets/src/explore/components/controls/withVerification.jsx
Outdated
Show resolved
Hide resolved
47463a3
to
e82b52f
Compare
superset/assets/src/explore/components/controls/withVerification.jsx
Outdated
Show resolved
Hide resolved
fa9d278
to
cb132f1
Compare
if (Array.isArray(json)) { | ||
this.setState({ validOptions: new Set(json) || new Set() }); | ||
} | ||
}).catch(error => console.log(error)); |
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 endpoint will be called frequently whenever control values change, so if there's a problem with the validation endpoint we probably don't want to notify users every time (because that could create a large number of error messages). Failing silently would just result in showing all options. But we may want to be able to debug if there are issues, so I thought about putting this console log in. It doesn't seem like the best solution, but it works for now unless someone has another thought.
83482f0
to
ca6e868
Compare
Thanks for the feedback, I'll merge this tomorrow unless anyone has any final comments or concerns. |
* Creating withVerification HOC * Updating to use componentDidMount and componentDidUpdate and adding propTypes * Adding tests to withVerification * Adding documentation to withVerification (cherry picked from commit 421183d)
* Creating withVerification HOC * Updating to use componentDidMount and componentDidUpdate and adding propTypes * Adding tests to withVerification * Adding documentation to withVerification (cherry picked from commit 421183d)
* Creating withVerification HOC * Updating to use componentDidMount and componentDidUpdate and adding propTypes * Adding tests to withVerification * Adding documentation to withVerification (cherry picked from commit 41139ec)
CATEGORY
Choose one
SUMMARY
We have a large table where not all combinations of values are applicable and we need to have a step that calls an endpoint to verify the dimensions and metrics included in the groupby, filter, and metrics controls. This creates a withVerification HOC that verifies options before passing them to the resulting control.
These controls aren't currently being used in the app, but we'll use them through control overrides in our deployment.
TEST PLAN
Use controlOverrides to set this control for certain chart types
Also in controlOverrides:
Check to make sure validation is working
Check to make sure normal options are present (no validation) when there's no getEndpoint
ADDITIONAL INFORMATION
REVIEWERS
@mistercrunch
cc: @graceguo-supercat @john-bodley