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): Add Drill to Detail modal w/ chart menu + right-click support #20728

Conversation

codyml
Copy link
Member

@codyml codyml commented Jul 15, 2022

SUMMARY

This PR introduces a drill-to-detail modal. It adds a "Drill to detail" menu item to dashboard charts' contextual menus and also completes support for opening the modal by right-clicking on chart features. The drill-to-detail modal allows users to inspect the data that is backing a chart from the dashboard that the chart is on, while optionally applying filters based on where in the chart was clicked.

More details:

  • Unlike the Samples pane, the drill-to-detail modal content is server-paginated and allows paging through all rows of data.
  • All columns of the dataset are displayed.
  • Native dashboard filters, cross-filters, ad-hoc chart filters and time chart filters are transparently respected; only rows matching those filters are displayed in the modal table.
  • The chart menu item and contextual menus appear when the DRILL_TO_DETAIL feature flag is enabled.
  • Only ECharts (excluding Tree Chart) are currently supported for contextual menu access.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Menu item:
localhost_9000_superset_dashboard_births__native_filters_key=7menIfx9h9P-xFkGBuKMFYlgho-hubMp7tZVmWyfTDwRyNH5UgdFt1pGo8-RJIw-

Modal:
localhost_9000_superset_dashboard_births__native_filters_key=7menIfx9h9P-xFkGBuKMFYlgho-hubMp7tZVmWyfTDwRyNH5UgdFt1pGo8-RJIw- (1)

Modal w/ native filters:
localhost_9000_superset_dashboard_births__native_filters_key=7menIfx9h9P-xFkGBuKMFYlgho-hubMp7tZVmWyfTDwRyNH5UgdFt1pGo8-RJIw- (2)

TESTING INSTRUCTIONS

  • Ensure no change to contextual menu without feature flag set
  • With feature flag set, compare expected datasource results to drill to detail results in the following circumstances:
    • No filters from chart or dashboard context
    • Chart time filters
    • Chart ad-hoc filters
    • Dashboard native filters
    • Dashboard cross-filters
  • Ensure that paginated results in modal work as expected in the following circumstances:
    • No results
    • One page of results
    • Multiple pages of results
    • Few columns
    • Lots of columns
  • Check that right-clicking parts of charts opens the appropriate filters
    • See below for list of charts that are supported
    • Try "Drill to detail", "Drill by X" and "Drill by all" options
    • Try filtering by string values, number values, and date values
    • Try clearing filters

Charts supporting right-click:

  • Big number
    • Right-click on number: Drill to detail
  • Big number with Trendline
    • Right-click on number: Drill to detail
    • Right-click on point on trendline: Drill by {date}
  • Box Plot
    • Right-click on box: Drill by {dimension}
  • Funnel Chart
    • Right-click on funnel segment: Drill by {dimension}
  • Gauge Chart
    • Right-click on gauge segment or needle: Drill by {dimension}
  • Graph Chart
    • Right-click on edge: Drill by {dimension}
  • Mixed Time-Series
    • Right-click on point on line: Drill by {dimension}, Drill by {timestamp}, Drill by all
  • Pie Chart
    • Right-click on pie segment: Drill by {dimension}
  • Radar Chart
    • Right-click on dimension point: Drill by {dimension}
  • Time-series Chart
    • Time-series Line Chart
    • Time-series Area Chart
    • Time-series Bar Chart v2
    • Time-series Scatter Plot
    • Time-series Smooth Line
    • Time-series Stepped Line
    • For all of these: Right-click on point on line: Drill by {dimension}, Drill by {timestamp}, Drill by all
  • Treemap v2
    • Right-click on dimension title (for multiple-dimension treemaps): Drill by {dimension}
    • Right-click on box: Drill by {dimension}, Drill by {addl dimension}, Drill by all

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags: DRILL_TO_DETAIL (DASHBOARD_CROSS_FILTERS optional to test cross-filter support)
  • 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

@codyml codyml force-pushed the codyml/sc-52488/apply-drill-to-detail-modal-filters-gathered branch from f663ec8 to 54a18c1 Compare July 18, 2022 22:13
@codyml codyml force-pushed the codyml/sc-52488/apply-drill-to-detail-modal-filters-gathered branch from 091f022 to 12d3f56 Compare July 20, 2022 16:59
@codyml codyml changed the title feature(dashboard): Drill to detail modal [WIP] feature(dashboard): Drill to detail modal Jul 22, 2022
@codyml codyml marked this pull request as ready for review July 22, 2022 00:14
@codyml codyml force-pushed the codyml/sc-52488/apply-drill-to-detail-modal-filters-gathered branch from 3ca3f87 to 2e4f5ee Compare July 22, 2022 00:21
@codecov
Copy link

codecov bot commented Jul 22, 2022

Codecov Report

Merging #20728 (0bf4e56) into master (0bf4e56) will not change coverage.
The diff coverage is n/a.

❗ Current head 0bf4e56 differs from pull request most recent head 2310b03. Consider uploading reports for the commit 2310b03 to get more accurate results

@@           Coverage Diff           @@
##           master   #20728   +/-   ##
=======================================
  Coverage   66.16%   66.16%           
=======================================
  Files        1773     1773           
  Lines       67689    67689           
  Branches     7218     7218           
=======================================
  Hits        44786    44786           
  Misses      21059    21059           
  Partials     1844     1844           
Flag Coverage Δ
javascript 52.12% <0.00%> (ø)
mysql 80.98% <0.00%> (ø)
postgres 81.04% <0.00%> (ø)
python 81.15% <0.00%> (ø)
sqlite 79.64% <0.00%> (ø)

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

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

@codyml codyml force-pushed the codyml/sc-52488/apply-drill-to-detail-modal-filters-gathered branch from 2e4f5ee to 9b7e22c Compare July 22, 2022 15:16
Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

just left some suggestions. codes look good. I will test it in local. Thanks @codyml

superset-frontend/src/components/Chart/chartAction.js Outdated Show resolved Hide resolved
initialFilters?: BinaryQueryObjectFilterClause[];
}) {
const theme = useTheme();
const [pageIndex, setPageIndex] = useState(0);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const [pageIndex, setPageIndex] = useState(0);
const [pageIndex, setPageIndex] = useState(1);

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm using 0-indexed page indices in front-end code because the TableView component does and I felt like consistency with that was more important – that okay?

Copy link
Member

Choose a reason for hiding this comment

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

The TableView has a property initialPageIndex, this property means which page is the first page when pagination. BTW, in the pagination context, the index means page number instead of index, so maybe the first page is 1.

const TableView = ({
columns,
data,
pageSize: initialPageSize,
totalCount = data.length,
initialPageIndex,
initialSortBy = [],
loading = false,
withPagination = true,
emptyWrapperType = EmptyWrapperType.Default,
noDataText,
showRowCount = true,
serverPagination = false,
columnsForWrapText,
onServerPagination = () => {},
...props
}: TableViewProps) => {
const initialState = {
pageSize: initialPageSize ?? DEFAULT_PAGE_SIZE,
pageIndex: initialPageIndex ?? 0,
sortBy: initialSortBy,
};

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh great, didn't see that thanks! Will update.

Copy link
Member Author

Choose a reason for hiding this comment

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

@zhaoyongjie I'm having trouble using initialPageIndex to tell TableView to use 1-indexed page numbers: it seems like for server pagination, that parameter is used to set the current page number instead, and TableView expects the first page index to be 0. If you can figure out how to do it without rewriting TableView to expect 1-indexed page numbers, feel free to push a commit.

@michael-s-molina
Copy link
Member

michael-s-molina commented Jul 25, 2022

Hi @codyml. We need to account for charts and dashboard configurations when displaying the drilling details panel. One example is the chart below:

Screen Shot 2022-07-25 at 2 56 01 PM

In this chart, we should consider the controls configuration that impacts the query like is_software_dev = 1, last_yr_income <= 200000, and time range = 2018-03-01 <= col < 2022-07-25. We also need to consider that each visualization has different controls.

I believe the samples pane in Explore should also account for these filters. If I set is_software_dev = 1 I don't expect to see samples where this condition is not true.

The drilling details panel should also be influenced by dashboard configurations like developer_type in the example below:

Screen Shot 2022-07-25 at 3 03 58 PM

To make things more complicated, dashboard filters can come from the filters panel or cross-filters.

I don't know if I covered everything. We may have other sources that impact a chart. Tagging some folks to see if I'm missing anything @rusackas @lauderbaugh @zhaoyongjie @kgabryje @geido

@zhaoyongjie
Copy link
Member

zhaoyongjie commented Jul 26, 2022

I believe the samples pane in Explore should also account for these filters. If I set is_software_dev = 1 I don't expect to see samples where this condition is not true.

It's not true. The SamplesPane implies sampling the data source and has no relation to the chart. V1 API is at here, legacy API is at here.


It is a point worth discussing why the original implementation did not reset the filters field in the QueryObject? IMO, It's a bug.

The filters should be applied where clause or having clause in the query. The metrics has been reset on the QueryObject, so 1) we did not have a chance to send a query with having clause. 2) the time range has been reset so that no chance to send a query with a time partition.

@codyml codyml closed this Jul 26, 2022
@codyml
Copy link
Member Author

codyml commented Jul 27, 2022

Closed to refocus on additional work required given clarified requirements.

@codyml
Copy link
Member Author

codyml commented Jul 29, 2022

Reopening!

@codyml codyml reopened this Jul 29, 2022
@michael-s-molina
Copy link
Member

Can we display the modal with a fixed height/width? I find it weird that it starts small and grows after the results are rendered.

@michael-s-molina
Copy link
Member

michael-s-molina commented Aug 22, 2022

All issues should now be fixed, with the exception of D2D on values containing commas, which is being worked on in separate PRs (#21151, #21124).

@codyml Both PRs are now merged in case you want to rebase.

@jinghua-qa
Copy link
Member

Dashboard Regression Test LGTM

@codyml codyml force-pushed the codyml/sc-52488/apply-drill-to-detail-modal-filters-gathered branch from 621ea73 to 2310b03 Compare August 22, 2022 17:31
Copy link
Member

@jinghua-qa jinghua-qa left a comment

Choose a reason for hiding this comment

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

LGTM

@jinghua-qa jinghua-qa merged commit 52648ec into apache:master Aug 22, 2022
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

@JunTech
Copy link

JunTech commented Sep 5, 2022

how to use in 2.0.0 branch

@codyml
Copy link
Member Author

codyml commented Sep 6, 2022

how to use in 2.0.0 branch

Hi @JunTech! This feature wasn't included in the 2.0.0 release, so using it would require running Superset from your own non-release branch that includes this commit (and previous supporting commits), then enabling the DRILL_TO_DETAIL feature flag. This feature is very much still a work-in-progress and you're likely to run into incomplete support for viz plugins and the potential for bugs when enabled. It'll be included in a release when it's more complete!

@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/XL 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants