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): Support changing filter bar location #22004

Merged
merged 3 commits into from
Nov 3, 2022

Conversation

kgabryje
Copy link
Member

@kgabryje kgabryje commented Nov 2, 2022

SUMMARY

This PR implements support for changing the native filters bar location.

  1. Clicking on menu items updates Redux state (dashboardInfo.filterBarLocation) and sends a PUT request to api/v1/dashboard/{id} endpoint with updated json_metadata.
  2. Initial Redux state of dashboardInfo.filterBarLocation is populated in dashboard's hydrate function
  3. Clicking on menu item applies checkmark next to selected item immediately, without waiting for backend response (for better user experience). If backend returns an error, the selection is reverted. The actual position of the filter bar depends on backend response.
  4. If there's an error, a toast message appears

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen.Recording.2022-11-02.at.18.29.50.mov

TESTING INSTRUCTIONS

  1. Enable HORIZONTAL_FILTER_BAR ff
  2. Go to dashboard and click on a gear icon in native filters bar
  3. Verify that clicking on menu items dispatches Redux actions and API requests with the new filter_bar_location in the body
  4. Verify that if an error occurs (by for example disconnecting your internet), then a toast message appears, selection in gear icon menu is reverted and no Redux action related to filter bar is dispatched

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

@kgabryje kgabryje requested a review from geido November 2, 2022 10:15
@codecov
Copy link

codecov bot commented Nov 2, 2022

Codecov Report

Merging #22004 (3eaa53c) into master (5c27aaf) will increase coverage by 0.03%.
The diff coverage is 78.04%.

@@            Coverage Diff             @@
##           master   #22004      +/-   ##
==========================================
+ Coverage   67.00%   67.03%   +0.03%     
==========================================
  Files        1809     1814       +5     
  Lines       69295    69475     +180     
  Branches     7410     7456      +46     
==========================================
+ Hits        46430    46576     +146     
- Misses      20955    20973      +18     
- Partials     1910     1926      +16     
Flag Coverage Δ
hive 52.87% <100.00%> (-0.06%) ⬇️
javascript 53.52% <77.50%> (+0.10%) ⬆️
mysql 78.38% <100.00%> (-0.01%) ⬇️
postgres 78.44% <100.00%> (-0.01%) ⬇️
presto 52.77% <100.00%> (-0.06%) ⬇️
python 81.54% <100.00%> (-0.02%) ⬇️
sqlite 76.90% <100.00%> (-0.03%) ⬇️
unit 51.18% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...t-frontend/src/dashboard/actions/dashboardState.js 37.09% <ø> (ø)
superset-frontend/src/dashboard/actions/hydrate.js 1.78% <ø> (ø)
...set-frontend/src/dashboard/util/permissionUtils.ts 90.00% <ø> (ø)
...omponents/nativeFilters/FilterBar/Header/index.tsx 95.45% <50.00%> (+4.15%) ⬆️
...et-frontend/src/dashboard/actions/dashboardInfo.ts 59.18% <69.56%> (+9.18%) ⬆️
...ilters/FilterBar/FilterBarLocationSelect/index.tsx 92.85% <92.85%> (ø)
...t-frontend/src/dashboard/reducers/dashboardInfo.js 80.00% <100.00%> (+5.00%) ⬆️
superset/dashboards/schemas.py 99.46% <100.00%> (+<0.01%) ⬆️
...t-ui-chart-controls/src/shared-controls/mixins.tsx 16.66% <0.00%> (-16.67%) ⬇️
...perset-ui-chart-controls/src/sections/sections.tsx 71.42% <0.00%> (-16.08%) ⬇️
... and 42 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kgabryje kgabryje force-pushed the feat/change-bar-location branch from 6ec5a34 to 3eaa53c Compare November 2, 2022 15:05
@kgabryje kgabryje changed the title [WIP] feat(dashboard): Support changing filter bar location feat(dashboard): Support changing filter bar location Nov 2, 2022
@rusackas
Copy link
Member

rusackas commented Nov 2, 2022

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2022

@rusackas Ephemeral environment spinning up at http://35.164.249.47:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

Copy link
Member

@codyml codyml left a comment

Choose a reason for hiding this comment

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

This all looks good to me! Reviewed code & tested the following locally:

  • Setting & resetting position on dashboards with and without position previously saved
  • Toggling as admin, non-admin owner, and non-admin non-owner
  • Toggling with network error

Thanks!

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

LGTM!

@geido geido merged commit 68e8b00 into apache:master Nov 3, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2022

Ephemeral environment shutdown and build artifacts deleted.

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 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 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants