|
|
|
@ -27,7 +27,11 @@ |
|
|
|
<MudTable Hover="true" |
|
|
|
<MudTable Hover="true" |
|
|
|
@bind-RowsPerPage="@_rowsPerPage" |
|
|
|
@bind-RowsPerPage="@_rowsPerPage" |
|
|
|
ServerData="@(new Func<TableState, CancellationToken, Task<TableData<ChannelViewModel>>>(ServerReload))" |
|
|
|
ServerData="@(new Func<TableState, CancellationToken, Task<TableData<ChannelViewModel>>>(ServerReload))" |
|
|
|
@ref="_table"> |
|
|
|
@ref="_table" |
|
|
|
|
|
|
|
RowClassFunc="ChannelRowClassFunc"> |
|
|
|
|
|
|
|
<ToolBarContent> |
|
|
|
|
|
|
|
<MudSwitch T="bool" Class="ml-6" @bind-Value="@ShowDisabled" Color="Color.Secondary" Label="Show Disabled"/> |
|
|
|
|
|
|
|
</ToolBarContent> |
|
|
|
<ColGroup> |
|
|
|
<ColGroup> |
|
|
|
<MudHidden Breakpoint="Breakpoint.Xs"> |
|
|
|
<MudHidden Breakpoint="Breakpoint.Xs"> |
|
|
|
<col style="width: 60px;"/> |
|
|
|
<col style="width: 60px;"/> |
|
|
|
@ -53,7 +57,24 @@ |
|
|
|
<MudTh/> |
|
|
|
<MudTh/> |
|
|
|
</HeaderContent> |
|
|
|
</HeaderContent> |
|
|
|
<RowTemplate> |
|
|
|
<RowTemplate> |
|
|
|
<MudTd DataLabel="Number">@context.Number</MudTd> |
|
|
|
<MudTd DataLabel="Number"> |
|
|
|
|
|
|
|
@if (!context.IsEnabled) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
<MudTooltip Text="Channel is disabled"> |
|
|
|
|
|
|
|
@($"(D) {context.Number}") |
|
|
|
|
|
|
|
</MudTooltip> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (!context.ShowInEpg) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
<MudTooltip Text="Channel is hidden from EPG"> |
|
|
|
|
|
|
|
@($"(H) {context.Number}") |
|
|
|
|
|
|
|
</MudTooltip> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
@context.Number |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</MudTd> |
|
|
|
<MudTd DataLabel="Logo"> |
|
|
|
<MudTd DataLabel="Logo"> |
|
|
|
@if (!string.IsNullOrWhiteSpace(context.Logo?.Path)) |
|
|
|
@if (!string.IsNullOrWhiteSpace(context.Logo?.Path)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -110,14 +131,14 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
<div style="width: 48px"></div> |
|
|
|
<div style="width: 48px"></div> |
|
|
|
} |
|
|
|
} |
|
|
|
<MudTooltip Text="Edit Channel"> |
|
|
|
<MudTooltip Text="Edit Channel"> |
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.Edit" |
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.Edit" |
|
|
|
Href="@($"channels/{context.Id}")"> |
|
|
|
Href="@($"channels/{context.Id}")"> |
|
|
|
</MudIconButton> |
|
|
|
</MudIconButton> |
|
|
|
</MudTooltip> |
|
|
|
</MudTooltip> |
|
|
|
@if (context.PlayoutCount > 0) |
|
|
|
@if (context.PlayoutCount > 0 && context.IsEnabled) |
|
|
|
{ |
|
|
|
{ |
|
|
|
<MudTooltip Text="Troubleshoot Channel"> |
|
|
|
<MudTooltip Text="Troubleshoot Channel"> |
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.Troubleshoot" |
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.Troubleshoot" |
|
|
|
@ -152,9 +173,22 @@ |
|
|
|
private List<FFmpegProfileViewModel> _ffmpegProfiles = []; |
|
|
|
private List<FFmpegProfileViewModel> _ffmpegProfiles = []; |
|
|
|
private readonly System.Collections.Generic.HashSet<int> _channelsThatCanPreview = []; |
|
|
|
private readonly System.Collections.Generic.HashSet<int> _channelsThatCanPreview = []; |
|
|
|
private readonly Dictionary<int, bool> _ffmpegProfilesThatCanPreview = []; |
|
|
|
private readonly Dictionary<int, bool> _ffmpegProfilesThatCanPreview = []; |
|
|
|
|
|
|
|
private bool _showDisabled; |
|
|
|
private int _rowsPerPage = 10; |
|
|
|
private int _rowsPerPage = 10; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private bool ShowDisabled |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
get => _showDisabled; |
|
|
|
|
|
|
|
set |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (_showDisabled != value) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_showDisabled = value; |
|
|
|
|
|
|
|
_table?.ReloadServerData(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected override void OnInitialized() => SegmenterService.OnWorkersChanged += WorkersChanged; |
|
|
|
protected override void OnInitialized() => SegmenterService.OnWorkersChanged += WorkersChanged; |
|
|
|
|
|
|
|
|
|
|
|
private void WorkersChanged(object sender, EventArgs e) => |
|
|
|
private void WorkersChanged(object sender, EventArgs e) => |
|
|
|
@ -181,6 +215,8 @@ |
|
|
|
token.ThrowIfCancellationRequested(); |
|
|
|
token.ThrowIfCancellationRequested(); |
|
|
|
_rowsPerPage = await Mediator.Send(new GetConfigElementByKey(ConfigElementKey.ChannelsPageSize), token) |
|
|
|
_rowsPerPage = await Mediator.Send(new GetConfigElementByKey(ConfigElementKey.ChannelsPageSize), token) |
|
|
|
.Map(maybeRows => maybeRows.Match(ce => int.TryParse(ce.Value, out int rows) ? rows : 10, () => 10)); |
|
|
|
.Map(maybeRows => maybeRows.Match(ce => int.TryParse(ce.Value, out int rows) ? rows : 10, () => 10)); |
|
|
|
|
|
|
|
_showDisabled = await Mediator.Send(new GetConfigElementByKey(ConfigElementKey.ChannelsShowDisabled), token) |
|
|
|
|
|
|
|
.Map(maybeShow => maybeShow.Match(ce => bool.TryParse(ce.Value, out bool show) && show, () => false)); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (OperationCanceledException) |
|
|
|
catch (OperationCanceledException) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -292,9 +328,11 @@ |
|
|
|
private async Task<TableData<ChannelViewModel>> ServerReload(TableState state, CancellationToken cancellationToken) |
|
|
|
private async Task<TableData<ChannelViewModel>> ServerReload(TableState state, CancellationToken cancellationToken) |
|
|
|
{ |
|
|
|
{ |
|
|
|
await Mediator.Send(new SaveConfigElementByKey(ConfigElementKey.ChannelsPageSize, state.PageSize.ToString()), cancellationToken); |
|
|
|
await Mediator.Send(new SaveConfigElementByKey(ConfigElementKey.ChannelsPageSize, state.PageSize.ToString()), cancellationToken); |
|
|
|
|
|
|
|
await Mediator.Send(new SaveConfigElementByKey(ConfigElementKey.ChannelsShowDisabled, _showDisabled.ToString()), cancellationToken); |
|
|
|
|
|
|
|
|
|
|
|
cancellationToken.ThrowIfCancellationRequested(); |
|
|
|
cancellationToken.ThrowIfCancellationRequested(); |
|
|
|
|
|
|
|
|
|
|
|
List<ChannelViewModel> channels = await Mediator.Send(new GetAllChannels(), cancellationToken); |
|
|
|
List<ChannelViewModel> channels = await Mediator.Send(new GetAllChannels(_showDisabled), cancellationToken); |
|
|
|
// TODO: properly page this data |
|
|
|
// TODO: properly page this data |
|
|
|
IOrderedEnumerable<ChannelViewModel> sorted = channels.OrderBy(c => decimal.Parse(c.Number, CultureInfo.InvariantCulture)) |
|
|
|
IOrderedEnumerable<ChannelViewModel> sorted = channels.OrderBy(c => decimal.Parse(c.Number, CultureInfo.InvariantCulture)) |
|
|
|
.Skip(state.Page * state.PageSize) |
|
|
|
.Skip(state.Page * state.PageSize) |
|
|
|
@ -348,4 +386,9 @@ |
|
|
|
return await JsRuntime.InvokeAsync<bool>("mediaSourceSupports", codecString); |
|
|
|
return await JsRuntime.InvokeAsync<bool>("mediaSourceSupports", codecString); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string ChannelRowClassFunc(ChannelViewModel channel, int index) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return channel.IsEnabled && channel.ShowInEpg ? string.Empty : "channel-disabled"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|