Add storage management features and UI components
Implemented new storage endpoints in the API and updated the dependency injection to include storage-related services. Enhanced the frontend by adding storage routes and links in the admin layout, along with new types and localization for storage management. Updated documentation to reflect the new storage features and their usage in the admin interface.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using LiteCqrs;
|
||||
using TeleWave.Application.Storage;
|
||||
using TeleWave.Infrastructure.Identity;
|
||||
|
||||
namespace TeleWave.Api.Endpoints;
|
||||
|
||||
/// <summary>Чем занят диск: объём по областям хранилища и заполненность тома.</summary>
|
||||
public static class StorageEndpoints
|
||||
{
|
||||
public static IEndpointRouteBuilder MapStorageEndpoints(this IEndpointRouteBuilder app)
|
||||
{
|
||||
app.MapGet("/api/admin/storage", Stats)
|
||||
.WithTags("Admin.Storage")
|
||||
.RequireAuthorization(policy => policy.RequireRole(RoleNames.Admin))
|
||||
.Produces<StorageStatsDto>();
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
/// <param name="refresh">Пересчитать, не дожидаясь истечения кэша: обход дерева долгий.</param>
|
||||
private static async Task<IResult> Stats(
|
||||
bool? refresh,
|
||||
ISender sender,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var result = await sender.Send(
|
||||
new GetStorageStatsQuery(refresh ?? false),
|
||||
cancellationToken
|
||||
);
|
||||
return Results.Ok(result);
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,7 @@ app.MapJunctionEndpoints();
|
||||
app.MapChannelEndpoints();
|
||||
app.MapStreamingEndpoints();
|
||||
app.MapMaintenanceEndpoints();
|
||||
app.MapStorageEndpoints();
|
||||
app.MapSettingsEndpoints();
|
||||
app.MapMetadataEndpoints();
|
||||
app.MapImageEndpoints();
|
||||
|
||||
Reference in New Issue
Block a user