parent
5744ca3bba
commit
9eb1dd47ba
@ -0,0 +1,24 @@
|
||||
@page "/custom-format"
|
||||
@inherits ReactiveInjectableComponentBase<CustomFormatViewModel>
|
||||
|
||||
@if (ViewModel is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
<MudPaper>
|
||||
<CustomFormatGroup ViewModel="@ViewModel.Groups[0]" />
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
if (ViewModel != null)
|
||||
{
|
||||
await ViewModel.OnInit.Execute();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
@inherits ReactiveComponentBase<CustomFormatGroupViewModel>
|
||||
|
||||
@if (ViewModel is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
<MudPaper>
|
||||
<h1>@ViewModel.GroupName</h1>
|
||||
|
||||
@foreach (var cf in ViewModel.CustomFormats)
|
||||
{
|
||||
<h2>@cf.Name</h2>
|
||||
}
|
||||
</MudPaper>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
@ -1,21 +1,41 @@
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using ReactiveUI;
|
||||
using TrashLib.Radarr.CustomFormat.Models;
|
||||
using TrashLib.Radarr.CustomFormat.Processors;
|
||||
|
||||
namespace Recyclarr.Gui.ViewModels;
|
||||
|
||||
public class CustomFormatGroupViewModel : ReactiveObject
|
||||
{
|
||||
public string GroupName { get; set; }
|
||||
public ICollection<CustomFormatGroupItem> CustomFormats { get; set; }
|
||||
public string GroupName { get; }
|
||||
public ICollection<CustomFormatData> CustomFormats { get; }
|
||||
|
||||
public CustomFormatGroupViewModel()
|
||||
public CustomFormatGroupViewModel(string groupName, ICollection<CustomFormatData> customFormats)
|
||||
{
|
||||
GroupName = groupName;
|
||||
CustomFormats = customFormats;
|
||||
}
|
||||
}
|
||||
|
||||
public class CustomFormatViewModel : ReactiveObject
|
||||
{
|
||||
public CustomFormatViewModel()
|
||||
private readonly ICustomFormatLookup _cfLookup;
|
||||
private readonly List<CustomFormatGroupViewModel> _groups = new();
|
||||
|
||||
public List<CustomFormatGroupViewModel> Groups => _groups;
|
||||
public ReactiveCommand<Unit, Unit> OnInit;
|
||||
|
||||
public CustomFormatViewModel(ICustomFormatLookup cfLookup)
|
||||
{
|
||||
_cfLookup = cfLookup;
|
||||
|
||||
OnInit = ReactiveCommand.Create(() =>
|
||||
{
|
||||
foreach (var (groupName, cfs) in _cfLookup.MapAllCustomFormats())
|
||||
{
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
using TrashLib.Radarr.CustomFormat.Models;
|
||||
|
||||
namespace TrashLib.Radarr.CustomFormat.Processors;
|
||||
|
||||
public interface ICustomFormatLookup
|
||||
{
|
||||
Dictionary<string, List<CustomFormatData>> MapAllCustomFormats();
|
||||
}
|
Loading…
Reference in new issue