LANCommander/LANCommander.Server/UI/Pages/Games/Edit/PlaySessions.razor
Pat Hartl e231828dd8
Some checks failed
LANCommander Release / prep (push) Failing after 17s
LANCommander Release / build_server_linux_arm64 (push) Has been skipped
LANCommander Release / build_server_linux_x64 (push) Has been skipped
LANCommander Release / build_server_osx_arm64 (push) Has been skipped
LANCommander Release / build_server_osx_x64 (push) Has been skipped
LANCommander Release / build_server_win_arm64 (push) Has been skipped
LANCommander Release / build_server_win_x64 (push) Has been skipped
LANCommander Release / build_launcher_linux_arm64 (push) Has been skipped
LANCommander Release / build_launcher_linux_x64 (push) Has been skipped
LANCommander Release / build_launcher_osx_arm64 (push) Has been skipped
LANCommander Release / build_launcher_osx_x64 (push) Has been skipped
LANCommander Release / build_launcher_win_arm64 (push) Has been skipped
LANCommander Release / build_launcher_win_x64 (push) Has been skipped
LANCommander Release / build_packager (push) Has been skipped
LANCommander Release / build_release (push) Has been skipped
Fix list of play sessions under game
2026-06-16 01:07:22 -05:00

54 lines
2.1 KiB
Text

@page "/Games/{id:guid}/PlaySessions"
@using SortDirection = AntDesign.SortDirection
@attribute [Authorize(Roles = RoleService.AdministratorRoleName)]
@inject PlaySessionService PlaySessionService
@inject IMessageService MessageService
@inject ILogger<PlaySessions> Logger
<GameEditView Id="Id" Title="Play Sessions">
<DataTable
TItem="PlaySession"
Query="ps => ps.GameId == Id"
Responsive
Context="session">
<Columns>
<BoundDataColumn Property="ps => ps.Start" Sortable>
<LocalTime Value="session.Start" />
</BoundDataColumn>
<BoundDataColumn Property="ps => ps.End" Sortable DefaultSortOrder="SortDirection.Descending">
<LocalTime Value="session.End" />
</BoundDataColumn>
<BoundDataColumn Property="ps => ps.Duration" Sortable>
@if (session.Duration.HasValue)
{
<Text>@($"{(int)session.Duration.Value.TotalHours}:{session.Duration.Value.Minutes:D2}:{session.Duration.Value.Seconds:D2}")</Text>
}
</BoundDataColumn>
<BoundDataColumn Property="ps => ps.User != null ? ps.User.UserName : String.Empty" Title="User" Sortable Include="User"/>
<DataActions TData="string">
<Flex Gap="FlexGap.Small" Justify="FlexJustify.End">
<Popconfirm OnConfirm="() => Delete(session)" Title="Are you sure you want to delete this session?">
<Button Icon="@IconType.Outline.Close" Type="ButtonType.Text" Danger/>
</Popconfirm>
</Flex>
</DataActions>
</Columns>
</DataTable>
</GameEditView>
@code {
[Parameter] public Guid Id { get; set; }
private async Task Delete(PlaySession session)
{
try
{
await PlaySessionService.DeleteAsync(session);
}
catch (Exception ex)
{
MessageService.Error($"Could not delete play session!");
Logger.LogError(ex, "Could not delete the play session!");
}
}
}