Files
SharepointToolbox-Web/Components/Pages/Settings.razor
T
kawa 5df7b72800 Add report logos and configurable folder scan depth
Report branding (top-left MSP logo, top-right client logo):
- Add MspLogo to AppSettings; client logo already on TenantProfile
- IUserSessionService.CurrentBranding composes MSP + active profile logo
- New reusable LogoUpload component (InputFile -> base64 LogoData, 512KB cap)
- MSP logo upload in Settings; optional client logo in profile create/edit
- Wire ReportBranding into all 6 HTML export pages
- Fix EditProfile dropping ClientLogo on edit

Storage metrics: expose folder scan depth (0-20) in scan options UI,
passed to existing StorageScanOptions.FolderDepth recursion.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 14:56:49 +02:00

79 lines
2.6 KiB
Plaintext

@page "/settings"
@attribute [Authorize]
@inject IUserSessionService Session
@inject IJSRuntime JS
@rendermode InteractiveServer
@using Microsoft.JSInterop
<h1 class="page-title">Settings</h1>
<div class="card">
<div class="card-title">Display</div>
<div class="form-group">
<label class="form-label">Language</label>
<select class="form-select" style="width:160px" @bind="_lang" @bind:after="Save">
<option value="en">English</option>
<option value="fr">Français</option>
</select>
</div>
<div class="form-group">
<label class="form-label">Theme</label>
<select class="form-select" style="width:160px" @bind="_theme" @bind:after="Save">
<option value="System">System</option>
<option value="Light">Light</option>
</select>
</div>
</div>
<div class="card">
<div class="card-title">Behavior</div>
<div class="form-group">
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
<input type="checkbox" @bind="_autoTakeOwnership" @bind:after="Save" />
Auto-elevate ownership when permission scan is denied
</label>
</div>
</div>
<div class="card">
<div class="card-title">Report Branding</div>
<div class="form-group">
<label class="form-label">MSP logo</label>
<p class="text-muted" style="margin-top:0">Shown top-left on exported HTML reports. The client's logo (top-right) is set per profile.</p>
<LogoUpload Value="_mspLogo" ValueChanged="OnMspLogoChanged" />
</div>
</div>
@if (_saved) { <div class="alert alert-success">Settings saved.</div> }
@code {
private string _lang = "en", _theme = "System";
private bool _autoTakeOwnership, _saved;
private LogoData? _mspLogo;
protected override void OnInitialized()
{
var s = Session.Settings;
_lang = s.Lang;
_theme = s.Theme is "System" or "Light" ? s.Theme : "System";
_autoTakeOwnership = s.AutoTakeOwnership;
_mspLogo = s.MspLogo;
}
private async Task OnMspLogoChanged(LogoData? logo)
{
_mspLogo = logo;
await Save();
}
private async Task Save()
{
Session.UpdateSettings(new AppSettings { Lang = _lang, Theme = _theme, AutoTakeOwnership = _autoTakeOwnership, MspLogo = _mspLogo });
SharepointToolbox.Web.Localization.TranslationSource.Instance.SetCulture(_lang);
await JS.InvokeVoidAsync("sptb.setTheme", _theme);
_saved = true;
StateHasChanged();
_ = Task.Delay(2000).ContinueWith(_ => { _saved = false; InvokeAsync(StateHasChanged); });
}
}