Compare commits
No commits in common. "4fd51e24d0d49e38de53411731de8ef50f805e0e" and "f77481152f8f4d9662ae9ffaf4a2e1775a3b7f7a" have entirely different histories.
4fd51e24d0
...
f77481152f
@ -1,3 +0,0 @@
|
|||||||
appsettings.json
|
|
||||||
**/bin/
|
|
||||||
**/obj/
|
|
12
.drone.yml
12
.drone.yml
@ -6,17 +6,15 @@ name: build
|
|||||||
steps:
|
steps:
|
||||||
- name: build image
|
- name: build image
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
environment:
|
|
||||||
PAT:
|
|
||||||
from_secret: DockerPushPat
|
|
||||||
settings:
|
settings:
|
||||||
username: jtom38
|
repo: 192.168.1.196:5000/jtom38/newsbot-portal
|
||||||
password: $PAT
|
registry: 192.168.1.196:5000
|
||||||
repo: jtom38/newsbot-portal
|
insecure: true
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- master
|
- master
|
||||||
- releases/*
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
|
@ -2,6 +2,6 @@ namespace Newsbot.Portal.Blazor.Server;
|
|||||||
|
|
||||||
public static class Global
|
public static class Global
|
||||||
{
|
{
|
||||||
public static HttpClient? HttpClient { get; set; }
|
public static HttpClient HttpClient { get; set; }
|
||||||
public static string? DefaultInstanceUri { get; set; }
|
public static string? DefaultInstanceUri { get; set; }
|
||||||
}
|
}
|
@ -7,6 +7,12 @@
|
|||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="..\.dockerignore">
|
||||||
|
<Link>.dockerignore</Link>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Newsbot.Collector.Client\Newsbot.Collector.Client.csproj" />
|
<ProjectReference Include="..\Newsbot.Collector.Client\Newsbot.Collector.Client.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -2,42 +2,32 @@
|
|||||||
@using Newsbot.Collector.Client.Domain.Dto
|
@using Newsbot.Collector.Client.Domain.Dto
|
||||||
@using Newsbot.Collector.Client
|
@using Newsbot.Collector.Client
|
||||||
|
|
||||||
<PageTitle>@Record?.Name</PageTitle>
|
<h3>ListBySource</h3>
|
||||||
<h3>@Record?.Name</h3>
|
|
||||||
|
|
||||||
<div class="container">
|
<table>
|
||||||
<div class="row">
|
<tr>
|
||||||
|
<td>Title</td>
|
||||||
|
<td>Publish Date</td>
|
||||||
|
</tr>
|
||||||
@foreach (var item in Data ??= new List<ArticlesDto>())
|
@foreach (var item in Data ??= new List<ArticlesDto>())
|
||||||
{
|
{
|
||||||
<div class="col-sm">
|
<tr>
|
||||||
<div class="card" style="width: 18rem;">
|
<td>
|
||||||
<img src="@item.Thumbnail" class="card-img-top" alt="...">
|
<a href="@item.Url" target="_blank">@item.Title</a><br/>
|
||||||
<div class="card-body">
|
</td>
|
||||||
<h5 class="card-title">
|
<td>@item.PubDate</td>
|
||||||
<a href="@item.Url" target="_blank">@item.Title</a>
|
</tr>
|
||||||
</h5>
|
|
||||||
<p class="card-text">@item.PubDate</p>
|
|
||||||
<p class="card-text">@item.Description</p>
|
|
||||||
<a href="@item.Url" class="btn btn-primary" target="_blank">View</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
</div>
|
</table>
|
||||||
</div>
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string? Id { get; set; }
|
public string? Id { get; set; }
|
||||||
|
|
||||||
List<ArticlesDto>? Data { get; set; }
|
List<ArticlesDto>? Data { get; set; }
|
||||||
SourcesDto? Record { get; set; }
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
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 c = new ArticlesClient(Global.HttpClient, Global.DefaultInstanceUri ?? "");
|
||||||
var items = await c.ListBySourceAsync(Guid.Parse(Id ?? ""));
|
var items = await c.ListBySourceAsync(Guid.Parse(Id ?? ""));
|
||||||
Data = items;
|
Data = items;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
@page "/articles/latest"
|
@page "/articles/newest"
|
||||||
@using Newsbot.Collector.Client
|
@using Newsbot.Collector.Client
|
||||||
@using Newsbot.Collector.Client.Domain.Dto
|
@using Newsbot.Collector.Client.Domain.Dto
|
||||||
|
<h3>List Articles</h3>
|
||||||
<PageTitle>Latest</PageTitle>
|
|
||||||
<h3>Latest Posts</h3>
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -13,10 +11,7 @@
|
|||||||
<div class="card" style="width: 18rem;">
|
<div class="card" style="width: 18rem;">
|
||||||
<img src="@item.Thumbnail" class="card-img-top" alt="...">
|
<img src="@item.Thumbnail" class="card-img-top" alt="...">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">
|
<h5 class="card-title">@item.Title</h5>
|
||||||
<a href="@item.Url" target="_blank">@item.Title</a>
|
|
||||||
</h5>
|
|
||||||
<p class="card-text">@item.PubDate</p>
|
|
||||||
<p class="card-text">@item.Description</p>
|
<p class="card-text">@item.Description</p>
|
||||||
<a href="@item.Url" class="btn btn-primary" target="_blank">View</a>
|
<a href="@item.Url" class="btn btn-primary" target="_blank">View</a>
|
||||||
</div>
|
</div>
|
33
Newsbot.Portal.Blazor.Server/Pages/Articles/Sources.razor
Normal file
33
Newsbot.Portal.Blazor.Server/Pages/Articles/Sources.razor
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
@page "/articles/sources"
|
||||||
|
@using Newsbot.Collector.Client
|
||||||
|
@using Newsbot.Collector.Client.Domain.Dto
|
||||||
|
<h3>Select Source</h3>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>Source</td>
|
||||||
|
<td>Name</td>
|
||||||
|
<td>Type</td>
|
||||||
|
</tr>
|
||||||
|
@foreach (var item in Items ??= new List<SourcesDto>())
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>@item.Source</td>
|
||||||
|
<td>
|
||||||
|
<a href="/articles/sources/@item.Id">@item.Name</a>
|
||||||
|
</td>
|
||||||
|
<td>@item.Type</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private List<SourcesDto>? Items { get; set; }
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
var c = new SourcesClient(Global.HttpClient, Global.DefaultInstanceUri ?? "");
|
||||||
|
Items = await c.ListAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
@page "/sources"
|
@page "/sources/list"
|
||||||
@using Newsbot.Collector.Client
|
@using Newsbot.Collector.Client
|
||||||
@using Newsbot.Collector.Client.Domain.Dto
|
@using Newsbot.Collector.Client.Domain.Dto
|
||||||
|
|
||||||
@ -8,7 +8,6 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>Title</td>
|
<td>Title</td>
|
||||||
<td>Publish Date</td>
|
<td>Publish Date</td>
|
||||||
<td>Tags</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
@foreach (var item in Data ??= new List<SourcesDto>())
|
@foreach (var item in Data ??= new List<SourcesDto>())
|
||||||
{
|
{
|
||||||
@ -22,34 +21,12 @@
|
|||||||
<a href="@item.Url" target="_blank">@item.Name</a><br/>
|
<a href="@item.Url" target="_blank">@item.Name</a><br/>
|
||||||
</td>
|
</td>
|
||||||
<td>@item.Source</td>
|
<td>@item.Source</td>
|
||||||
<td>@FlattenTags(@item.Tags ??= new List<string>())</td>
|
|
||||||
<td>
|
|
||||||
<a href="/articles/sources/@item.Id">View News</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<SourcesDto>? Data { get; set; }
|
private List<SourcesDto> Data { get; set; }
|
||||||
|
|
||||||
private string FlattenTags(List<string> tags)
|
|
||||||
{
|
|
||||||
|
|
||||||
string res = "";
|
|
||||||
foreach (var tag in tags)
|
|
||||||
{
|
|
||||||
if (res == "")
|
|
||||||
{
|
|
||||||
res = tag;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
res += $", {tag}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
|
|
||||||
<PageTitle>Newsbot</PageTitle>
|
<PageTitle>Newsbot.Portal.Blazor.Server</PageTitle>
|
||||||
|
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
@ -8,10 +8,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
<div class="top-row px-4">
|
<div class="top-row px-4">
|
||||||
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
|
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
|
||||||
<a href="">Login</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<article class="content px-4">
|
<article class="content px-4">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div class="top-row ps-3 navbar navbar-dark">
|
<div class="top-row ps-3 navbar navbar-dark">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand" href="">Newsbot</a>
|
<a class="navbar-brand" href="">Newsbot.Portal.Blazor.Server</a>
|
||||||
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
|
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
@ -20,8 +20,8 @@
|
|||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-item px-3">
|
<div class="nav-item px-3">
|
||||||
<NavLink class="nav-link" href="sources">
|
<NavLink class="nav-link" href="sources/list">
|
||||||
<span class="oi oi-list-rich" aria-hidden="true"></span> Sources
|
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
version: "3"
|
|
||||||
|
|
||||||
networks:
|
|
||||||
newsbot:
|
|
||||||
|
|
||||||
services:
|
|
||||||
portal:
|
|
||||||
image: newsbot.portal:latest
|
|
||||||
environment:
|
|
||||||
Logging__LogLevel__Default: "Information"
|
|
||||||
Logging__LogLevel__Microsoft.AspNetCore: "Warning"
|
|
||||||
DefaultInstanceUri: "http://192.168.1.225:5001"
|
|
||||||
ports:
|
|
||||||
- "5002:80"
|
|
||||||
networks:
|
|
||||||
- newsbot
|
|
20
makefile
20
makefile
@ -1,20 +0,0 @@
|
|||||||
.PHONY: help
|
|
||||||
help: ## Shows this help command
|
|
||||||
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
|
||||||
|
|
||||||
build: ## builds the application
|
|
||||||
dotnet restore
|
|
||||||
dotnet build
|
|
||||||
|
|
||||||
pub: ## Build and publish the artifacts
|
|
||||||
dotnet restore
|
|
||||||
dotnet publish -o out
|
|
||||||
rm ./out/appsettings.json
|
|
||||||
|
|
||||||
docker-build: ## Generates the docker image
|
|
||||||
docker build -t "newsbot.portal" .
|
|
||||||
docker image ls | grep newsbot.portal
|
|
||||||
|
|
||||||
docker-run: ## Runs the docker compose
|
|
||||||
docker compose up -d
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user