diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..07c6bb4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +appsettings.json +**/bin/ +**/obj/ \ No newline at end of file diff --git a/.drone.yml b/.drone.yml index e89e131..f5efdbe 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,15 +6,17 @@ name: build steps: - name: build image image: plugins/docker + environment: + PAT: + from_secret: DockerPushPat settings: - repo: 192.168.1.196:5000/jtom38/newsbot-portal - registry: 192.168.1.196:5000 - insecure: true - tags: - - latest + username: jtom38 + password: $PAT + repo: jtom38/newsbot-portal trigger: branch: - master + - releases/* --- kind: pipeline diff --git a/Newsbot.Portal.Blazor.Server/Dockerfile b/Dockerfile similarity index 100% rename from Newsbot.Portal.Blazor.Server/Dockerfile rename to Dockerfile diff --git a/Newsbot.Portal.Blazor.Server/Global.cs b/Newsbot.Portal.Blazor.Server/Global.cs index 0eda7bd..894e61a 100644 --- a/Newsbot.Portal.Blazor.Server/Global.cs +++ b/Newsbot.Portal.Blazor.Server/Global.cs @@ -2,6 +2,6 @@ namespace Newsbot.Portal.Blazor.Server; public static class Global { - public static HttpClient HttpClient { get; set; } + public static HttpClient? HttpClient { get; set; } public static string? DefaultInstanceUri { get; set; } } \ No newline at end of file diff --git a/Newsbot.Portal.Blazor.Server/Newsbot.Portal.Blazor.Server.csproj b/Newsbot.Portal.Blazor.Server/Newsbot.Portal.Blazor.Server.csproj index a6da8b6..8ff23fb 100644 --- a/Newsbot.Portal.Blazor.Server/Newsbot.Portal.Blazor.Server.csproj +++ b/Newsbot.Portal.Blazor.Server/Newsbot.Portal.Blazor.Server.csproj @@ -7,12 +7,6 @@ Linux - - - .dockerignore - - - diff --git a/Newsbot.Portal.Blazor.Server/Pages/Articles/Newest.razor b/Newsbot.Portal.Blazor.Server/Pages/Articles/Latest.razor similarity index 76% rename from Newsbot.Portal.Blazor.Server/Pages/Articles/Newest.razor rename to Newsbot.Portal.Blazor.Server/Pages/Articles/Latest.razor index 9dc1b50..9be58cc 100644 --- a/Newsbot.Portal.Blazor.Server/Pages/Articles/Newest.razor +++ b/Newsbot.Portal.Blazor.Server/Pages/Articles/Latest.razor @@ -1,7 +1,9 @@ -@page "/articles/newest" +@page "/articles/latest" @using Newsbot.Collector.Client @using Newsbot.Collector.Client.Domain.Dto -

List Articles

+ +Latest +

Latest Posts

@@ -11,7 +13,10 @@
...
-
@item.Title
+
+ @item.Title +
+

@item.PubDate

@item.Description

View
diff --git a/Newsbot.Portal.Blazor.Server/Pages/Articles/ListBySource.razor b/Newsbot.Portal.Blazor.Server/Pages/Articles/ListBySource.razor index b64eaed..a97de87 100644 --- a/Newsbot.Portal.Blazor.Server/Pages/Articles/ListBySource.razor +++ b/Newsbot.Portal.Blazor.Server/Pages/Articles/ListBySource.razor @@ -2,32 +2,42 @@ @using Newsbot.Collector.Client.Domain.Dto @using Newsbot.Collector.Client -

ListBySource

+@Record?.Name +

@Record?.Name

- - - - - +
+
@foreach (var item in Data ??= new List()) { -
- - - +
+
+ ... +
+
+ @item.Title +
+

@item.PubDate

+

@item.Description

+ View +
+
+
} -
TitlePublish Date
- @item.Title
-
@item.PubDate
+
+
@code { [Parameter] public string? Id { get; set; } List? Data { get; set; } + SourcesDto? Record { get; set; } protected override async Task OnInitializedAsync() { + var s = new SourcesClient(Global.HttpClient, Global.DefaultInstanceUri ?? ""); + Record = await s.GetAsync(Guid.Parse(Id ?? "")); + var c = new ArticlesClient(Global.HttpClient, Global.DefaultInstanceUri ?? ""); var items = await c.ListBySourceAsync(Guid.Parse(Id ?? "")); Data = items; diff --git a/Newsbot.Portal.Blazor.Server/Pages/Articles/Sources.razor b/Newsbot.Portal.Blazor.Server/Pages/Articles/Sources.razor deleted file mode 100644 index 2d73d3b..0000000 --- a/Newsbot.Portal.Blazor.Server/Pages/Articles/Sources.razor +++ /dev/null @@ -1,33 +0,0 @@ -@page "/articles/sources" -@using Newsbot.Collector.Client -@using Newsbot.Collector.Client.Domain.Dto -

Select Source

- - - - - - - -@foreach (var item in Items ??= new List()) -{ - - - - - -} -
SourceNameType
@item.Source - @item.Name - @item.Type
- -@code { - private List? Items { get; set; } - - protected override async Task OnInitializedAsync() - { - var c = new SourcesClient(Global.HttpClient, Global.DefaultInstanceUri ?? ""); - Items = await c.ListAsync(); - - } -} \ No newline at end of file diff --git a/Newsbot.Portal.Blazor.Server/Pages/Sources/List.razor b/Newsbot.Portal.Blazor.Server/Pages/Sources/List.razor index aa1b953..c4f10b0 100644 --- a/Newsbot.Portal.Blazor.Server/Pages/Sources/List.razor +++ b/Newsbot.Portal.Blazor.Server/Pages/Sources/List.razor @@ -1,4 +1,4 @@ -@page "/sources/list" +@page "/sources" @using Newsbot.Collector.Client @using Newsbot.Collector.Client.Domain.Dto @@ -8,6 +8,7 @@ Title Publish Date + Tags @foreach (var item in Data ??= new List()) { @@ -21,12 +22,34 @@ @item.Name
@item.Source + @FlattenTags(@item.Tags ??= new List()) + + View News + } @code { - private List Data { get; set; } + private List? Data { get; set; } + + private string FlattenTags(List tags) + { + + string res = ""; + foreach (var tag in tags) + { + if (res == "") + { + res = tag; + } + else + { + res += $", {tag}"; + } + } + return res; + } protected override async Task OnInitializedAsync() { diff --git a/Newsbot.Portal.Blazor.Server/Shared/MainLayout.razor b/Newsbot.Portal.Blazor.Server/Shared/MainLayout.razor index c37bda4..a7cf3a1 100644 --- a/Newsbot.Portal.Blazor.Server/Shared/MainLayout.razor +++ b/Newsbot.Portal.Blazor.Server/Shared/MainLayout.razor @@ -1,6 +1,6 @@ @inherits LayoutComponentBase -Newsbot.Portal.Blazor.Server +Newsbot
+
diff --git a/Newsbot.Portal.Blazor.Server/Shared/NavMenu.razor b/Newsbot.Portal.Blazor.Server/Shared/NavMenu.razor index e1df8e5..3877dd3 100644 --- a/Newsbot.Portal.Blazor.Server/Shared/NavMenu.razor +++ b/Newsbot.Portal.Blazor.Server/Shared/NavMenu.razor @@ -1,6 +1,6 @@