-
-
Notifications
You must be signed in to change notification settings - Fork 363
refactor(Table): update logic for IgnoreWhenExport parameter #6018
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
Conversation
Reviewer's GuideThis PR refactors the table export logic by introducing a new GetExportColumns method that respects the IgnoreWhenExport flag, updates all export routines to use it, removes the obsolete GetIgnoreExport extension, enhances unit tests to validate the new behavior, and bumps the package version. Sequence Diagram: Table Export Column ProcessingsequenceDiagram
participant ExportHandler as "Table Export Handler (e.g., ExportExcelAsync)"
participant GEC as "GetExportColumns()"
participant GVC as "GetVisibleColumns()"
participant Column as "ITableColumn"
participant ExportUtil as "TableExport Utility"
ExportHandler->>GEC: Request export columns
GEC->>GVC: Get base visible columns
GVC-->>GEC: list_of_visible_columns
GEC->>GEC: Iterate list_of_visible_columns
loop For each column in list_of_visible_columns
GEC->>Column: Check IgnoreWhenExport property
Column-->>GEC: IgnoreWhenExport_status
alt IgnoreWhenExport is not true
GEC->>GEC: Add column to final_export_columns
end
end
GEC-->>ExportHandler: final_export_columns
ExportHandler->>ExportUtil: PerformExport(data, final_export_columns)
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the table export logic to respect the IgnoreWhenExport flag, removes an obsolete extension method, updates related unit tests, and bumps the project version.
- Introduced
GetExportColumnsto filter out columns markedIgnoreWhenExportin all export methods. - Removed the unused
GetIgnoreExportextension. - Enhanced the
ExportAsync_Oktest to assert that ignored columns are excluded; redundant test removed. - Bumped version to
9.6.2-beta05.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/UnitTest/Components/TableTest.cs | Updated ExportAsync_Ok to include an ignored column, capture export context, add assertions, and removed the old redundant test. |
| src/BootstrapBlazor/Extensions/ITableColumnExtensions.cs | Deleted the obsolete GetIgnoreExport method. |
| src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs | Switched exports to use GetExportColumns, cleaned up GetVisibleColumns, and added the new filtering method. |
| src/BootstrapBlazor/BootstrapBlazor.csproj | Incremented package version to 9.6.2-beta05. |
Comments suppressed due to low confidence (1)
test/UnitTest/Components/TableTest.cs:7040
- The test only covers the default export type; consider adding similar tests for Csv, Pdf, and Excel exports to ensure the new filtering logic applies across all export methods.
Assert.NotNull(exportContext);
| /// <summary> | ||
| /// Gets the export column collection. | ||
| /// </summary> | ||
| /// <returns></returns> |
Copilot
AI
May 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The XML doc tag is empty; please provide a meaningful description of the returned List to improve API documentation.
| /// <returns></returns> | |
| /// <returns>A list of <see cref="ITableColumn"/> objects representing the columns to be included in the export. | |
| /// Columns marked with <c>IgnoreWhenExport</c> are excluded.</returns> |
| // 可见列为 2 列 | ||
| var columns = table.Instance.GetVisibleColumns(); | ||
| Assert.Equal(2, columns.Count()); | ||
|
|
||
| // 由于设置了 IgnoreWhenExport 为 true 所以导出时不包含 Address 列 |
Copilot
AI
May 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Inline comments should be in English for consistency; consider translating this comment to English.
| // 可见列为 2 列 | |
| var columns = table.Instance.GetVisibleColumns(); | |
| Assert.Equal(2, columns.Count()); | |
| // 由于设置了 IgnoreWhenExport 为 true 所以导出时不包含 Address 列 | |
| // The visible columns are 2 | |
| var columns = table.Instance.GetVisibleColumns(); | |
| Assert.Equal(2, columns.Count()); | |
| // Since IgnoreWhenExport is set to true, the Address column is not included during export |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6018 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 670 670
Lines 30657 30657
Branches 4363 4364 +1
=========================================
Hits 30657 30657 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Link issues
fixes #6009
Summary By Copilot
This pull request introduces changes to enhance table export functionality in the
BootstrapBlazorlibrary, including the addition of a new method to filter export columns, removal of unused code, and updates to unit tests. The changes focus on improving the handling of export-related logic and ensuring proper test coverage.Enhancements to Table Export Functionality:
GetExportColumnsmethod to filter columns for export by excluding those marked withIgnoreWhenExport. This ensures only relevant columns are included during export operations. ([src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.csL1186-R1205](https://github.com/dotnetcore/BootstrapBlazor/pull/6018/files#diff-ca9e82d70b95de7204b56fbdace327d330eaef6777601f3d897b0e07c8c3eff8L1186-R1205))ExportAsync,ExportCsvAsync,ExportPdfAsync,ExportExcelAsync) to use the newGetExportColumnsmethod instead ofGetVisibleColumns. ([src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.csL1186-R1205](https://github.com/dotnetcore/BootstrapBlazor/pull/6018/files#diff-ca9e82d70b95de7204b56fbdace327d330eaef6777601f3d897b0e07c8c3eff8L1186-R1205))Code Simplification:
GetIgnoreExportmethod fromITableColumnExtensions, as its functionality is now integrated intoGetExportColumns. ([src/BootstrapBlazor/Extensions/ITableColumnExtensions.csL347-L348](https://github.com/dotnetcore/BootstrapBlazor/pull/6018/files#diff-6bf3ad236565623debfb28c7c18a2a21bdd089aa294538b56491d5db7dd5a2f5L347-L348))Unit Test Updates:
ExportAsync_Oktest to verify that columns marked withIgnoreWhenExportare excluded during export. Added assertions to validate the behavior of theGetExportColumnsmethod. ([[1]](https://github.com/dotnetcore/BootstrapBlazor/pull/6018/files#diff-3546a7a8520a1cc0576ca6a1077d468561e7b825b061c3d1aac2daae7a62a160R6996-R7001),[[2]](https://github.com/dotnetcore/BootstrapBlazor/pull/6018/files#diff-3546a7a8520a1cc0576ca6a1077d468561e7b825b061c3d1aac2daae7a62a160R7016-R7029),[[3]](https://github.com/dotnetcore/BootstrapBlazor/pull/6018/files#diff-3546a7a8520a1cc0576ca6a1077d468561e7b825b061c3d1aac2daae7a62a160R7040-R7042))IgnoreWhenExport_Oktest, as its logic is now covered in the updatedExportAsync_Oktest. ([test/UnitTest/Components/TableTest.csL8211-L8241](https://github.com/dotnetcore/BootstrapBlazor/pull/6018/files#diff-3546a7a8520a1cc0576ca6a1077d468561e7b825b061c3d1aac2daae7a62a160L8211-L8241))Version Update:
9.6.2-beta04to9.6.2-beta05in theBootstrapBlazor.csprojfile. ([src/BootstrapBlazor/BootstrapBlazor.csprojL4-R4](https://github.com/dotnetcore/BootstrapBlazor/pull/6018/files#diff-07918ce1b66955e76da5cd0ffa38512cce984fa2a09735a60e0db37b45235527L4-R4))Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Introduce IgnoreWhenExport-based filtering for table exports and refactor related logic
Enhancements:
Build:
Tests: