Skip to content

feat: Add Dashboard Filter Support for Alert Reports #32196

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

Open
wants to merge 91 commits into
base: master
Choose a base branch
from

Conversation

hughhhh
Copy link
Member

@hughhhh hughhhh commented Feb 9, 2025

Summary

This PR introduces a new feature that allows users to configure dashboard filters when creating alert reports. The feature is controlled by the ALERT_REPORTS_FILTER feature flag and enables users to specify which native filters should be applied when generating dashboard reports.

Key Features

  • Dashboard Filter Selection: Users can now select specific native filters from a dashboard when creating alert reports
  • Filter Value Configuration: Support for configuring filter values including:
    • Time range filters (filter_time)
    • Range filters (filter_range) with min/max values
    • Select filters (filter_select) with multiple value selection
    • Time column filters (filter_timecolumn)
    • Time grain filters (filter_timegrain)
  • Dynamic Filter Options: Filter values are dynamically fetched based on the selected dashboard and filter type
  • Validation: Comprehensive validation ensures filter configurations are complete before saving

Technical Implementation

Frontend Changes

  • AlertReportModal.tsx: Enhanced with filter selection UI components
    • Added TreeSelect for filter selection
    • Implemented filter value configuration controls
    • Added validation for filter completeness
    • Integrated with existing dashboard state management

Backend Changes

  • Report Execution: Modified to apply configured filters when generating reports
  • API Integration: Enhanced to fetch filter options and validate filter configurations
  • Data Processing: Added support for processing filter values in report generation

Feature Flag

  • ALERT_REPORTS_FILTER: New feature flag to control the dashboard filter functionality
  • Defaults to True in development environments
  • Can be disabled for production if needed

User Experience

  1. Filter Selection: When creating a dashboard report, users can select from available native filters
  2. Value Configuration: For each selected filter, users can configure appropriate values:
    • Date ranges for time filters
    • Min/max values for range filters
    • Multiple selections for select filters
  3. Validation: The system validates that all selected filters have proper values configured
  4. Report Generation: When the report runs, it applies the configured filters to generate filtered dashboard content

Testing

  • Added comprehensive unit tests for filter validation
  • Integration tests for filter value processing
  • UI component tests for filter selection interface

Configuration

The feature is enabled by default but can be controlled via the ALERT_REPORTS_FILTER feature flag in superset_config.py:

"ALERT_REPORTS_FILTER": True

Breaking Changes

None - this is a purely additive feature that doesn't affect existing functionality.

Documentation

  • Updated feature flags documentation to include the new ALERT_REPORTS_FILTER flag
  • Added inline code comments explaining filter processing logic

This enhancement significantly improves the flexibility of alert reports by allowing users to generate

@github-actions github-actions bot added the api Related to the REST API label Feb 9, 2025
@dosubot dosubot bot added the alert-reports Namespace | Anything related to the Alert & Reports feature label Feb 9, 2025
@hughhhh hughhhh force-pushed the hm/ar-filters branch 2 times, most recently from 4f78062 to 6db36be Compare February 9, 2025 13:04
Copy link

korbit-ai bot commented Feb 9, 2025

I was unable to post the issues I found. This could be because a force push or squash has changed the commit history since I scanned this pull request. You can get another review by commenting /korbit-review.

@hughhhh hughhhh force-pushed the hm/ar-filters branch 2 times, most recently from 72774cd to d6adc97 Compare February 9, 2025 13:07
Copy link

@heidijosweeenz1997 heidijosweeenz1997 left a comment

Choose a reason for hiding this comment

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

Withdraw in to my commonwealth bank

@michael-s-molina michael-s-molina marked this pull request as draft February 10, 2025 18:26
@hughhhh hughhhh force-pushed the hm/ar-filters branch 2 times, most recently from 8574ad9 to a3c7b96 Compare February 10, 2025 19:42
Copy link
Contributor

@geido Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

Copy link
Contributor

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

@hughhhh
Copy link
Member Author

hughhhh commented Jun 24, 2025

/testenv up

Copy link
Contributor

@hughhhh Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

Copy link
Contributor

@hughhhh Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

Copy link
Contributor

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

@hughhhh hughhhh changed the title feat: Add Filters to Alerts & Reports Modal feat: Add Dashboard Filter Support for Alert Reports Jul 12, 2025
Copy link
Contributor

@sadpandajoe Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alert-reports Namespace | Anything related to the Alert & Reports feature api Related to the REST API packages size/XXL testenv-up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants