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

Adding controls for verifying options #7468

Merged

Conversation

michellethomas
Copy link
Contributor

@michellethomas michellethomas commented May 7, 2019

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

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:

  • Pass it a getEndpoint function that builds an endpoint from the controlValues
  • Set controlValues in a customized mapStateToProps

Check to make sure validation is working
Check to make sure normal options are present (no validation) when there's no getEndpoint

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

REVIEWERS

@mistercrunch
cc: @graceguo-supercat @john-bodley

@codecov-io
Copy link

codecov-io commented May 7, 2019

Codecov Report

Merging #7468 into master will increase coverage by 0.04%.
The diff coverage is 96.77%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
...et/assets/src/explore/components/controls/index.js 100% <ø> (ø) ⬆️
...c/explore/components/controls/withVerification.jsx 96.77% <96.77%> (ø)

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 efb085a...ca6e868. Read the comment docs.

@michellethomas michellethomas force-pushed the testing_filtering_for_controls branch from 47463a3 to e82b52f Compare May 14, 2019 18:49
@michellethomas michellethomas force-pushed the testing_filtering_for_controls branch from fa9d278 to cb132f1 Compare May 15, 2019 19:37
@michellethomas michellethomas changed the title [WIP] Adding controls for verifying options Adding controls for verifying options May 15, 2019
@pull-request-size pull-request-size bot added size/L and removed size/M labels May 15, 2019
if (Array.isArray(json)) {
this.setState({ validOptions: new Set(json) || new Set() });
}
}).catch(error => console.log(error));
Copy link
Contributor Author

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.

@michellethomas michellethomas force-pushed the testing_filtering_for_controls branch from 83482f0 to ca6e868 Compare May 21, 2019 23:58
@michellethomas
Copy link
Contributor Author

Thanks for the feedback, I'll merge this tomorrow unless anyone has any final comments or concerns.

@michellethomas michellethomas merged commit 421183d into apache:master May 22, 2019
michellethomas added a commit to michellethomas/panoramix that referenced this pull request May 31, 2019
* 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)
michellethomas added a commit that referenced this pull request Jun 1, 2019
* 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)
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 28, 2024
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
* 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)
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/L 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants