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

fix: Error when searching for a dashboard in the chart list #24546

Conversation

michael-s-molina
Copy link
Member

SUMMARY

#21760 added the cross-referenced dashboards feature which is really valuable to our users. As part of the changes, the function to fetch the dashboards was operating differently depending on the existence of a search text. When a search was present, it was invoking /api/v1/chart which brings only the dashboards associated to the charts and when no search was present it was invoking /api/v1/dashboard which ignores the charts relationship.

This was causing some problems:

  • There was an error when invoking /api/v1/chart related to the constructed query.
  • There was a performance implication in scenarios where the number of charts is really high because the application needs to join the charts and dashboards tables to resolve the associations.
  • The behavior was different than the Datasets filter which ignores the charts relationships.

This PR changes the logic to always query the /api/v1/dashboard endpoint and ignore the relationships with charts.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen.Recording.2023-06-28.at.16.26.09.mov
Screen.Recording.2023-06-28.at.16.23.26.mov

TESTING INSTRUCTIONS

Check the videos for 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

col: 'dashboards',
opr: FilterOperator.relationManyMany,
col: 'dashboard_title',
opr: FilterOperator.startsWith,
Copy link
Member Author

Choose a reason for hiding this comment

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

It's using startsWith which is the same operator used by the Datasets filter.

endpoint: !filterValue
? `/api/v1/dashboard/?q=${queryParams}`
: `/api/v1/chart/?q=${queryParams}`,
endpoint: `/api/v1/dashboard/?q=${queryParams}`,
Copy link
Member

Choose a reason for hiding this comment

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

@michael-s-molina I briefly looked into this logic previously. Could you confirm that your logic also works when you include a filterValue. i.e., text in the SEARCH box?

Copy link
Member Author

Choose a reason for hiding this comment

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

If you use the search input (not the dashboard select) to look for a dashboard name, it won't work. That would require creating a search filter but that's out of the scope of this PR.

@codecov
Copy link

codecov bot commented Jun 28, 2023

Codecov Report

Merging #24546 (e493013) into master (a90f740) will decrease coverage by 10.84%.
The diff coverage is 70.40%.

❗ Current head e493013 differs from pull request most recent head 14e866c. Consider uploading reports for the commit 14e866c to get more accurate results

@@             Coverage Diff             @@
##           master   #24546       +/-   ##
===========================================
- Coverage   69.07%   58.24%   -10.84%     
===========================================
  Files        1904     1906        +2     
  Lines       74027    74127      +100     
  Branches     8118     8154       +36     
===========================================
- Hits        51136    43177     -7959     
- Misses      20780    28831     +8051     
- Partials     2111     2119        +8     
Flag Coverage Δ
javascript 55.78% <68.62%> (+0.03%) ⬆️
mysql ?
postgres ?
sqlite ?

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

Impacted Files Coverage Δ
...ackages/superset-ui-chart-controls/src/fixtures.ts 100.00% <ø> (ø)
...d/packages/superset-ui-chart-controls/src/types.ts 100.00% <ø> (ø)
...ges/superset-ui-core/src/query/types/Datasource.ts 100.00% <ø> (ø)
...ackages/superset-ui-core/src/query/types/Metric.ts 100.00% <ø> (ø)
...rts/src/BigNumber/BigNumberTotal/transformProps.ts 0.00% <0.00%> (ø)
...lugin-chart-echarts/src/Timeseries/transformers.ts 56.20% <ø> (ø)
...plugins/plugin-chart-echarts/src/utils/forecast.ts 93.22% <ø> (ø)
...d/plugins/plugin-chart-echarts/src/utils/series.ts 85.48% <ø> (ø)
...s/plugin-chart-pivot-table/src/PivotTableChart.tsx 0.00% <0.00%> (ø)
...gin-chart-pivot-table/src/plugin/transformProps.ts 42.30% <0.00%> (ø)
... and 28 more

... and 292 files with indirect coverage changes

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

@michael-s-molina michael-s-molina merged commit 2b1275d into apache:master Jun 29, 2023
27 checks passed
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 8, 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/XS 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants