74 lines
No EOL
2.8 KiB
Text
74 lines
No EOL
2.8 KiB
Text
@page "/admin"
|
|
@using Iceshrimp.Backend.Components.Admin
|
|
@using Iceshrimp.Backend.Core.Services
|
|
@using Microsoft.EntityFrameworkCore
|
|
@inherits AdminComponentBase
|
|
|
|
<AdminPageHeader Title="Overview"/>
|
|
<p>This interface is used to adjust parameters of this Iceshrimp.NET instance.</p>
|
|
|
|
@*
|
|
- 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));
|
|
}
|
|
} |