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

refactor: simplify getExploreUrl functions #9831

Merged
merged 5 commits into from May 18, 2020

Conversation

villebro
Copy link
Member

SUMMARY

The getExploreUrlAndPayload function is currently unnecessarily complex and returns an unmutated copy of one of its inputs (formData). Also, the getURIDirectory signature included formData which was never used. This PR simplifies the function signatures with the ultimate aim of breaking up the functions into smaller more specific functions.

TEST PLAN

Local testing + CI

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

Comment on lines -126 to -139
expect(payload).toEqual(formData);
});
it('generate proper saveas slice url', () => {
const { url, payload } = getExploreUrlAndPayload({
formData,
endpointType: 'json',
force: false,
curUrl: 'superset.com?foo=bar',
});
compareURI(
URI(url),
URI('/superset/explore_json/').search({ foo: 'bar' }),
);
expect(payload).toEqual(formData);
Copy link
Member Author

Choose a reason for hiding this comment

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

This was an identical copy of the test case above.

@codecov-io
Copy link

codecov-io commented May 18, 2020

Codecov Report

Merging #9831 into master will decrease coverage by 0.23%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9831      +/-   ##
==========================================
- Coverage   71.02%   70.79%   -0.24%     
==========================================
  Files         586      184     -402     
  Lines       30635    17868   -12767     
  Branches     3151        0    -3151     
==========================================
- Hits        21759    12649    -9110     
+ Misses       8765     5219    -3546     
+ Partials      111        0     -111     
Flag Coverage Δ
#cypress ?
#javascript ?
#python 70.79% <ø> (-0.48%) ⬇️
Impacted Files Coverage Δ
superset/views/database/mixins.py 58.92% <0.00%> (-21.43%) ⬇️
superset/utils/cache.py 45.83% <0.00%> (-20.84%) ⬇️
superset/db_engine_specs/mysql.py 78.26% <0.00%> (-13.05%) ⬇️
superset/views/tags.py 35.13% <0.00%> (-4.11%) ⬇️
superset/models/sql_types/presto_sql_types.py 72.41% <0.00%> (-4.06%) ⬇️
superset/models/tags.py 58.58% <0.00%> (-3.80%) ⬇️
superset/views/database/api.py 83.90% <0.00%> (-3.45%) ⬇️
superset/views/sql_lab.py 59.06% <0.00%> (-3.29%) ⬇️
superset/cli.py 36.59% <0.00%> (-3.14%) ⬇️
superset/db_engine_specs/postgres.py 97.29% <0.00%> (-2.71%) ⬇️
... and 428 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 b8eaa11...4e02f4e. Read the comment docs.

@villebro villebro changed the title [WIP] chore: simplify getExploreUrl functions [WIP] refactor: simplify getExploreUrl functions May 18, 2020
@villebro villebro force-pushed the villebro/refactor-get-explore-uri branch from eeafad4 to a53d7ec Compare May 18, 2020 13:52
@villebro villebro force-pushed the villebro/refactor-get-explore-uri branch from a53d7ec to 4e02f4e Compare May 18, 2020 13:57
@villebro villebro changed the title [WIP] refactor: simplify getExploreUrl functions refactor: simplify getExploreUrl functions May 18, 2020
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!

@villebro villebro merged commit 7a95c52 into apache:master May 18, 2020
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
* remove payload from return signature

* Rename function and fix tests

* Lint

* fix tests

* Move useLegacyApi inquiry to exploreUtils
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.37.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 size/L 🚢 0.37.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants