Skip to content

feat(CardUpload): add ShowFileSize parameter#7370

Merged
ArgoZhang merged 8 commits intomainfrom
momiji/card-upload-file-size-hide
Dec 19, 2025
Merged

feat(CardUpload): add ShowFileSize parameter#7370
ArgoZhang merged 8 commits intomainfrom
momiji/card-upload-file-size-hide

Conversation

@momijijin
Copy link
Copy Markdown
Collaborator

@momijijin momijijin commented Dec 18, 2025

Link issues

fixes #7369

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

Add a configurable option on the CardUpload component to control whether uploaded file sizes are displayed.

New Features:

  • Introduce a ShowFileSize parameter on CardUpload to toggle display of uploaded file sizes.

Tests:

  • Extend CardUpload unit tests to cover the ShowFileSize configuration.

@bb-auto
Copy link
Copy Markdown

bb-auto Bot commented Dec 18, 2025

Thanks for your PR, @momijijin. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Dec 18, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a configurable ShowFileSize parameter to the CardUpload component to allow toggling display of file sizes in the UI, and updates markup and tests accordingly.

Updated class diagram for CardUpload with ShowFileSize parameter

classDiagram
  class CardUpload_TValue_ {
    +RenderFragment_UploadFile_ ActionButtonTemplate
    +bool ShowFileSize
  }
Loading

File-Level Changes

Change Details Files
Introduce a ShowFileSize parameter on CardUpload and use it to conditionally render file size text in the upload item listing.
  • Add a new bool ShowFileSize parameter with default value true on the CardUpload component backing class.
  • Update the file entry markup to wrap the size display in a conditional expression based on ShowFileSize, omitting the size text when disabled.
src/BootstrapBlazor/Components/Upload/CardUpload.razor.cs
src/BootstrapBlazor/Components/Upload/CardUpload.razor
Extend unit tests to cover scenarios where file size display is disabled.
  • Update the CardUpload_Ok unit test configuration to set ShowFileSize to false and validate behavior under this configuration.
test/UnitTest/Components/UploadCardTest.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#7369 Add a parameter to the CardUpload component that allows controlling whether the uploaded file size information is displayed (default to showing the size).

Possibly linked issues


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

@bb-auto bb-auto Bot added the enhancement New feature or request label Dec 18, 2025
@bb-auto bb-auto Bot requested a review from ArgoZhang December 18, 2025 13:04
@bb-auto bb-auto Bot added this to the v10.1.0 milestone Dec 18, 2025
sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Dec 18, 2025
Copy link
Copy Markdown
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 there - I've reviewed your changes - here's some feedback:

  • Currently the space before the size is always rendered even when ShowFileSize is false; you may want to move the space inside the conditional expression so the layout doesn’t include an extra trailing space when file size is hidden.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Currently the space before the size is always rendered even when `ShowFileSize` is false; you may want to move the space inside the conditional expression so the layout doesn’t include an extra trailing space when file size is hidden.

## Individual Comments

### Comment 1
<location> `test/UnitTest/Components/UploadCardTest.cs:21` </location>
<code_context>
         {
             pb.Add(a => a.ShowZoomButton, true);
             pb.Add(a => a.ShowDeleteButton, true);
+            pb.Add(a => a.ShowFileSize, false);
             pb.Add(a => a.OnDelete, file =>
             {
</code_context>

<issue_to_address>
**issue (testing):** The new `ShowFileSize` parameter is set in the test but its behavior is not asserted.

`ShowFileSize` is only set to `false` in `CardUpload_Ok`, but the test doesn’t assert any resulting behavior (e.g., that the file-size element is hidden). Please extend this test or add a new one to assert the rendered DOM for both `ShowFileSize = true` and `ShowFileSize = false`, verifying that the file-size element is present by default and absent when disabled.
</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.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9acaf8f) to head (5f82f81).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7370   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          747       747           
  Lines        32760     32765    +5     
  Branches      4540      4541    +1     
=========================================
+ Hits         32760     32765    +5     
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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

ArgoZhang
ArgoZhang previously approved these changes Dec 18, 2025
@ArgoZhang ArgoZhang changed the title feat(CardUpload): Add ShowFileSize feat(CardUpload): add ShowFileSize parameter Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(CardUpload): 增加 ShowFileSize 参数控制是否显示文件大小

2 participants