
Currently available sections: instance metadata, user management, federation control, relays, plugins & queue dashboard. Planned: sections: configuration, logs, policies & reports.
84 lines
No EOL
3.5 KiB
Text
84 lines
No EOL
3.5 KiB
Text
@page "/admin"
|
|
@using Iceshrimp.Backend.Components.Admin
|
|
@using Iceshrimp.Backend.Core.Services
|
|
@using Microsoft.EntityFrameworkCore
|
|
@inherits AdminComponentBase
|
|
|
|
<PageTitle>Overview - Admin - @(InstanceName ?? "Iceshrimp.NET")</PageTitle>
|
|
<AdminHead/>
|
|
<h1>Admin Dashboard</h1>
|
|
<p>This interface is used to adjust parameters of this Iceshrimp.NET instance. Please pick a category below.</p>
|
|
|
|
<button role="link" data-target="/admin/metadata" onclick="navigate(event)">Instance metadata</button>
|
|
<button role="link" data-target="/admin/users" onclick="navigate(event)">User management</button>
|
|
<button role="link" data-target="/admin/federation" onclick="navigate(event)">Federation control</button>
|
|
<button role="link" data-target="/admin/relays" onclick="navigate(event)">Relays</button>
|
|
<button role="link" data-target="/admin/plugins" onclick="navigate(event)">Plugins</button>
|
|
<button role="link" data-target="/queue" onclick="navigate(event)">[ext] Queue dashboard</button>
|
|
|
|
@*
|
|
- TODO: Improve styles, possibly add a navbar
|
|
- TODO: Remote user management
|
|
- TODO: More federation stats (e.g. # of activities sent/fetched, some basic queue stats)
|
|
- TODO: Move queue dashboard to blazor ssr
|
|
|
|
- TODO: Configuration - /admin/config (all loaded config files + their merged content)
|
|
- TODO: Logs - /admin/logs (ring buffer)
|
|
- TODO: Policies - /admin/policies (with generic json payload UI for custom policies and nice/smart UI for builtin ones, incl using jsonb_add for e.g. adding instances to a policy)
|
|
- TODO: Reports - /admin/reports (when implemented)
|
|
*@
|
|
|
|
<hr/>
|
|
<h3>Instance statistics</h3>
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td>Total instances</td>
|
|
<td>@_totalInstances</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Active instances</td>
|
|
<td>@_activeInstances</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Total notes</td>
|
|
<td>@_totalNotes</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Local notes</td>
|
|
<td>@_localNotes</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Total notes, past 24h</td>
|
|
<td>@_totalNotesLastDay</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Local notes, past 24h</td>
|
|
<td>@_localNotesLastDay</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
@code {
|
|
[CascadingParameter(Name = "InstanceName")]
|
|
public required string? InstanceName { get; set; }
|
|
|
|
[Inject] public required CacheService Cache { get; set; }
|
|
|
|
private int _totalInstances;
|
|
private int _activeInstances;
|
|
private int _totalNotes;
|
|
private int _localNotes;
|
|
private int _totalNotesLastDay;
|
|
private int _localNotesLastDay;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
_totalInstances = await Cache.FetchValueAsync("stats:totalInstances", TimeSpan.FromHours(1), () => Database.Instances.CountAsync());
|
|
_activeInstances = await Cache.FetchValueAsync("stats:activeInstances", TimeSpan.FromHours(1), () => Database.Instances.CountAsync(p => !p.IsNotResponding));
|
|
_totalNotes = await Cache.FetchValueAsync("stats:totalNotes", TimeSpan.FromHours(1), () => Database.Notes.CountAsync());
|
|
_localNotes = await Cache.FetchValueAsync("stats:localNotes", TimeSpan.FromHours(1), () => Database.Notes.CountAsync(p => p.User.IsLocalUser));
|
|
_totalNotesLastDay = await Cache.FetchValueAsync("stats:totalNotesLastDay", TimeSpan.FromHours(1), () => Database.Notes.CountAsync(p => p.CreatedAt > DateTime.UtcNow - TimeSpan.FromDays(1)));
|
|
_localNotesLastDay = await Cache.FetchValueAsync("stats:localNotesLastDay", TimeSpan.FromHours(1), () => Database.Notes.CountAsync(p => p.CreatedAt > DateTime.UtcNow - TimeSpan.FromDays(1) && p.User.IsLocalUser));
|
|
}
|
|
} |