Compare commits

..

2 Commits

Author SHA1 Message Date
f77481152f Merge pull request 'adding a basic page to dump sources' (#2) from features/list-sources into main
Reviewed-on: #2
2023-06-12 13:17:21 -07:00
ec2e4113c1 adding a basic page to dump sources
All checks were successful
continuous-integration/drone/pr Build is passing
2023-06-12 13:16:07 -07:00
2 changed files with 32 additions and 2 deletions

View File

@ -4,5 +4,4 @@ public static class Global
{
public static HttpClient HttpClient { get; set; }
public static string? DefaultInstanceUri { get; set; }
}

View File

@ -1,6 +1,37 @@
@page "/sources/list"
<h3>list</h3>
@using Newsbot.Collector.Client
@using Newsbot.Collector.Client.Domain.Dto
<h3>Available Sources</h3>
<table>
<tr>
<td>Title</td>
<td>Publish Date</td>
</tr>
@foreach (var item in Data ??= new List<SourcesDto>())
{
if (!item.Enabled)
{
continue;
}
<tr>
<td>
<a href="@item.Url" target="_blank">@item.Name</a><br/>
</td>
<td>@item.Source</td>
</tr>
}
</table>
@code {
private List<SourcesDto> Data { get; set; }
protected override async Task OnInitializedAsync()
{
var c = new SourcesClient(Global.HttpClient, Global.DefaultInstanceUri ?? "");
var items = await c.ListAsync();
Data = items;
}
}