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: Custom filters control #17006

Merged
merged 26 commits into from
Oct 15, 2021
Merged

Conversation

simcha90
Copy link
Contributor

@simcha90 simcha90 commented Oct 7, 2021

For some customer needs we needs customize AdHocFilters control to be more dynamic according needs (please review video), it includes:

  1. Optionally show Custom SQL tab
  2. Optionally pass operators for comparing

Here example of our custom configuration:

const coloredBreakdowns: { name: string; config: ControlConfig<'AdhocFilterControl'> } = {
  name: 'colored_breakdowns',
  config: {
    type: 'AdhocFilterControl',
    label: t('Colored breakdowns'),
    default: null,
    renderTrigger: true,
    description: 'Choose breakdown value to be coloured',
    mapStateToProps: state => ({
      sections: ['SIMPLE'], // optinaly: ['SIMPLE', 'CUSTOM_SQL'] - by default
      operators: ['EQUALS'],
      columns: state.datasource ? state.datasource.columns.filter(c => c.filterable) : [],
      savedMetrics: [],
      datasource: state.datasource,
    }),
  },
};

SUMMARY

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen.Recording.2021-10-07.at.10.59.15.mov

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

@codecov
Copy link

codecov bot commented Oct 7, 2021

Codecov Report

Merging #17006 (a3556f9) into master (ac50961) will decrease coverage by 0.00%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17006      +/-   ##
==========================================
- Coverage   76.71%   76.71%   -0.01%     
==========================================
  Files        1030     1031       +1     
  Lines       55035    55185     +150     
  Branches     7465     7513      +48     
==========================================
+ Hits        42221    42334     +113     
- Misses      12565    12600      +35     
- Partials      249      251       +2     
Flag Coverage Δ
javascript 70.93% <77.77%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
...ontrols/FilterControl/AdhocFilterControl/index.jsx 57.69% <ø> (ø)
...controls/FilterControl/AdhocFilterOption/index.jsx 100.00% <ø> (ø)
.../FilterControl/AdhocFilterPopoverTrigger/index.tsx 80.76% <ø> (ø)
...ols/FilterControl/AdhocFilterEditPopover/index.jsx 69.44% <75.00%> (+1.11%) ⬆️
...l/AdhocFilterEditPopoverSimpleTabContent/index.tsx 73.24% <81.81%> (+0.69%) ⬆️
...explore/components/controls/ColorSchemeControl.jsx 60.60% <0.00%> (-28.68%) ⬇️
...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx 54.54% <0.00%> (-8.32%) ⬇️
...nd/src/components/ErrorMessage/BasicErrorAlert.tsx 95.23% <0.00%> (-4.77%) ⬇️
...et-frontend/src/components/TableSelector/index.tsx 74.52% <0.00%> (-3.03%) ⬇️
.../src/explore/components/controls/SelectControl.jsx 77.61% <0.00%> (-2.39%) ⬇️
... and 28 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 ac50961...a3556f9. Read the comment docs.

@geido
Copy link
Member

geido commented Oct 7, 2021

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2021

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

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

A few comments. Down the road we might also want to introduce a concept of sections that should be enabled, as the metric control is very similar and has the Saved, Simple and Custom SQL (we might very well introduce saved filters later in the dataset). So instead of enableCustomSQL, enableSimple etc we could have sections = [SAVED, SIMPLE, CUSTOM_SQL].

@simcha90
Copy link
Contributor Author

@geido @michael-s-molina @villebro fixed according notes

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM with an optional improvement for legacy Druid

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for implementing the druid thing 👍

@amitmiran137 amitmiran137 merged commit eebc953 into apache:master Oct 15, 2021
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

eschutho pushed a commit to preset-io/superset that referenced this pull request Oct 27, 2021
* fix:fix get permission function

* feat: customize filter control

* fix: fix types

* fix: fix merge

* refactor: update according CR

* refactor: fix CR notes

(cherry picked from commit eebc953)
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
* fix:fix get permission function

* feat: customize filter control

* fix: fix types

* fix: fix merge

* refactor: update according CR

* refactor: fix CR notes
@mistercrunch mistercrunch added 🍒 1.4.0 🍒 1.4.1 🍒 1.4.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 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 v1.4 🍒 1.4.0 🍒 1.4.1 🍒 1.4.2 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants