Merge branch 'main' of https://git.azuze.fr/kawa/SharepointToolbox-Web
This commit is contained in:
@@ -3,18 +3,19 @@
|
||||
@inject IUserSessionService Session
|
||||
@inject IGraphUserDirectoryService GraphSvc
|
||||
@inject IAuditService Audit
|
||||
@inject TranslationSource T
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<h1 class="page-title">User Directory</h1>
|
||||
<p class="page-subtitle">Browse all tenant users via Microsoft Graph.</p>
|
||||
<h1 class="page-title">@T["directory.grp.browse"]</h1>
|
||||
<p class="page-subtitle">@T["directory.subtitle"]</p>
|
||||
|
||||
@if (!Session.HasProfile) { <NoProfilePrompt /> return; }
|
||||
|
||||
<div class="card">
|
||||
<div class="flex-row">
|
||||
<label><input type="checkbox" @bind="_includeGuests" /> Include guests</label>
|
||||
<label><input type="checkbox" @bind="_includeGuests" /> @T["directory.chk.guests"]</label>
|
||||
<button class="btn btn-primary" @onclick="LoadUsers" disabled="@_running">
|
||||
@(_running ? $"Loading… ({_loadCount} users)" : "Load Users")
|
||||
@(_running ? string.Format(T["directory.btn.loading"], _loadCount) : T["directory.btn.loadUsers"])
|
||||
</button>
|
||||
</div>
|
||||
<ProgressPanel IsRunning="_running" StatusMessage="@_status" />
|
||||
@@ -26,12 +27,12 @@
|
||||
{
|
||||
<div class="card">
|
||||
<div class="flex-row">
|
||||
<div class="card-title">Users <span class="count-badge">@_users.Count</span></div>
|
||||
<input class="form-input" style="width:260px" @bind="_filter" @bind:event="oninput" placeholder="Filter by name or email…" />
|
||||
<div class="card-title">@T["directory.title.users"] <span class="count-badge">@_users.Count</span></div>
|
||||
<input class="form-input" style="width:260px" @bind="_filter" @bind:event="oninput" placeholder="@T["directory.filter.byNameEmail"]" />
|
||||
</div>
|
||||
<div class="data-table-wrap">
|
||||
<table class="data-table">
|
||||
<thead><tr><th>Name</th><th>UPN</th><th>Department</th><th>Job Title</th><th>Type</th></tr></thead>
|
||||
<thead><tr><th>@T["directory.col.name"]</th><th>@T["directory.col.upn"]</th><th>@T["directory.col.department"]</th><th>@T["directory.col.jobtitle"]</th><th>@T["directory.col.type"]</th></tr></thead>
|
||||
<tbody>
|
||||
@foreach (var u in FilteredUsers.Take(500))
|
||||
{
|
||||
@@ -40,13 +41,13 @@
|
||||
<td>@u.UserPrincipalName</td>
|
||||
<td>@u.Department</td>
|
||||
<td>@u.JobTitle</td>
|
||||
<td><span class="chip @(u.UserType == "Guest" ? "chip-yellow" : "chip-blue")">@(u.UserType ?? "Member")</span></td>
|
||||
<td><span class="chip @(u.UserType == "Guest" ? "chip-yellow" : "chip-blue")">@(u.UserType ?? T["directory.type.member"])</span></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@if (FilteredUsers.Count() > 500) { <div class="text-muted mt-8">Showing first 500 of @FilteredUsers.Count() filtered.</div> }
|
||||
@if (FilteredUsers.Count() > 500) { <div class="text-muted mt-8">@string.Format(T["directory.showing500"], FilteredUsers.Count())</div> }
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -67,7 +68,7 @@
|
||||
try
|
||||
{
|
||||
_users = (await GraphSvc.GetUsersAsync(Session.CurrentProfile!, _includeGuests, progress)).ToList();
|
||||
_status = $"Loaded {_users.Count} users.";
|
||||
_status = string.Format(T["directory.status.loaded"], _users.Count);
|
||||
await Audit.LogAsync("UserDirectoryLoad", Session.CurrentProfile?.Name ?? "", Array.Empty<string>(),
|
||||
$"{_users.Count} users; guests={_includeGuests}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user