feat(Dialog): add Show<TComponent> extension method#5983
Conversation
Reviewer's GuideThis pull request enhances the Sequence Diagram: Dialog Creation with Show Extension MethodsequenceDiagram
participant C as Client
participant DSE as DialogServiceExtensions
participant DO as DialogOption
participant BDC as BootstrapDynamicComponent
participant DS as DialogService
C->>DSE: Call Show<TComponent>(title, parameters, dialog) on DialogService instance
activate DSE
DSE->>DO: new DialogOption()
activate DO
DO-->>DSE: option
deactivate DO
DSE->>DO: option.Title = title
DSE->>DO: option.ShowFooter = false
DSE->>BDC: CreateComponent<TComponent>(parameters)
activate BDC
BDC-->>DSE: component
deactivate BDC
DSE->>DO: option.Component = component
DSE->>DS: Show(option, dialog)
activate DS
DS-->>DSE: Task
deactivate DS
DSE-->>C: Task
deactivate DSE
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds a generic Show extension method to DialogService to streamline dialog creation with a specified component and title, along with accompanying unit tests.
- Introduces the Show extension method in DialogServiceExtensions.cs
- Adds new unit tests in DialogTest.cs to validate the method’s behavior
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/UnitTest/Components/DialogTest.cs | Adds test cases for the new extension method |
| src/BootstrapBlazor/Extensions/DialogServiceExtensions.cs | Implements the Show extension method with dialog option settings |
Comments suppressed due to low confidence (1)
test/UnitTest/Components/DialogTest.cs:578
- [nitpick] Consider adding assertions after the Show call to verify that the dialog displays the correct title, enhancing the test coverage of this new functionality.
await cut.InvokeAsync(() => dialog.Show<MockValidateFormDialog>("Test Title"));
There was a problem hiding this comment.
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: all looks good
- 🟢 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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5983 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 670 670
Lines 30606 30616 +10
Branches 4352 4353 +1
=========================================
+ Hits 30606 30616 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: WarriorBlue <15247822+warriorblue@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new generic extension method, Show, to the DialogService to simplify dialog creation, along with unit tests validating its behavior.
- Introduces the Show extension method in DialogServiceExtensions.cs.
- Adds unit tests in DialogTest.cs to verify the new method.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/UnitTest/Components/DialogTest.cs | Adds tests invoking the new Show extension method. |
| src/BootstrapBlazor/Extensions/DialogServiceExtensions.cs | Implements the new Show method with updated doc comments. |
Files not reviewed (1)
- src/BootstrapBlazor/BootstrapBlazor.csproj: Language not supported
|
@sourcery-ai review |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new generic extension method Show for the DialogService to simplify displaying dialogs with a specified component and title, along with added unit tests verifying its behavior.
- Added Show extension method in DialogServiceExtensions.cs to configure and display dialogs.
- Created unit tests in DialogTest.cs to ensure the new extension method triggers dialog display and closure correctly.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/UnitTest/Components/DialogTest.cs | Added tests under "Show Extensions Method" region to verify the new extension method. |
| src/BootstrapBlazor/Extensions/DialogServiceExtensions.cs | Introduced the Show extension method with proper configuration of dialog options. |
Files not reviewed (1)
- src/BootstrapBlazor/BootstrapBlazor.csproj: Language not supported
Comments suppressed due to low confidence (1)
src/BootstrapBlazor/Extensions/DialogServiceExtensions.cs:30
- [nitpick] Review that the BootstrapDynamicComponent.CreateComponent method properly applies the provided parameters to the component; ensuring its behavior is consistent with dialog initializations elsewhere.
option.Component = BootstrapDynamicComponent.CreateComponent<TComponent>(parameters);
There was a problem hiding this comment.
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: all looks good
- 🟢 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 #5982
Summary By Copilot
This pull request introduces a new extension method for the
DialogServiceclass to simplify showing dialogs with a specified component and title. Additionally, corresponding unit tests have been added to ensure the new functionality works as expected.New Feature: DialogService Extension Method
Show<TComponent>extension method to theDialogServiceclass inDialogServiceExtensions.cs. This method allows displaying a dialog with a specified component (TComponent), title, and optional parameters, streamlining dialog creation.Unit Tests for New Method
DialogTest.csto verify the functionality of the newShow<TComponent>method, including invoking the dialog with a title and ensuring correct behavior during dialog closure.Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add a generic
Show<TComponent>extension method to the DialogService to simplify dialog creation with a specified component and titleNew Features:
Show<TComponent>extension method for DialogService that allows displaying a dialog with a specified component and titleTests:
Show<TComponent>extension method to verify its functionality