Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Client/Modules/FileHub/Category.razor
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
@namespace ICTAce.FileHub
@inherits ModuleBase

<h3>Categories</h3>

<RadzenTheme Theme="material" />
<RadzenComponents />

<h3>Categories</h3>

@if (IsLoading)
{
<p><em>Loading...</em></p>
Expand Down
510 changes: 510 additions & 0 deletions Client/Modules/FileHub/RadzenThemeChanger.razor

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions Client/Modules/FileHub/RadzenThemeChanger.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// Licensed to ICTAce under the MIT license.

namespace ICTAce.FileHub;

public partial class RadzenThemeChanger
{
[Inject]
protected ISettingService SettingService { get; set; } = default!;

[Inject]
private Radzen.ThemeService ThemeService { get; set; } = default!;

private string RadzenTheme { get; set; } = "default";

// Preview component state
private bool _switchValue = true;
private int _radioValue = 1;
private int _sliderValue = 50;
private int _stepsIndex = 1;
private int _ratingValue = 4;
private double _gaugeValue = 72;

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity Note

Field '_gaugeValue' can be 'readonly'.

Copilot Autofix

AI 15 days ago

To fix the issue, we should add the readonly modifier to _gaugeValue, since in the provided code it is only assigned at declaration and never modified later. This preserves existing behavior while making the class more robust against accidental future modifications.

Concretely, in Client/Modules/FileHub/RadzenThemeChanger.razor.cs, change the field declaration on line 21 from private double _gaugeValue = 72; to private readonly double _gaugeValue = 72;. No additional methods, imports, or other definitions are required for this change.

Suggested changeset 1
Client/Modules/FileHub/RadzenThemeChanger.razor.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/Client/Modules/FileHub/RadzenThemeChanger.razor.cs b/Client/Modules/FileHub/RadzenThemeChanger.razor.cs
--- a/Client/Modules/FileHub/RadzenThemeChanger.razor.cs
+++ b/Client/Modules/FileHub/RadzenThemeChanger.razor.cs
@@ -18,7 +18,7 @@
     private int _sliderValue = 50;
     private int _stepsIndex = 1;
     private int _ratingValue = 4;
-    private double _gaugeValue = 72;
+    private readonly double _gaugeValue = 72;
     private bool _toggleValue = true;
 
     // Sample data for DataGrid
EOF
@@ -18,7 +18,7 @@
private int _sliderValue = 50;
private int _stepsIndex = 1;
private int _ratingValue = 4;
private double _gaugeValue = 72;
private readonly double _gaugeValue = 72;
private bool _toggleValue = true;

// Sample data for DataGrid
Copilot is powered by AI and may make mistakes. Always verify output.
private bool _toggleValue = true;

// Sample data for DataGrid
private List<SampleData> _sampleData =

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity Note

Field '_sampleData' can be 'readonly'.

Copilot Autofix

AI 15 days ago

In general, to fix this kind of issue you add the readonly modifier to any field that is only ever assigned during declaration or in a constructor of the same class. This ensures the field cannot be accidentally reassigned later, improving safety without affecting existing logic that just reads from it or mutates the object it references.

For this specific case, the best fix is to mark the _sampleData field as readonly. The field is declared and initialized on lines 25–35 and never reassigned elsewhere in the shown code. Adding readonly will prevent future reassignments of _sampleData while still allowing operations that modify the contents of the List<SampleData> (if any are added later). No additional methods, imports, or definitions are required; only the field declaration line needs to be updated in Client/Modules/FileHub/RadzenThemeChanger.razor.cs.

Suggested changeset 1
Client/Modules/FileHub/RadzenThemeChanger.razor.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/Client/Modules/FileHub/RadzenThemeChanger.razor.cs b/Client/Modules/FileHub/RadzenThemeChanger.razor.cs
--- a/Client/Modules/FileHub/RadzenThemeChanger.razor.cs
+++ b/Client/Modules/FileHub/RadzenThemeChanger.razor.cs
@@ -22,7 +22,7 @@
     private bool _toggleValue = true;
 
     // Sample data for DataGrid
-    private List<SampleData> _sampleData =
+    private readonly List<SampleData> _sampleData =
     [
         new(1, "Product A", "Electronics", 299.99m, DateTime.Now.AddDays(-5), true),
         new(2, "Product B", "Clothing", 49.99m, DateTime.Now.AddDays(-3), true),
EOF
@@ -22,7 +22,7 @@
private bool _toggleValue = true;

// Sample data for DataGrid
private List<SampleData> _sampleData =
private readonly List<SampleData> _sampleData =
[
new(1, "Product A", "Electronics", 299.99m, DateTime.Now.AddDays(-5), true),
new(2, "Product B", "Clothing", 49.99m, DateTime.Now.AddDays(-3), true),
Copilot is powered by AI and may make mistakes. Always verify output.
[
new(1, "Product A", "Electronics", 299.99m, DateTime.Now.AddDays(-5), true),
new(2, "Product B", "Clothing", 49.99m, DateTime.Now.AddDays(-3), true),
new(3, "Product C", "Electronics", 199.99m, DateTime.Now.AddDays(-1), false),
new(4, "Product D", "Home", 89.99m, DateTime.Now.AddDays(-7), true),
new(5, "Product E", "Clothing", 29.99m, DateTime.Now.AddDays(-2), true),
new(6, "Product F", "Home", 149.99m, DateTime.Now.AddDays(-10), false),
new(7, "Product G", "Electronics", 599.99m, DateTime.Now.AddDays(-4), true),
new(8, "Product H", "Clothing", 79.99m, DateTime.Now.AddDays(-6), true),
];

private record SampleData(int Id, string Name, string Category, decimal Price, DateTime Date, bool IsActive);

Check warning on line 37 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Build and Analyze

Private record classes which are not derived in the current assembly should be marked as 'sealed'. (https://rules.sonarsource.com/csharp/RSPEC-3260)

Check warning on line 37 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Client Component Tests (bUnit)

Private record classes which are not derived in the current assembly should be marked as 'sealed'. (https://rules.sonarsource.com/csharp/RSPEC-3260)

Check warning on line 37 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Server Unit Tests (TUnit)

Private record classes which are not derived in the current assembly should be marked as 'sealed'. (https://rules.sonarsource.com/csharp/RSPEC-3260)

Check warning on line 37 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Private record classes which are not derived in the current assembly should be marked as 'sealed'. (https://rules.sonarsource.com/csharp/RSPEC-3260)

Check warning on line 37 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Private record classes which are not derived in the current assembly should be marked as 'sealed'. (https://rules.sonarsource.com/csharp/RSPEC-3260)

private record ThemeOption(

Check warning on line 39 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Build and Analyze

Private record classes which are not derived in the current assembly should be marked as 'sealed'. (https://rules.sonarsource.com/csharp/RSPEC-3260)

Check warning on line 39 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Client Component Tests (bUnit)

Private record classes which are not derived in the current assembly should be marked as 'sealed'. (https://rules.sonarsource.com/csharp/RSPEC-3260)

Check warning on line 39 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Server Unit Tests (TUnit)

Private record classes which are not derived in the current assembly should be marked as 'sealed'. (https://rules.sonarsource.com/csharp/RSPEC-3260)

Check warning on line 39 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Private record classes which are not derived in the current assembly should be marked as 'sealed'. (https://rules.sonarsource.com/csharp/RSPEC-3260)

Check warning on line 39 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Private record classes which are not derived in the current assembly should be marked as 'sealed'. (https://rules.sonarsource.com/csharp/RSPEC-3260)
string Name,
string Value,
string Background,
string Card,
string Primary,
string Accent,
string Text,
string ChartColor1,
string ChartColor2,
string ChartColor3,
string BorderRadius);

private List<ThemeOption> AvailableThemes { get; } =
[
new("Default", "default", "#f5f5f5", "#ffffff", "#007bff", "#dc3545", "#212529", "#3700b3", "#ba68c8", "#f06292", "4"),
new("Dark", "dark", "#121212", "#1e1e1e", "#90caf9", "#f48fb1", "#e0e0e0", "#3700b3", "#ba68c8", "#f06292", "4"),
new("Material", "material", "#f5f5f5", "#ffffff", "#4340d2", "#e31c65", "#212121", "#3700b3", "#ba68c8", "#f06292", "4"),
new("Material Dark", "material-dark", "#121212", "#1e1e1e", "#90caf9", "#f48fb1", "#e0e0e0", "#3700b3", "#ba68c8", "#f06292", "4"),
new("Standard", "standard", "#f4f5f9", "#ffffff", "#1776d1", "#c3002f", "#212121", "#3d7cf4", "#64dfdf", "#f68769", "4"),
new("Standard Dark", "standard-dark", "#19191a", "#242527", "#90caf9", "#f48fb1", "#e0e0e0", "#3d7cf4", "#64dfdf", "#f68769", "4"),
new("Humanistic", "humanistic", "#f6f7fa", "#ffffff", "#376df5", "#e91e63", "#212121", "#376df5", "#64dfdf", "#f68769", "4"),
new("Humanistic Dark", "humanistic-dark", "#28363c", "#38474e", "#90caf9", "#f48fb1", "#e0e0e0", "#376df5", "#64dfdf", "#f68769", "4"),
new("Software", "software", "#f6f7fa", "#ffffff", "#4a5568", "#ed8936", "#2d3748", "#376df5", "#64dfdf", "#f68769", "4"),
new("Software Dark", "software-dark", "#28363c", "#3a474d", "#63b3ed", "#f6ad55", "#e2e8f0", "#376df5", "#64dfdf", "#f68769", "4"),
];

private Dictionary<string, string> _settings = new();

Check warning on line 66 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Build and Analyze

Use an overload that has a IEqualityComparer<string> or IComparer<string> parameter (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0002.md)

Check warning on line 66 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Client Component Tests (bUnit)

Use an overload that has a IEqualityComparer<string> or IComparer<string> parameter (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0002.md)

Check warning on line 66 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Server Unit Tests (TUnit)

Use an overload that has a IEqualityComparer<string> or IComparer<string> parameter (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0002.md)

Check warning on line 66 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Use an overload that has a IEqualityComparer<string> or IComparer<string> parameter (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0002.md)

Check warning on line 66 in Client/Modules/FileHub/RadzenThemeChanger.razor.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Use an overload that has a IEqualityComparer<string> or IComparer<string> parameter (https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0002.md)

protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
if (PageState.User != null)
{
_settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
RadzenTheme = SettingService.GetSetting(_settings, "RadzenTheme", "default");
ThemeService.SetTheme(RadzenTheme);
}
}

private async Task OnThemeSelectedAsync(string theme)
{
RadzenTheme = theme;

// Apply theme immediately
ThemeService.SetTheme(theme);

// Save to user settings
if (PageState.User != null)
{
SettingService.SetSetting(_settings, "RadzenTheme", theme);
await SettingService.UpdateUserSettingsAsync(_settings, PageState.User.UserId);
}
}
}
5 changes: 5 additions & 0 deletions Client/Modules/FileHub/RadzenThemeManager.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@namespace ICTAce.FileHub
@inherits ModuleBase

<RadzenComponents />
<RadzenTheme Theme="default" />
23 changes: 23 additions & 0 deletions Client/Modules/FileHub/RadzenThemeManager.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to ICTAce under the MIT license.

namespace ICTAce.FileHub;

public partial class RadzenThemeManager
{
[Inject]
protected ISettingService SettingService { get; set; } = default!;

[Inject]
private Radzen.ThemeService ThemeService { get; set; } = default!;

protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
if (PageState.User != null)
{
var settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
var radzenTheme = SettingService.GetSetting(settings, "RadzenTheme", "default");
ThemeService.SetTheme(radzenTheme);
}
}
}
12 changes: 11 additions & 1 deletion Client/Modules/FileHub/Settings.razor
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
@namespace ICTAce.FileHub
@inherits ModuleBase

<RadzenThemeManager />

<div class="container">
<div class="row">
<div class="col">
<ICTAce.FileHub.Category ModuleId="@(ModuleState.ModuleId)" />
<ICTAce.FileHub.Category ModuleId="@(ModuleState.ModuleId)"/>
</div>
</div>
</div>

<div class="container mt-3">
<div class="row">
<div class="col">
<RadzenThemeChanger />
</div>
</div>
</div>
14 changes: 0 additions & 14 deletions Client/Modules/FileHub/Settings.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ namespace ICTAce.FileHub;

public partial class Settings : ModuleBase
{
[Inject]
protected ISettingService SettingService { get; set; } = default!;

[Inject]
protected IStringLocalizer<Settings> Localizer { get; set; } = default!;

private const string ResourceType = "ICTAce.FileHub.Settings, ICTAce.FileHub.Client.Oqtane";

public override string Title => "FileHub Settings";

public override List<Resource> Resources =>
Expand All @@ -20,10 +12,4 @@ public partial class Settings : ModuleBase
new Script(ModulePath() + "Module.js"),
new Script("_content/Radzen.Blazor/Radzen.Blazor.js"),
];

private async Task HandleErrorAsync(Exception ex)
{
AddModuleMessage(ex.Message, MessageType.Error);
await Task.CompletedTask;
}
}
14 changes: 7 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(AspNetCoreVersion)" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="$(AspNetCoreVersion)" />
<PackageVersion Include="Microsoft.Extensions.Localization" Version="$(AspNetCoreVersion)" />
<PackageVersion Include="Radzen.Blazor" Version="8.4.1" />
<PackageVersion Include="Radzen.Blazor" Version="8.4.2" />
<PackageVersion Include="Microsoft.Playwright" Version="1.57.0" />
<PackageVersion Include="Riok.Mapperly" Version="4.3.0" />
<PackageVersion Include="Riok.Mapperly" Version="4.3.1" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="System.Net.Http.Json" Version="10.0.1" />
<PackageVersion Include="Oqtane.Client" Version="$(OqtaneVersion)" />
<PackageVersion Include="Oqtane.Server" Version="$(OqtaneVersion)" />
<PackageVersion Include="Oqtane.Shared" Version="$(OqtaneVersion)" />
<PackageVersion Include="TUnit" Version="1.5.70" />
<PackageVersion Include="TUnit.Playwright" Version="1.5.70" />
<PackageVersion Include="bunit" Version="2.3.4" />
<PackageVersion Include="TUnit" Version="1.9.2" />
<PackageVersion Include="TUnit.Playwright" Version="1.9.2" />
<PackageVersion Include="bunit" Version="2.4.2" />
<PackageVersion Include="Bogus" Version="35.6.1" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="10.17.0.131074" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.263" />
<PackageVersion Include="AsyncFixer" Version="1.6.0" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.267" />
<PackageVersion Include="AsyncFixer" Version="2.1.0" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.15.0" />
<PackageVersion Include="TUnit.Analyzers" Version="0.1.984" />
<PackageVersion Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="4.14.0" />
Expand Down
2 changes: 1 addition & 1 deletion Server/wwwroot/Modules/ICTAce.FileHub/Module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Module Custom Styles */

/* Ensure Radzen overlays appear above Oqtane modals */
div.rz-tooltip.rz-open.rz-popup {
.rz-popup {
z-index: 99999 !important;
}
10 changes: 0 additions & 10 deletions Solution ItemsError2025-11-15.log

This file was deleted.

Loading