Merge branch 'main' of https://git.azuze.fr/kawa/SharepointToolbox-Web
This commit is contained in:
@@ -8,35 +8,36 @@
|
||||
@inject StorageHtmlExportService HtmlExport
|
||||
@inject WebExportService WebExport
|
||||
@inject IAuditService Audit
|
||||
@inject TranslationSource T
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<h1 class="page-title">Storage Metrics</h1>
|
||||
<h1 class="page-title">@T["stor.page.title"]</h1>
|
||||
|
||||
@if (!Session.HasProfile) { <NoProfilePrompt /> return; }
|
||||
|
||||
<div class="card">
|
||||
<div class="card-title">Scan Options</div>
|
||||
<div class="card-title">@T["grp.scan.opts"]</div>
|
||||
<SitePicker Profile="Session.CurrentProfile!" @bind-SelectedSites="_sites" />
|
||||
<div class="form-row mt-8">
|
||||
<div class="form-group" style="max-width:220px">
|
||||
<label class="form-label">Folder scan depth</label>
|
||||
<label class="form-label">@T["stor.lbl.folder_scan_depth"]</label>
|
||||
<input class="form-input" type="number" min="0" max="20" @bind="_folderDepth" />
|
||||
<small class="text-muted">0 = libraries only. 1+ = drill into subfolders that many levels deep.</small>
|
||||
<small class="text-muted">@T["stor.hint.folder_depth"]</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group" style="display:flex;align-items:center;gap:16px;padding-top:20px">
|
||||
<label><input type="checkbox" @bind="_includeSubsites" /> Include subsites</label>
|
||||
<label><input type="checkbox" @bind="_includeHidden" /> Include hidden libs</label>
|
||||
<label><input type="checkbox" @bind="_includeRecycleBin" /> Include recycle bin</label>
|
||||
<label><input type="checkbox" @bind="_includeSubsites" /> @T["chk.include.subsites"]</label>
|
||||
<label><input type="checkbox" @bind="_includeHidden" /> @T["stor.chk.include_hidden_libs"]</label>
|
||||
<label><input type="checkbox" @bind="_includeRecycleBin" /> @T["stor.chk.include_recycle_bin"]</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-row mt-8">
|
||||
<button class="btn btn-primary" @onclick="RunScan" disabled="@_running">
|
||||
@(_running ? "Scanning…" : "Scan Storage")
|
||||
@(_running ? T["stor.btn.scanning"] : T["stor.btn.scan_storage"])
|
||||
</button>
|
||||
@if (_sites.Count > 0) { <span class="text-muted" style="align-self:center">@_sites.Count site(s) selected</span> }
|
||||
@if (_running) { <button class="btn btn-secondary" @onclick="Cancel">Cancel</button> }
|
||||
@if (_sites.Count > 0) { <span class="text-muted" style="align-self:center">@string.Format(T["perm.sites.selected"], _sites.Count)</span> }
|
||||
@if (_running) { <button class="btn btn-secondary" @onclick="Cancel">@T["btn.cancel"]</button> }
|
||||
</div>
|
||||
<ProgressPanel IsRunning="_running" StatusMessage="@_status" Current="_current" Total="_total" />
|
||||
</div>
|
||||
@@ -47,22 +48,22 @@
|
||||
{
|
||||
<div class="card">
|
||||
<div class="flex-row">
|
||||
<div class="card-title">Storage Report <span class="count-badge">@_results.Count libraries</span></div>
|
||||
<div class="card-title">@T["stor.report.title"] <span class="count-badge">@string.Format(T["stor.badge.libraries_count"], _results.Count)</span></div>
|
||||
<div class="spacer"></div>
|
||||
<MergeModeSelect Value="_mergeMode" ValueChanged="v => _mergeMode = v" Visible="_bySite.Count > 1" />
|
||||
<button class="btn btn-secondary btn-sm" @onclick="ExportCsv">Export CSV</button>
|
||||
<button class="btn btn-secondary btn-sm" @onclick="ExportHtml">Export HTML</button>
|
||||
<button class="btn btn-secondary btn-sm" @onclick="ExportCsv">@T["audit.btn.exportCsv"]</button>
|
||||
<button class="btn btn-secondary btn-sm" @onclick="ExportHtml">@T["audit.btn.exportHtml"]</button>
|
||||
</div>
|
||||
<div class="data-table-wrap">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Library</th>
|
||||
<th>Site</th>
|
||||
<th class="num">Files</th>
|
||||
<th class="num">Total (MB)</th>
|
||||
<th class="num">Versions (MB)</th>
|
||||
<th>Last Modified</th>
|
||||
<th>@T["stor.col.library"]</th>
|
||||
<th>@T["stor.col.site"]</th>
|
||||
<th class="num">@T["stor.col.files"]</th>
|
||||
<th class="num">@T["stor.col.total_mb"]</th>
|
||||
<th class="num">@T["stor.col.versions_mb"]</th>
|
||||
<th>@T["stor.col.lastmod"]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -98,7 +99,7 @@
|
||||
{
|
||||
_error = string.Empty; _results = new(); _bySite = new(); _running = true;
|
||||
_cts = new CancellationTokenSource();
|
||||
if (_sites.Count == 0) { _error = "Please select at least one site."; _running = false; return; }
|
||||
if (_sites.Count == 0) { _error = T["stor.err.select_site"]; _running = false; return; }
|
||||
var progress = new Progress<OperationProgress>(p => { _status = p.Message; _current = p.Current; _total = p.Total; InvokeAsync(StateHasChanged); });
|
||||
try
|
||||
{
|
||||
@@ -109,7 +110,7 @@
|
||||
foreach (var site in _sites)
|
||||
{
|
||||
_cts.Token.ThrowIfCancellationRequested();
|
||||
_status = $"Scanning {site.Title} ({++i}/{_sites.Count})…";
|
||||
_status = string.Format(T["stor.status.scanning_site"], site.Title, ++i, _sites.Count);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
var nodes = await Elevation.RunAsync(async c =>
|
||||
{
|
||||
@@ -120,11 +121,11 @@
|
||||
flat.AddRange(nodes);
|
||||
}
|
||||
_bySite = bySite; _results = flat;
|
||||
_status = $"Complete: {_results.Count} nodes across {_sites.Count} site(s).";
|
||||
_status = string.Format(T["stor.status.complete_nodes"], _results.Count, _sites.Count);
|
||||
await Audit.LogAsync("StorageScan", Session.CurrentProfile?.Name ?? "", _sites.Select(s => s.Url),
|
||||
$"{_results.Count} nodes; depth={_folderDepth} subsites={_includeSubsites} hidden={_includeHidden} recycle={_includeRecycleBin}");
|
||||
}
|
||||
catch (OperationCanceledException) { _status = "Cancelled."; }
|
||||
catch (OperationCanceledException) { _status = T["stor.status.cancelled"]; }
|
||||
catch (Exception ex) { _error = ex.Message; }
|
||||
finally { _running = false; await InvokeAsync(StateHasChanged); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user