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: Applying Dashboard Time Range Filters to Overwritten Charts #25156

Merged
merged 3 commits into from
Sep 1, 2023

Conversation

lilykuang
Copy link
Member

SUMMARY

When a chart was accessed from a dashboard, the dashboard configuration, including color palette and temporal filter, was carried over to the Chart Builder. If a temporal filter was carried over and the chart was subsequently overwritten, the temporal filter was not functioning correctly with the dashboard temporal filter.
image

How to Reproduce the Bug:

  1. Create a chart and add it to a dashboard.
  2. Add a time range filter to the dashboard and apply a value.
  3. Click on the chart title to access it in the Chart Builder menu.
  4. Add a new filter to the chart.
  5. Overwrite the chart and return to the dashboard.
  6. Apply any time range filter.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

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

@pull-request-size pull-request-size bot added size/M and removed size/S labels Sep 1, 2023
Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @lilykuang. This logic was changed so many times before and I would like to make sure this change does not impact previous fixes in #24405 and #24876.

@sadpandajoe @jinghua-qa can we get your help here to test the multiple flows before merging this PR?

// If a filter is of type TEMPORAL_RANGE and isExtra, it sets its comparator to
// 'No filter' and adds the modified filter to the adhocFilters array. This ensures that all
// TEMPORAL_RANGE filters are converted to 'No filter' when saving a chart.
formDataWithNativeFilters?.adhoc_filters?.forEach(filter => {
Copy link
Member

@michael-s-molina michael-s-molina Sep 1, 2023

Choose a reason for hiding this comment

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

Previously, formDataWithNativeFilters.adhoc_filters were only used if adhocFilters.adhoc_filters and formDataFromSlice were empty. Why were these checks necessary? Don't we need them anymore?

Copy link
Member Author

@lilykuang lilykuang Sep 1, 2023

Choose a reason for hiding this comment

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

In the past, we used those checks for adhocFilters.adhoc_filters and formDataFromSlice being empty because we noticed that the TEMPORAL_RANGE filter would disappear when those conditions were met. But as we dug deeper, we found out that this wasn't just happening when both of them were empty. It was also happening when adhocFilters.adhoc_filters had another filter. This PR is attempting to address both scenarios, ensuring that the TEMPORAL_RANGE filter is retained properly.

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for the additional context @lilykuang. Do you know if the fixes in #24405 and #24876 are not affected by this change?

Copy link
Member Author

@lilykuang lilykuang Sep 1, 2023

Choose a reason for hiding this comment

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

they shouldn't be affected

Copy link
Member

Choose a reason for hiding this comment

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

This change is okay for my hotfix #24876

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
@michael-s-molina
Copy link
Member

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2023

@michael-s-molina Ephemeral environment spinning up at http://54.188.121.210:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

Thank you for the fix @lilykuang and for addressing the comments!

@michael-s-molina michael-s-molina added the v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch label Sep 1, 2023
@lilykuang lilykuang merged commit f2523b2 into apache:master Sep 1, 2023
26 checks passed
@lilykuang lilykuang deleted the lily/fix-time-range-filter branch September 1, 2023 21:30
@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2023

Ephemeral environment shutdown and build artifacts deleted.

sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Sep 1, 2023
…che#25156)

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
(cherry picked from commit f2523b2)
@sadpandajoe
Copy link
Contributor

🏷️ preset:2023.35

michael-s-molina pushed a commit that referenced this pull request Sep 5, 2023
)

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
(cherry picked from commit f2523b2)
darwinsubramaniam pushed a commit to darwinsubramaniam/superset that referenced this pull request Sep 7, 2023
…che#25156)

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
…che#25156)

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
@mistercrunch mistercrunch added 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.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/M v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants