graceguo-supercat opened a new issue #10285: URL: https://github.com/apache/incubator-superset/issues/10285
## [SIP] Proposal for Dashboard Filter Component ### Motivation This SIP is **not** about design or implementation. Instead I want to discuss the _**requirements**_ of dashboard filters: what functionalities the dashboard filters should offer. Based on this discussion, we will do architecture design and implementation plan. Over the last a few years, we got many, many suggestions and feature requests to improve the usability and interactions for Superset dashboard filters. Currently dashboard filters are _charts_, when it is loaded each filter field is a query (select DISTINCT _column_name_ from _table_), and results are rendered as filter_box viz_type. It works good for most of use-cases, but still missed a few functionalities if compared with dashboard filter from other BI tools. ### Proposed Change I want to propose a solution to improve the functionalities for dashboard filters. Instead of using a separated slice component, I think dashboard should have **build-in Filter component**. It should carry over all the features from existed filter_box slice, understand properties that slice filter used (datasource, column, default values, sorting, .etc), and re-use dashboard specific properties, like filter scope and immune. All these **filters related properties should be persistent in dashboard metadata**. For component UI/UX, we should follow [SIP-34](https://github.com/apache/incubator-superset/issues/8976): **view mode: apply filter**  **add/edit filter config and scopes** <img width="1304" alt="Screen Shot 2020-07-09 at 5 35 56 PM" src="https://user-images.githubusercontent.com/27990562/87103807-deb3ac80-c20a-11ea-9fe4-796f12980bd6.png"> ### New or Changed Public Interfaces I list all dashboard filters related feature requests here, so that we can decide which ones should be implemented. - **Section 1:** Current features should be kept: 1. Filter indicators 2. Filter scopes 3. Share dashboard with snapshot of filter state 4. Chart filter: user select a few rows in a table (or a piece in a pie chart etc), selected rows works like temporary filter and applied to other charts in the dashboard. This feature was lost during filter-scope implementation, but should bring it back. - **Section 2:** Extra filter functionalities candidates: 1. Allow user apply filter on Metric (and column), similar to adhoc filter [[9502](https://github.com/apache/incubator-superset/issues/9502)] 2. To support "less than" and "greater than" (or "BETWEEN"), current filter_box can only select one or more fixed values [[9974](https://github.com/apache/incubator-superset/issues/9974)] 3. Non-editable filter box, or some options are not removable. [[10230](https://github.com/apache/incubator-superset/issues/10230)] 4. Cascading filters: when user changes filter A, it will automatically trigger filter B loaded with new options, in a pre-defined sequence [[5664](https://github.com/apache/incubator-superset/pull/5664)][[10013](https://github.com/apache/incubator-superset/issues/10013)] 5. Allow user to define static option values instead of running a query [[SIP-25](https://github.com/apache/incubator-superset/issues/8452)] 6. Allow filter only apply to charts from same datasource (filter scope settings). - **Section 3:** Extra intra-dashboard interaction: 1. Time-based Visual Correlation between Charts on a Dashboard [[SIP-10](https://github.com/apache/incubator-superset/issues/5955)] 2. Intra-dashboard interaction [[7512](https://github.com/apache/incubator-superset/issues/7512)] ### Migration Plan and Compatibility Currently Superset filters for dashboard are _slices_, and all filter properties are stored in slices table. After we implemented dashboard filter component, existed _filter slice_ should be converted to dashboard properties. We will offer a Superset db migration script, which will automatically convert filter_box properties into dashboard filter properties. But since each filter_box took some space in the dashboard, it will still need some manual work to remove filter_box from dashboard, and re-arrange dashboard layout to make it nice and clean. ### Rejected Alternatives Describe alternative approaches that were considered and rejected. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
