Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Nov 7, 2025

Link issues

fixes #7071

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

Enable dynamic configuration and display of supported .NET target frameworks by adding a TargetFrameworks list and GetTargets method in WebsiteOptions, updating appsettings.json, and replacing hardcoded version strings in UI components.

New Features:

  • Introduce TargetFrameworks property in WebsiteOptions

Enhancements:

  • Implement GetTargets method to join configured target frameworks
  • Replace hardcoded .NET version lists in Razor components with dynamic GetTargets() calls
  • Add TargetFrameworks array to appsettings.json configuration

Chores:

  • Remove Cache-Control section from appsettings.json

Copilot AI review requested due to automatic review settings November 7, 2025 06:21
@bb-auto bb-auto bot added the documentation Improvements or additions to documentation label Nov 7, 2025
@bb-auto bb-auto bot added this to the 10.0.0 milestone Nov 7, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 7, 2025

Reviewer's Guide

This PR adds a configurable list of target frameworks via a new TargetFrameworks property and GetTargets method in WebsiteOptions, updates appsettings.json to populate that list, and replaces hard-coded framework version strings in Razor components with dynamic calls to GetTargets.

Entity relationship diagram for WebsiteOptions and TargetFrameworks

erDiagram
    WEBSITEOPTIONS {
        string ServerUrl
        string TargetFrameworks
        string Themes
    }
    TARGETFRAMEWORKS {
        string Name
    }
    WEBSITEOPTIONS ||--o{ TARGETFRAMEWORKS : contains
Loading

Class diagram for updated WebsiteOptions with TargetFrameworks and GetTargets

classDiagram
    class WebsiteOptions {
        +HashSet<ThemeOption> Themes
        +List<string> TargetFrameworks
        +WebsiteOptions()
        +string GetAssetUrl(string url)
        +string GetAvatarUrl(int id)
        +string GetTargets(string separator="/")
    }
Loading

File-Level Changes

Change Details Files
Introduce TargetFrameworks property and GetTargets method
  • Add List TargetFrameworks property with default empty list
  • Implement GetTargets(string separator) to join frameworks
src/BootstrapBlazor.Server/Data/WebsiteOptions.cs
Update appsettings.json to configure target frameworks
  • Add "TargetFrameworks" array with version entries
  • Remove obsolete Cache-Control section
src/BootstrapBlazor.Server/appsettings.json
Replace hard-coded framework versions in UI with GetTargets call
  • Update Samples/Reconnectors.razor to use @WebsiteOption.Value.GetTargets()
  • Inject dynamic targets in Index.razor support badge
  • Use GetTargets in BlazorReconnector.razor content
src/BootstrapBlazor.Server/Components/Samples/Reconnectors.razor
src/BootstrapBlazor.Server/Components/Pages/Index.razor
src/BootstrapBlazor.Server/Components/Components/BlazorReconnector.razor

Assessment against linked issues

Issue Objective Addressed Explanation
#7071 Add a GetTargets method to the WebsiteOptions class.
#7071 Update documentation and usages to utilize the new GetTargets method where appropriate.

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

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 there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `src/BootstrapBlazor.Server/Data/WebsiteOptions.cs:188` </location>
<code_context>
+    /// </summary>
+    /// <param name="separator"></param>
+    /// <returns></returns>
+    public string GetTargets(string separator = "/") => string.Join(separator, TargetFrameworks);
 }
</code_context>

<issue_to_address>
**issue (bug_risk):** Handle null or empty TargetFrameworks in GetTargets() to avoid runtime exceptions.

Use a null-coalescing operator or default to an empty array to prevent exceptions when TargetFrameworks is null.
</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

codecov bot commented Nov 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (5330eec) to head (17118bc).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7072   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          745       745           
  Lines        32556     32556           
  Branches      4512      4512           
=========================================
  Hits         32556     32556           
Flag Coverage Δ
BB 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.

@ArgoZhang ArgoZhang merged commit 124a677 into main Nov 7, 2025
11 checks passed
@ArgoZhang ArgoZhang deleted the doc-version branch November 7, 2025 06:24
Copy link
Contributor

Copilot AI left a 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 handling of supported .NET framework versions by moving them from hardcoded strings in locale files to a configurable list in appsettings.json. The change centralizes framework version management and makes it easier to maintain and update.

  • Adds a TargetFrameworks configuration property and a GetTargets() helper method to dynamically generate the supported frameworks string
  • Updates locale files to simplify the "Support" translation key by removing hardcoded framework versions
  • Replaces all hardcoded framework version strings (e.g., "NET6/NET7/NET8/NET9/NET10") across Razor components with dynamic calls to GetTargets()

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/BootstrapBlazor.Server/appsettings.json Adds TargetFrameworks array configuration with supported .NET versions; removes unused Cache-Control section; removes BOM character
src/BootstrapBlazor.Server/Locales/zh-CN.json Simplifies Chinese "Support" translation by removing hardcoded framework versions; removes BOM character
src/BootstrapBlazor.Server/Locales/en-US.json Simplifies English "Support" translation by removing hardcoded framework versions; removes BOM character
src/BootstrapBlazor.Server/Data/WebsiteOptions.cs Adds TargetFrameworks property and GetTargets() method to support dynamic framework version display; removes BOM character
src/BootstrapBlazor.Server/Components/Samples/Reconnectors.razor Updates all reconnector examples to use dynamic framework versions via GetTargets(); removes BOM character
src/BootstrapBlazor.Server/Components/Pages/Index.razor Updates homepage to display dynamic framework versions; removes rel="noopener" attribute; removes BOM character
src/BootstrapBlazor.Server/Components/Components/BlazorReconnector.razor Updates reconnector component to use dynamic framework versions; removes BOM character

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<div class="container-xxl bd-gutter">
<div class="text-center d-flex align-items-center flex-column">
<a class="d-inline-flex text-dark text-decoration-none" href="@WebsiteOption.Value.GithubRepositoryUrl" rel="noopener" target="_blank">
<a class="d-inline-flex text-dark text-decoration-none" href="@WebsiteOption.Value.GithubRepositoryUrl" target="_blank">
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rel="noopener" attribute should not be removed when using target="_blank". This attribute prevents the opened page from accessing the window.opener object, which is a security best practice to prevent potential tabnabbing attacks.

Suggested change
<a class="d-inline-flex text-dark text-decoration-none" href="@WebsiteOption.Value.GithubRepositoryUrl" target="_blank">
<a class="d-inline-flex text-dark text-decoration-none" href="@WebsiteOption.Value.GithubRepositoryUrl" target="_blank" rel="noopener">

Copilot uses AI. Check for mistakes.
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(WebsiteOptions): add GetTargets method

2 participants