Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Nov 3, 2024

add DisableDelete/EditButtonCallback Parameter

Summary of the changes (Less than 80 chars)

简单描述你更改了什么, 不超过80个字符;如果有关联 Issue 请在下方填写相关编号

Description

fixes #4602

Regression?

  • Yes
  • No

[If yes, specify the version the behavior has regressed from]

[是否影响老版本]

Risk

  • High
  • Medium
  • Low

[Justify the selection above]

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 new parameters to the Table component to allow conditional disabling of delete and edit buttons, update the Dockerfile to use .NET 9.0, and include tests for the new functionality.

New Features:

  • Introduce DisableDeleteButtonCallback and DisableEditButtonCallback parameters to conditionally disable delete and edit buttons in the Table component.

Enhancements:

  • Update the logic for determining the disabled status of edit and delete buttons to incorporate the new callback parameters.

Build:

  • Upgrade Dockerfile base and build images from .NET 8.0 to .NET 9.0.

Tests:

  • Add unit tests to verify the functionality of the DisableDeleteButtonCallback and DisableEditButtonCallback parameters.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 3, 2024

Reviewer's Guide by Sourcery

This PR adds new callback parameters to the Table component that allow conditional disabling of Edit and Delete buttons. The implementation includes new parameters in the Table component and corresponding unit tests to verify the functionality. The changes also include an update to the Docker configuration to use .NET 9.0.

Sequence diagram for DisableEditButtonCallback

sequenceDiagram
    actor User
    participant Table
    participant Button
    User->>Table: Select a row
    Table->>Button: Check DisableEditButtonCallback
    alt Callback returns true
        Button->>User: Edit button is disabled
    else Callback returns false
        Button->>User: Edit button is enabled
    end
Loading

Sequence diagram for DisableDeleteButtonCallback

sequenceDiagram
    actor User
    participant Table
    participant Button
    User->>Table: Select a row
    Table->>Button: Check DisableDeleteButtonCallback
    alt Callback returns true
        Button->>User: Delete button is disabled
    else Callback returns false
        Button->>User: Delete button is enabled
    end
Loading

Class diagram for updated Table component

classDiagram
    class Table {
        +Func<List<TItem>, bool> DisableDeleteButtonCallback
        +Func<List<TItem>, bool> DisableEditButtonCallback
        +bool GetEditButtonStatus()
        +bool GetDeleteButtonStatus()
    }
    note for Table "New callback parameters added for disabling buttons conditionally"
Loading

File-Level Changes

Change Details Files
Added new callback parameters for controlling Edit and Delete button states
  • Added DisableDeleteButtonCallback parameter to control delete button disabled state
  • Added DisableEditButtonCallback parameter to control edit button disabled state
  • Modified GetEditButtonStatus and GetDeleteButtonStatus methods to use the new callbacks
  • Added XML documentation for the new parameters
src/BootstrapBlazor/Components/Table/Table.razor.cs
Added comprehensive unit tests for the new callback functionality
  • Added test case for DisableEditButtonCallback verification
  • Added test case for DisableDeleteButtonCallback verification
  • Verified button states with and without callbacks
test/UnitTest/Components/TableTest.cs
Updated Docker configuration to use .NET 9.0
  • Changed base image from .NET 8.0 to 9.0 for both runtime and SDK
src/BootstrapBlazor.Server/Dockerfile

Assessment against linked issues

Issue Objective Addressed Explanation
#4602 Add callback functionality to control the disabled state of the delete button in Table component

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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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 Nov 3, 2024
@bb-auto bb-auto bot added this to the v9.0.0 milestone Nov 3, 2024
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 - here's some feedback:

Overall Comments:

  • Please separate the .NET 9.0 upgrade in Dockerfile into a separate PR. Infrastructure changes should be reviewed independently from feature changes.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟡 Testing: 3 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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

codecov bot commented Nov 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (e832302) to head (a82456f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #4603   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          620       620           
  Lines        27365     27367    +2     
  Branches      3914      3914           
=========================================
+ Hits         27365     27367    +2     

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

@ArgoZhang ArgoZhang merged commit a802e1a into main Nov 3, 2024
5 checks passed
@ArgoZhang ArgoZhang deleted the fix-table branch November 3, 2024 12:34
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(Table): 删除按钮禁用增加回调功能 Delete button disabled to add callback

2 participants