Merge branch 'main' of https://git.azuze.fr/kawa/SharepointToolbox-Web
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<div class="site-picker">
|
||||
<div class="flex-row" style="gap:8px;align-items:flex-end">
|
||||
<div class="form-group" style="flex:1">
|
||||
<label class="form-label">Sites</label>
|
||||
<label class="form-label">@(Single ? "Site" : "Sites")</label>
|
||||
<input class="form-input" @bind="_filter" @bind:event="oninput" placeholder="Filter loaded sites by name or URL…" />
|
||||
</div>
|
||||
<button class="btn btn-secondary" @onclick="LoadSites" disabled="@_loading">
|
||||
@@ -19,7 +19,10 @@
|
||||
@if (_all.Count > 0)
|
||||
{
|
||||
<div class="flex-row mt-8" style="gap:12px;align-items:center">
|
||||
<button class="btn btn-link btn-sm" @onclick="SelectAllFiltered">Select all (@Filtered.Count())</button>
|
||||
@if (!Single)
|
||||
{
|
||||
<button class="btn btn-link btn-sm" @onclick="SelectAllFiltered">Select all (@Filtered.Count())</button>
|
||||
}
|
||||
<button class="btn btn-link btn-sm" @onclick="ClearSelection">Clear</button>
|
||||
<span class="spacer"></span>
|
||||
<span class="count-badge">@SelectedSites.Count selected</span>
|
||||
@@ -28,7 +31,14 @@
|
||||
@foreach (var s in Filtered)
|
||||
{
|
||||
<label style="display:flex;align-items:center;gap:8px;padding:3px 6px;cursor:pointer">
|
||||
<input type="checkbox" checked="@IsSelected(s)" @onchange="e => Toggle(s, (bool)(e.Value ?? false))" />
|
||||
@if (Single)
|
||||
{
|
||||
<input type="radio" name="@_radioName" checked="@IsSelected(s)" @onchange="e => SelectSingle(s)" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" checked="@IsSelected(s)" @onchange="e => Toggle(s, (bool)(e.Value ?? false))" />
|
||||
}
|
||||
<span>@s.Title</span>
|
||||
<span class="text-muted" style="font-size:11px">@s.Url</span>
|
||||
</label>
|
||||
@@ -41,7 +51,7 @@
|
||||
}
|
||||
else if (!_loading)
|
||||
{
|
||||
<div class="text-muted mt-8" style="font-size:12px">Click “Load sites” to list the tenant’s SharePoint sites, then tick the ones to scan.</div>
|
||||
<div class="text-muted mt-8" style="font-size:12px">Click “Load sites” to list the tenant’s SharePoint sites, then @(Single ? "pick one." : "tick the ones to scan.")</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -50,7 +60,9 @@
|
||||
[Parameter] public List<SiteInfo> SelectedSites { get; set; } = new();
|
||||
[Parameter] public EventCallback<List<SiteInfo>> SelectedSitesChanged { get; set; }
|
||||
[Parameter] public bool Disabled { get; set; }
|
||||
[Parameter] public bool Single { get; set; }
|
||||
|
||||
private readonly string _radioName = "sp-" + Guid.NewGuid().ToString("N");
|
||||
private List<SiteInfo> _all = new();
|
||||
private string _filter = string.Empty;
|
||||
private bool _loading;
|
||||
@@ -91,6 +103,12 @@
|
||||
await SelectedSitesChanged.InvokeAsync(SelectedSites);
|
||||
}
|
||||
|
||||
private async Task SelectSingle(SiteInfo s)
|
||||
{
|
||||
SelectedSites = new List<SiteInfo> { s };
|
||||
await SelectedSitesChanged.InvokeAsync(SelectedSites);
|
||||
}
|
||||
|
||||
private async Task SelectAllFiltered()
|
||||
{
|
||||
foreach (var s in Filtered)
|
||||
|
||||
Reference in New Issue
Block a user