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(dashboards): Filter status indicators #10936

Merged
merged 94 commits into from
Oct 28, 2020
Merged

feat(dashboards): Filter status indicators #10936

merged 94 commits into from
Oct 28, 2020

Conversation

suddjian
Copy link
Member

@suddjian suddjian commented Sep 17, 2020

SUMMARY

This adds a new filter indicator which is intended to take the place of the "teeth" style indicators. This indicator is lower profile, and less confusing. If a filter is ineligible for a given chart, that is now displayed on the indicator.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen-Recording-2020-10-05-at-5
On the left, a chart with 2 filters applied. On the right, a chart with a filter that could not be applied.

TEST PLAN

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

@graceguo-supercat
Copy link

Having both dropdown and teeth indicator at the same time? is it a little confusing and duplicated?

@junlincc
Copy link
Member

yes, the teeth will be gone~

@github-actions

This comment has been minimized.

@codecov-commenter
Copy link

codecov-commenter commented Sep 22, 2020

Codecov Report

Merging #10936 into master will decrease coverage by 5.30%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10936      +/-   ##
==========================================
- Coverage   66.05%   60.75%   -5.31%     
==========================================
  Files         816      383     -433     
  Lines       38589    24195   -14394     
  Branches     3650        0    -3650     
==========================================
- Hits        25491    14700   -10791     
+ Misses      12996     9495    -3501     
+ Partials      102        0     -102     
Flag Coverage Δ
#cypress ?
#javascript ?
#python 60.75% <100.00%> (-0.66%) ⬇️

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

Impacted Files Coverage Δ
superset/views/core.py 74.16% <ø> (ø)
superset/viz.py 57.62% <100.00%> (+0.17%) ⬆️
superset/db_engines/hive.py 0.00% <0.00%> (-85.72%) ⬇️
superset/db_engine_specs/hive.py 53.90% <0.00%> (-30.08%) ⬇️
superset/db_engine_specs/presto.py 70.60% <0.00%> (-11.36%) ⬇️
superset/examples/world_bank.py 97.10% <0.00%> (-2.90%) ⬇️
superset/examples/birth_names.py 97.36% <0.00%> (-2.64%) ⬇️
superset/views/database/mixins.py 80.70% <0.00%> (-1.76%) ⬇️
superset/models/core.py 87.56% <0.00%> (-0.83%) ⬇️
superset/connectors/sqla/models.py 89.70% <0.00%> (-0.14%) ⬇️
... and 408 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 e337355...a4fa527. Read the comment docs.

@suddjian suddjian marked this pull request as ready for review September 22, 2020 18:31
@CoryChaplin
Copy link
Contributor

CoryChaplin commented Sep 22, 2020

A personal opinion: I really liked the colour part of the filters that allowed to view in a glimpse what filter was where.
The number and details of the filters is interesting too, but don't we loose a part of the info (and the nice colours in the filter box)?

@junlincc
Copy link
Member

junlincc commented Sep 22, 2020 via email

@CoryChaplin
Copy link
Contributor

Thanks for the feedback @junlinc , I get your point. Goodbye colours :)

@junlincc
Copy link
Member

junlincc commented Sep 23, 2020 via email

@graceguo-supercat
Copy link

graceguo-supercat commented Sep 24, 2020

@suddjian according to SIP-45 discussion, when one or more filters are not applicable to the chart, we will still show the chart with query results, but not applied with wrong filter_fields. We should not show "No Results".

@suddjian
Copy link
Member Author

@suddjian according to SIP-45 discussion, when one or more filters are not applicable to the chart, we will still show the chart with query results, but not applied with wrong filter_fields. We should not show "No Results".

The chart in the screenshot is only showing "No Results" because there genuinely are no results for that query. That is not because of the filters being unapplicable.

type Datasource = {
time_grain_sqla?: [string, string][];
granularity?: [string, string][];
};
Copy link
Member

Choose a reason for hiding this comment

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

can probably replace with import { DatasourceMeta } from '@superset-ui/chart-controls'

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice, thanks

Copy link
Member Author

Choose a reason for hiding this comment

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

that type doesn't include granularity. It probably should, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, the type for time_grain_sqla appears to be incomplete. It's string and should be [string, string][] (or maybe the union of those?)

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, @superset-ui/chart-controls@v15.0.3 (which is in the master branch) should have made time_grain_sqla [string, string][]: https://github.com/apache-superset/superset-ui/blob/0f11940d8201feea3c5f5adee82aef68a9d201f3/packages/superset-ui-chart-controls/src/types.ts#L72

Based on
https://github.com/apache/incubator-superset/blob/fb6f14c4693c5764cc2a151c27746386b190eeae/superset/connectors/sqla/models.py#L661-L664

I believe it is only [string, string][] for Datasource.

As for granularity, feel free to add it in superset-ui/chart-controls if it's not too much hassle for you.

There is also import { Datasource } from '@superset/core', which is missing both properties. We should probably consolidate these two instead of adding yet another new type.

@graceguo-supercat
Copy link

graceguo-supercat commented Sep 26, 2020

I want to raise a usability concern about the new design @junlincc
Before:

  • when charts are loaded in dashboard, from filter indicators I can tell each chart should be applicable to any dashboard filters or not, even I don't actually apply any filters to this dashboard.
  • when i focus/interact with any filter_box dropdown, I can see which charts will be affected by this filter field, even I don't actually apply the filter. This is really useful when user want to double check filter scope is correct.

