|
|
|
@ -1,7 +1,6 @@ |
|
|
|
@page "/schedules" |
|
|
|
@page "/schedules" |
|
|
|
@using ErsatzTV.Application.Configuration |
|
|
|
@using ErsatzTV.Application.Configuration |
|
|
|
@using ErsatzTV.Application.ProgramSchedules |
|
|
|
@using ErsatzTV.Application.ProgramSchedules |
|
|
|
@using NaturalSort.Extension |
|
|
|
|
|
|
|
@implements IDisposable |
|
|
|
@implements IDisposable |
|
|
|
@inject IDialogService Dialog |
|
|
|
@inject IDialogService Dialog |
|
|
|
@inject IMediator Mediator |
|
|
|
@inject IMediator Mediator |
|
|
|
@ -30,14 +29,15 @@ |
|
|
|
<col style="width: 240px;"/> |
|
|
|
<col style="width: 240px;"/> |
|
|
|
</MudHidden> |
|
|
|
</MudHidden> |
|
|
|
</ColGroup> |
|
|
|
</ColGroup> |
|
|
|
<HeaderContent> |
|
|
|
<ToolBarContent> |
|
|
|
<MudTh> |
|
|
|
<MudTextField T="string" |
|
|
|
<MudTableSortLabel SortBy="new Func<ProgramScheduleViewModel, object>(x => x.Name)"> |
|
|
|
ValueChanged="@(s => OnSearch(s))" |
|
|
|
Name |
|
|
|
Placeholder="Search for schedules" |
|
|
|
</MudTableSortLabel> |
|
|
|
Adornment="Adornment.Start" |
|
|
|
</MudTh> |
|
|
|
AdornmentIcon="@Icons.Material.Filled.FilterList" |
|
|
|
<MudTh/> |
|
|
|
Clearable="true"> |
|
|
|
</HeaderContent> |
|
|
|
</MudTextField> |
|
|
|
|
|
|
|
</ToolBarContent> |
|
|
|
<RowTemplate> |
|
|
|
<RowTemplate> |
|
|
|
<MudTd>@context.Name</MudTd> |
|
|
|
<MudTd>@context.Name</MudTd> |
|
|
|
<MudTd> |
|
|
|
<MudTd> |
|
|
|
@ -109,6 +109,7 @@ |
|
|
|
private MudTable<ProgramScheduleItemViewModel> _detailTable; |
|
|
|
private MudTable<ProgramScheduleItemViewModel> _detailTable; |
|
|
|
private int _rowsPerPage = 10; |
|
|
|
private int _rowsPerPage = 10; |
|
|
|
private int _detailRowsPerPage = 10; |
|
|
|
private int _detailRowsPerPage = 10; |
|
|
|
|
|
|
|
private string _searchString; |
|
|
|
private ProgramScheduleViewModel _selectedSchedule; |
|
|
|
private ProgramScheduleViewModel _selectedSchedule; |
|
|
|
|
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
public void Dispose() |
|
|
|
@ -185,15 +186,8 @@ |
|
|
|
{ |
|
|
|
{ |
|
|
|
await Mediator.Send(new SaveConfigElementByKey(ConfigElementKey.SchedulesPageSize, state.PageSize.ToString()), cancellationToken); |
|
|
|
await Mediator.Send(new SaveConfigElementByKey(ConfigElementKey.SchedulesPageSize, state.PageSize.ToString()), cancellationToken); |
|
|
|
|
|
|
|
|
|
|
|
List<ProgramScheduleViewModel> schedules = await Mediator.Send(new GetAllProgramSchedules(), cancellationToken); |
|
|
|
PagedProgramSchedulesViewModel data = await Mediator.Send(new GetPagedProgramSchedules(_searchString, state.Page, state.PageSize), cancellationToken); |
|
|
|
IOrderedEnumerable<ProgramScheduleViewModel> sorted = schedules.OrderBy(s => s.Name, new NaturalSortComparer(StringComparison.CurrentCultureIgnoreCase)); |
|
|
|
return new TableData<ProgramScheduleViewModel> { TotalItems = data.TotalCount, Items = data.Page }; |
|
|
|
|
|
|
|
|
|
|
|
// TODO: properly page this data |
|
|
|
|
|
|
|
return new TableData<ProgramScheduleViewModel> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
TotalItems = schedules.Count, |
|
|
|
|
|
|
|
Items = sorted.Skip(state.Page * state.PageSize).Take(state.PageSize) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async Task<TableData<ProgramScheduleItemViewModel>> DetailServerReload(TableState state, CancellationToken cancellationToken) |
|
|
|
private async Task<TableData<ProgramScheduleItemViewModel>> DetailServerReload(TableState state, CancellationToken cancellationToken) |
|
|
|
@ -211,4 +205,10 @@ |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnSearch(string query) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_selectedSchedule = null; |
|
|
|
|
|
|
|
_searchString = query; |
|
|
|
|
|
|
|
_table.ReloadServerData(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|