Skip to content
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

doc(Auto): update Auto mode #4785

Merged
merged 26 commits into from
Dec 4, 2024
Merged

doc(Auto): update Auto mode #4785

merged 26 commits into from
Dec 4, 2024

Conversation

ArgoZhang
Copy link
Collaborator

@ArgoZhang ArgoZhang commented Dec 4, 2024

update Auto mode

Summary of the changes (Less than 80 chars)

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

Description

fixes #4784

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

Refactor the service registration process and update the culture management logic in the CultureChooser component. Introduce a new project structure for BootstrapBlazorAuto with interactive server and web assembly components. Simplify configuration by removing unused options and update documentation for Auto mode.

New Features:

  • Introduce a new project structure for BootstrapBlazorAuto, including client and server components, with interactive server and web assembly components.

Enhancements:

  • Refactor service registration by consolidating service additions into a single method, removing redundant service methods.
  • Update culture setting logic in CultureChooser component to improve culture management and navigation.

Build:

  • Remove unused configuration options from appsettings.Development.json, simplifying the configuration.

Documentation:

  • Update documentation to reflect changes in the Auto mode.

# Conflicts:
#	src/BootstrapBlazor.Server/Extensions/ServiceCollectionExtensions.cs
#	src/BootstrapBlazor.Shared/BootstrapBlazor.Shared.csproj
#	src/BootstrapBlazor.Shared/Extensions/ServicesCollectionExtensions.cs
@bb-auto bb-auto bot added the documentation Improvements or additions to documentation label Dec 4, 2024
@bb-auto bb-auto bot added this to the v9.0.0 milestone Dec 4, 2024
Copy link

sourcery-ai bot commented Dec 4, 2024

Reviewer's Guide by Sourcery

This PR introduces a new BootstrapBlazorAuto project with both client and server components, while refactoring the middleware configuration and service registration. The changes focus on improving the architecture by consolidating services, updating culture handling, and streamlining the middleware pipeline.

Class diagram for updated service registration

classDiagram
    class ServicesCollectionExtensions {
        +AddBootstrapBlazorServices()
        +AddOptionsMonitor()
        +AddCascadingAuthenticationState()
        +AddBootstrapBlazorMeiliSearch()
    }
    class IServiceCollection {
        <<interface>>
    }
    ServicesCollectionExtensions --> IServiceCollection
    class WeatherForecastService
    class PackageVersionService
    class CodeSnippetService
    class DashboardService
    class IDataService~T~
    class TableDemoDataService~T~
    class ILookupService
    class DemoLookupService
    class MockDataTableDynamicService
    class MenuService
    class FanControllerDataService
    class AuthenticationStateProvider
    class MockAuthenticationStateProvider

    IServiceCollection <|-- WeatherForecastService
    IServiceCollection <|-- PackageVersionService
    IServiceCollection <|-- CodeSnippetService
    IServiceCollection <|-- DashboardService
    IServiceCollection <|-- IDataService
    IServiceCollection <|-- ILookupService
    IServiceCollection <|-- MockDataTableDynamicService
    IServiceCollection <|-- MenuService
    IServiceCollection <|-- FanControllerDataService
    IServiceCollection <|-- AuthenticationStateProvider
    AuthenticationStateProvider <|-- MockAuthenticationStateProvider
Loading

Class diagram for CultureChooser component

classDiagram
    class CultureChooser {
        -IJSRuntime JSRuntime
        -string SelectedCulture
        -string Label
        +SetCulture(SelectedItem item)
        +GetDisplayName(CultureInfo culture)
    }
    class IJSRuntime
    class SelectedItem
    class CultureInfo

    CultureChooser --> IJSRuntime
    CultureChooser --> SelectedItem
    CultureChooser --> CultureInfo
Loading

File-Level Changes

Change Details Files
Introduced a new BootstrapBlazorAuto project with client-server architecture
  • Added new App.razor component with interactive auto rendering mode
  • Created client-side Program.cs with WebAssembly configuration
  • Set up server-side Program.cs with hybrid rendering support
  • Added necessary project structure and configuration files
src/BootstrapBlazorAuto/BootstrapBlazorAuto/Components/App.razor
src/BootstrapBlazorAuto/BootstrapBlazorAuto.Client/Program.cs
src/BootstrapBlazorAuto/BootstrapBlazorAuto/Program.cs
Refactored service registration and middleware configuration
  • Consolidated WebSiteServices into AddBootstrapBlazorServices method
  • Updated middleware ordering for better consistency
  • Removed conditional compilation for static files
  • Simplified service registration in Program.cs
src/BootstrapBlazor.Server/Program.cs
src/BootstrapBlazor.Server/Extensions/ServiceCollectionExtensions.cs
src/BootstrapBlazor.Shared/Extensions/ServicesCollectionExtensions.cs
Updated culture handling and configuration
  • Refactored culture selection logic between server and client modes
  • Added client-side culture persistence using localStorage
  • Updated culture display name handling
src/BootstrapBlazor.Shared/Components/Components/CultureChooser.razor.cs
Cleaned up configuration and removed unused settings
  • Removed unused authentication settings
  • Simplified CORS configuration
  • Removed SassCompiler settings
src/BootstrapBlazor.Server/appsettings.Development.json
src/BootstrapBlazor.Server/appsettings.json

Assessment against linked issues

Issue Objective Addressed Explanation
#4784 Add sample code for Auto mode

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

Copy link

@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 found some issues that need to be addressed.

Blocking issues:

  • Consider setting a reasonable maximum size limit for SignalR messages (link)

Overall Comments:

  • Consider using the minified version of Bootstrap CSS (bootstrap.min.css) instead of the full version to reduce the download size for clients.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🔴 Security: 1 blocking issue
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 2 issues found
  • 🟢 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.

Copy link

codecov bot commented Dec 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (05adf6f) to head (fd0aeff).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #4785   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          620       620           
  Lines        27424     27424           
  Branches      3925      3925           
=========================================
  Hits         27424     27424           

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

@ArgoZhang
Copy link
Collaborator Author

@sourcery-ai review

sourcery-ai[bot]
sourcery-ai bot previously approved these changes Dec 4, 2024
Copy link

@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:

  • Consider keeping the more specific namespaces (e.g. BootstrapBlazor.Server.Controllers) to avoid potential conflicts
  • Some previously configurable values are now hardcoded (e.g. HubOptions.MaximumReceiveMessageSize). Consider keeping these configurable through options
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 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.

src/BootstrapBlazor.Server/Program.cs Show resolved Hide resolved
@ArgoZhang ArgoZhang merged commit 27d61ba into main Dec 4, 2024
3 checks passed
@ArgoZhang ArgoZhang deleted the dev-auto-mode branch December 4, 2024 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doc(Auto): update Auto mode
1 participant