After:
All these indication functionalities are lost. I would think these lost as regression. Could you bring them into new design?

BEFORE:

AFTER:

….tsx

Co-authored-by: Evan Rusackas <evan@preset.io>
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.

Left some nits, mostly about Theme variables, but I'll give this the green light and let you clean that up before merging as we discussed.

@mistercrunch
Copy link
Member

boom

@suddjian suddjian deleted the feature/filter-p0 branch October 31, 2020 04:30
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
* Initial commit of new filters badge.

* refactor applied/rejected filters code

* finished filter indicators

* filter badge tested

* unnecessary imports

* formatting and types

* fixes

* license

* code quality tweaks

* state management for showing focused filter scope

* clean up filter key extraction code

* remove unnecessary styles

* temp css to demonstrate highlighting

* fix focused filter logic

* no more color badges

* new toys for highlighting dash components (apache#11144)

* tweak style for the filter chart when filter is focused

* style: Filters p0 css2 (apache#11151)

* nixing background tweak

* src paths

* another quick theme color

* src paths, adjusting pill icon color, changing icons, showing applied/busted counts

* linting stuff

* fixing and tweaking tests

* show filter indicator when filters are not active

* chart title bar cleanup

* open the right panel when popover opens

* unused import

* fix EditableTitle tests

* margin on dashboard header

* show the chart dropdown menu

* fix blur filter breaking dropdowns

* style tweak - no pointer events when irrelevant charts are blurred

* fix box shadow on filter highlight

* it's an array

* attempt fixing e2e

* style: filters p0 icon churn (apache#11215)

* new filters icon

* icon styling

* bigger icons in list views

* better sizing of table actions and favStars

* more icon sizing...

* fixing more button size jankiness

* linting

* Filters performance (apache#11255)

* fixing time filter "ok" button

* making unset filter menu collapsible

* sort alphabetically

* fix highlighting when removing items

* try a flex layout (for browser render perf)

* more specific transitioning

* temp: comment out some code as a test

* temp: comment out more code

* temp: remove possibly expensive computations from ChartHolder

* Revert "temp: comment out some code as a test"

This reverts commit 309b880.

* Revert "temp: comment out more code"

This reverts commit 64c88b2.

* Revert "temp: remove possibly expensive computations from ChartHolder"

This reverts commit 37ce021.

* experiment: upgrade react-select to v3

* Revert "experiment: upgrade react-select to v3"

This reverts commit c3972ba.

* fix the damn problem

* remove code used for testing purposes

* awful hack to avoid adding a class to a container

* approaching infinity... and not beyond!

* fix ref forwarding

* add theme to tests as necessary

* fix(extra-filters): add logic for identifying applied extra filters (apache#11325)

* fix: use dashboard id for stable cache key (apache#11293)

* fix: button translations missing (apache#11187)

* button translations missing

* blank space before text

* feat: update time_compare description and choices (apache#11294)

* feat: update time_compare description and choices

* Update sections.jsx

* fix(extra-filters): add logic for identifying applied extra filters

* lint

Co-authored-by: Jesse Yang <jesse.yang@airbnb.com>
Co-authored-by: rubenSastre <ruben.sastre@decathlon.com>
Co-authored-by: Erik Ritter <erik.ritter@airbnb.com>

* address design feedback

* slight tweak to panel logic, keep panels open that user has opened

* rearrange code to be more graceful

* fix: bump superset-ui/core (apache#11385)

* use is_dttm instead of is_temporal

* types, names

* only show unset filter panel if there are unset filters

* fix highlighting the filter control

* fix filterbox layout

* translations

* fix cypress

* actually add the test attribute

* Update superset-frontend/src/dashboard/components/DashboardBuilder.jsx

Co-authored-by: Evan Rusackas <evan@preset.io>

* Update superset-frontend/src/dashboard/components/DashboardBuilder.jsx

Co-authored-by: Evan Rusackas <evan@preset.io>

* formatting

* add link comment to hack

* Update superset-frontend/src/dashboard/components/gridComponents/ChartHolder.jsx

Co-authored-by: Evan Rusackas <evan@preset.io>

* stop importing lodash

* Update superset-frontend/src/dashboard/components/gridComponents/ChartHolder.jsx

Co-authored-by: Evan Rusackas <evan@preset.io>

* Update superset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx

Co-authored-by: Evan Rusackas <evan@preset.io>

* Update superset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx

Co-authored-by: Evan Rusackas <evan@preset.io>

* Update superset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx

Co-authored-by: Evan Rusackas <evan@preset.io>

* Update superset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx

Co-authored-by: Evan Rusackas <evan@preset.io>

* skip broken test

* Update superset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx

Co-authored-by: Evan Rusackas <evan@preset.io>

* Update superset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx

Co-authored-by: Evan Rusackas <evan@preset.io>

* adjust colors of titles

* linting

* no indicators when chart is loading

* support all time fields

* fix lock file

Co-authored-by: Natalie Ruhe <natalie@preset.io>
Co-authored-by: Evan Rusackas <evan@preset.io>
Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
Co-authored-by: Jesse Yang <jesse.yang@airbnb.com>
Co-authored-by: rubenSastre <ruben.sastre@decathlon.com>
Co-authored-by: Erik Ritter <erik.ritter@airbnb.com>
Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.0.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/XXL 🚢 1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants