Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Jun 25, 2025

Link issues

fixes #6291

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Introduce a dedicated NotSupportFilter component to handle unsupported filter types and fix filter icon alignment in the Table component, refactor TableColumnFilter to use the new component and remove its localizer dependency, simplify TabItem class logic, and update/add tests to align with the new markup.

New Features:

  • Add a new NotSupportFilter component to display unsupported filter type messages

Bug Fixes:

  • Fix filter icon misalignment for unsupported data types in the Table component

Enhancements:

  • Refactor TableColumnFilter to use NotSupportFilter and remove direct IStringLocalizer injection
  • Simplify TabItem class CSS builder logic

Tests:

  • Update Tab component unit tests to expect the new .tabs-body-content-wrap wrapper
  • Add TableNotSupportFilterTest to validate unsupported filter behavior

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jun 25, 2025

Reviewer's Guide

This PR adds a dedicated NotSupportFilter component for handling unsupported filter types (integrated into TableColumnFilter while removing redundant parameter setup), adjusts Tab component rendering logic and unit tests to account for a new wrapper element, and introduces new tests for the unsupported-filter scenario.

Class diagram for NotSupportFilter and TableColumnFilter changes

classDiagram
    class FilterBase {
        <<abstract>>
        +FilterKeyValueAction GetFilterConditions()
        +void Reset()
    }
    class NotSupportFilter {
        +string? NotSupportedMessage
        +FilterKeyValueAction GetFilterConditions()
        +void Reset()
    }
    class TableColumnFilter {
        +ITable Table
        +string? NotSupportedMessage
    }
    FilterBase <|-- NotSupportFilter
    FilterBase <|-- TableColumnFilter
    NotSupportFilter <.. TableColumnFilter : used in
Loading

Class diagram for updated Tab component logic

classDiagram
    class Tab {
        -bool IsPreventDefault
        -static string? GetTabItemClassString(TabItem item)
    }
    class TabItem {
        +bool IsActive
    }
    Tab o-- TabItem : contains
Loading

File-Level Changes

Change Details Files
Introduce NotSupportFilter component
  • Create NotSupportFilter.razor and NotSupportFilter.razor.cs files
  • Implement OnParametersSet to default the message
  • Override GetFilterConditions and Reset methods
src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor
src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs
Integrate NotSupportFilter into TableColumnFilter
  • Replace raw message div with FilterProvider wrapping NotSupportFilter
  • Remove unused Localizer injection
  • Remove OnParametersSet override and related parameter setup
src/BootstrapBlazor/Components/Filters/TableColumnFilter.razor
src/BootstrapBlazor/Components/Filters/TableColumnFilter.razor.cs
Simplify Tab component active-state logic
  • Change CSS builder to use !item.IsActive instead of matching pattern
src/BootstrapBlazor/Components/Tab/Tab.razor.cs
Update Tab component unit tests for new markup
  • Adjust assertions to select inner .tabs-body-content-wrap element instead of bare container
test/UnitTest/Components/TabTest.cs
Add unit tests for unsupported filter scenario
  • Create TableNotSupportFilterTest class
  • Mock table and column to simulate unsupported data type
  • Assert message rendering and empty filter conditions
test/UnitTest/Components/TableNotSupportFilterTest.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#6291 Fix the issue where setting Visible = false for a column in Table's AutoGenerateColumn and using Filterable causes misalignment when the column is displayed.
#6291 Address the issue where column width dragging is affected when using Filterable with hidden columns in Table's AutoGenerateColumn. The PR focuses on filter icon misalignment due to unsupported data types and does not explicitly address the column width dragging issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ArgoZhang ArgoZhang requested a review from Copilot June 25, 2025 01:16
@bb-auto bb-auto bot added the bug Something isn't working label Jun 25, 2025
@bb-auto bb-auto bot added this to the 9.7.0 milestone Jun 25, 2025
sourcery-ai[bot]
sourcery-ai bot previously approved these changes Jun 25, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ArgoZhang - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

This comment was marked as outdated.

@ArgoZhang
Copy link
Member Author

@sourcery-ai review

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (efa9089) to head (fccf630).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #6298   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          712       714    +2     
  Lines        31392     31411   +19     
  Branches      4437      4437           
=========================================
+ Hits         31392     31411   +19     
Flag Coverage Δ
BB 100.00% <100.00%> (?)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

sourcery-ai[bot]
sourcery-ai bot previously approved these changes Jun 25, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ArgoZhang - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang
Copy link
Member Author

@sourcery-ai review

@ArgoZhang ArgoZhang requested a review from Copilot June 25, 2025 02:10
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ArgoZhang - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `test/UnitTest/Components/TableNotSupportFilterTest.cs:19` </location>
<code_context>
+            pb.Add(a => a.Column, new MockColumn());
+        });
+
+        cut.Contains("不支持的类型,请使用 FilterTemplate 自定义过滤组件");
+
+        var filter = cut.FindComponent<NotSupportFilter>();
</code_context>

<issue_to_address>
Test is dependent on a hardcoded Chinese message.

Asserting a hardcoded localized string can make the test fragile if the message changes. Consider parameterizing the expected value or mocking localization to improve test robustness.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Fixes filter icon misalignment for unsupported data types by introducing a dedicated filter component and cleaning up legacy code.

  • Add NotSupportFilter component to centralize unsupported-type messaging
  • Update TableColumnFilter to use NotSupportFilter and remove redundant Localizer injection
  • Adjust Tab component tests and markup, and bump package version to 9.8.0-beta03

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/UnitTest/Components/TableNotSupportFilterTest.cs New test to verify NotSupportFilter is rendered and resets properly
test/UnitTest/Components/TabTest.cs Updated selectors to include .tabs-body-content-wrap
src/BootstrapBlazor/Components/Tab/Tab.razor.cs Simplified the d-none class condition
src/BootstrapBlazor/Components/Filters/TableColumnFilter.razor.cs Removed unused Localizer injection and OnParametersSet hook
src/BootstrapBlazor/Components/Filters/TableColumnFilter.razor Wrapped unsupported branch with NotSupportFilter
src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs Introduced new logic component for unsupported filters
src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor Added markup for displaying the unsupported message
src/BootstrapBlazor/BootstrapBlazor.csproj Bumped version to 9.8.0-beta03
Comments suppressed due to low confidence (3)

test/UnitTest/Components/TableNotSupportFilterTest.cs:30

  • Using [] to initialize a Dictionary<string, IFilterAction> is invalid. Consider using new Dictionary<string, IFilterAction>().
        public Dictionary<string, IFilterAction> Filters { get; set; } = [];

test/UnitTest/Components/TableNotSupportFilterTest.cs:34

  • Using [] to initialize a List<ITableColumn> is invalid. Replace with new List<ITableColumn>() or a valid collection expression.
        public List<ITableColumn> Columns => [];

src/BootstrapBlazor/Components/Filters/NotSupportFilter.razor.cs:26

  • Localizer is referenced but not injected in this component. Inject IStringLocalizer<NotSupportFilter> Localizer { get; set; } to avoid compilation errors.
        NotSupportedMessage ??= Localizer[nameof(NotSupportedMessage)];

@ArgoZhang ArgoZhang merged commit 2dc0cff into main Jun 25, 2025
5 checks passed
@ArgoZhang ArgoZhang deleted the fix-table-filter branch June 25, 2025 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(Table): 在AutoGenerateColumn中使用Filterable时,会出现错位

2 participants