-
-
Notifications
You must be signed in to change notification settings - Fork 362
doc(WebsiteOptions): add GetTargets method #7072
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
Conversation
Reviewer's GuideThis 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 TargetFrameworkserDiagram
WEBSITEOPTIONS {
string ServerUrl
string TargetFrameworks
string Themes
}
TARGETFRAMEWORKS {
string Name
}
WEBSITEOPTIONS ||--o{ TARGETFRAMEWORKS : contains
Class diagram for updated WebsiteOptions with TargetFrameworks and GetTargetsclassDiagram
class WebsiteOptions {
+HashSet<ThemeOption> Themes
+List<string> TargetFrameworks
+WebsiteOptions()
+string GetAssetUrl(string url)
+string GetAvatarUrl(int id)
+string GetTargets(string separator="/")
}
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.
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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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
TargetFrameworksconfiguration property and aGetTargets()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"> |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
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.
| <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"> |
Link issues
fixes #7071
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
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:
Enhancements:
Chores: