Skip to content

Conversation

@amitmiran137
Copy link
Member

@amitmiran137 amitmiran137 commented Apr 20, 2021

SUMMARY

There is a requirement to show/hide the existing badges in the slice/chart header
This feature is focused on optionally hiding the filter badge indicator and the cross filter indicator by configuring them from dashboard metadata

a follow-up PR might add UI checkboxes to configure them

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

show_badge.mov

TEST PLAN

backward compatibility:
0. DASHBOARD_CROSS_FILTERS

  1. check an existing dashboard that doesn't have keys
    "showFilterBadge"
    "showCrossFilterBadge,
    in the metadata
  2. see that badges does exist
use-case 1
  1. add "showFilterBadge": false to the dashboard metadata

  2. see that filter badges are hidden

    use-case 2
    0 . enable DASHBOARD_CROSS_FILTERS ff

  3. add "showCrossFilterBadge": false to the dashboard metadata

  4. see that cross filter badge is not shown for the echarts pie chart that configuredto emit filter events

use-case 3 :

play with combinations of showFilterBadge and showCrossFilterBadge and see that they act accordingly

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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

@codecov
Copy link

codecov bot commented Apr 20, 2021

Codecov Report

Merging #14249 (3e38975) into master (25922e3) will increase coverage by 0.78%.
The diff coverage is 100.00%.

❗ Current head 3e38975 differs from pull request most recent head 22ca6ca. Consider uploading reports for the commit 22ca6ca to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14249      +/-   ##
==========================================
+ Coverage   76.11%   76.90%   +0.78%     
==========================================
  Files         945      946       +1     
  Lines       47946    47987      +41     
  Branches     5950     5962      +12     
==========================================
+ Hits        36494    36903     +409     
+ Misses      11246    10883     -363     
+ Partials      206      201       -5     
Flag Coverage Δ
hive ?
mysql 80.73% <100.00%> (+0.05%) ⬆️
postgres 80.76% <100.00%> (?)
presto 80.46% <100.00%> (+0.05%) ⬆️
python 81.03% <100.00%> (-0.18%) ⬇️
sqlite 80.36% <100.00%> (+0.05%) ⬆️

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

Impacted Files Coverage Δ
superset-frontend/src/CRUD/Field.jsx 83.33% <ø> (ø)
...rontend/src/SqlLab/components/TabbedSqlEditors.jsx 71.77% <ø> (ø)
...et-frontend/src/SqlLab/components/TableElement.jsx 89.02% <ø> (ø)
...-frontend/src/components/AlteredSliceTag/index.jsx 96.00% <ø> (ø)
...-frontend/src/components/CopyToClipboard/index.jsx 94.28% <ø> (ø)
...src/dashboard/components/PublishedStatus/index.jsx 100.00% <ø> (ø)
.../src/dashboard/components/gridComponents/Chart.jsx 70.10% <ø> (ø)
...perset-frontend/src/dashboard/containers/Chart.jsx 100.00% <ø> (ø)
...erset-frontend/src/datasource/DatasourceEditor.jsx 66.38% <ø> (ø)
...-frontend/src/explore/components/ControlHeader.jsx 85.18% <ø> (ø)
... and 137 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 25922e3...22ca6ca. Read the comment docs.

editMode: dashboardState.editMode,
isExpanded: !!dashboardState.expandedSlices[id],
showFilterBadge: dashboardInfo.metadata?.showFilterBadge ?? true,
showCrossFilterBadge: dashboardInfo.metadata?.showCrossFilterBadge ?? true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's better to do hydrate file default value

Copy link
Member

Choose a reason for hiding this comment

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

Yes, let's pick this up in the hydration phase.

formData,
editMode: dashboardState.editMode,
isExpanded: !!dashboardState.expandedSlices[id],
showFilterBadge: dashboardInfo.metadata?.showFilterBadge ?? true,
Copy link
Contributor

Choose a reason for hiding this comment

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

may be it can good approach to switch it to hideFilterBadge instead and it will be used as undefined as false @villebro thoughts

Copy link
Member

Choose a reason for hiding this comment

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

I think it's usually better to avoid having negatives in option names. Let's just make sure we initialize with defaults and then make sure we do strict equality to avoid problems from undefined values.

import_time = fields.Integer()
remote_id = fields.Integer()
showFilterBadge = fields.Boolean()
showCrossFilterBadge = fields.Boolean()
Copy link
Contributor

Choose a reason for hiding this comment

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

should it be snake case?

Copy link
Member

Choose a reason for hiding this comment

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

Agreed, let's keep this consistent.

@junlincc junlincc added the dashboard:cross-filters Related to the Dashboard cross filters label Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dashboard:cross-filters Related to the Dashboard cross filters size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants