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

feat: Dashboard tabs api endpoint #27962

Merged
merged 5 commits into from
Jun 20, 2024
Merged

Conversation

fisjac
Copy link
Contributor

@fisjac fisjac commented Apr 10, 2024

SUMMARY

This PR implements a new property on the Dashboard model granting access to the tabs associated with a dashboard. A new API endpoint for accessing the associated dashboard tabs has been created at /api/v1/dashboard/[id]/tabs.

The payload of the api endpoint contains two properties: all_tabs which contains an array of all associated tabs, and tab_tree which contains a nested object representing the nested structure of tabs within the dashboard. tab_tree follows the data structure necessary for consumption by the Antd Tree and TreeSelect components on the frontend.

The primary use case for this implementation is for enabling the functionalities described in SIP: #26183.

The provided proof of concept provides an alternative approach, centralizing the business logic on the backend to process prior to serving to the client.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

image

TESTING INSTRUCTIONS

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

@github-actions github-actions bot added api Related to the REST API packages labels Apr 10, 2024
@fisjac fisjac marked this pull request as draft April 10, 2024 03:49
@fisjac fisjac changed the title Dashboard tabs endpoint feat: Dashboard tabs api endpoint Apr 10, 2024
@fisjac fisjac force-pushed the dashboard-tabs-endpoint branch 2 times, most recently from 253bdc9 to e3fc409 Compare April 15, 2024 17:05
@fisjac fisjac force-pushed the dashboard-tabs-endpoint branch 2 times, most recently from 253bdc9 to 4b34bd6 Compare May 2, 2024 15:18
@github-actions github-actions bot removed the packages label May 2, 2024
Copy link

codecov bot commented May 14, 2024

Codecov Report

Attention: Patch coverage is 30.00000% with 42 lines in your changes are missing coverage. Please review.

Project coverage is 64.37%. Comparing base (76d897e) to head (aa4be0f).
Report is 109 commits behind head on master.

Files Patch % Lines
superset/models/dashboard.py 9.37% 29 Missing ⚠️
superset/dashboards/api.py 41.17% 10 Missing ⚠️
superset/daos/dashboard.py 50.00% 2 Missing ⚠️
superset/dashboards/schemas.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #27962      +/-   ##
==========================================
+ Coverage   60.48%   64.37%   +3.89%     
==========================================
  Files        1931      521    -1410     
  Lines       76236    37526   -38710     
  Branches     8568        0    -8568     
==========================================
- Hits        46114    24159   -21955     
+ Misses      28017    13367   -14650     
+ Partials     2105        0    -2105     
Flag Coverage Δ
hive 49.06% <30.00%> (-0.10%) ⬇️
javascript ?
presto 53.61% <30.00%> (-0.19%) ⬇️
python 64.37% <30.00%> (+0.89%) ⬆️
unit 58.77% <30.00%> (+1.14%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fisjac fisjac marked this pull request as ready for review May 14, 2024 15:47
@dosubot dosubot bot added the api:dashboard Related to the REST endpoints of the Dashboard label May 14, 2024
@john-bodley john-bodley requested review from villebro, mistercrunch, eschutho and lilykuang and removed request for mistercrunch and villebro May 14, 2024 17:32
@geido geido self-requested a review May 16, 2024 12:15
db.session.delete(dashboard)
db.session.commit()

@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
Copy link
Member

Choose a reason for hiding this comment

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

Should we add other negative paths, such as testing for permissions or invalid schema?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

currently the only tests that explicitly check permissions for the dashboard api are for PUT and DELETE requests. My understanding is that the FlaskAppbuilder @Protect decorator is doing most of the work for ensuring permissions for GET requests. Presumably the @Protect decorator is being tested somewhere else within the codebase?

superset/dashboards/api.py Show resolved Hide resolved
@geido geido requested a review from dpgaspar May 16, 2024 12:25
@geido geido requested a review from betodealmeida June 20, 2024 15:28
@geido geido merged commit a5355d8 into apache:master Jun 20, 2024
35 checks passed
eschutho pushed a commit that referenced this pull request Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:dashboard Related to the REST endpoints of the Dashboard api Related to the REST API size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants