updating deps, shifting pages and components into client library, using radzen layout
All checks were successful
ci / Build & Unit Test (8.0.x) (push) Successful in 2m24s
ci / Build Containers (push) Successful in 16m5s

This commit is contained in:
Andy Pack 2024-09-30 17:16:59 +01:00
parent 5ff8d3409b
commit 25f3934408
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
27 changed files with 185 additions and 393 deletions

View File

@ -12,7 +12,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="2.25.0" /> <PackageReference Include="MongoDB.Driver" Version="2.29.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -10,11 +10,17 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0"/> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="NUnit" Version="3.13.3"/> <PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1"/> <PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.6.1"/> <PackageReference Include="NUnit.Analyzers" Version="4.3.0">
<PackageReference Include="coverlet.collector" Version="6.0.0"/> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,5 +1,5 @@
@using Overflow.SouthernWater @using Overflow.SouthernWater
@rendermode RenderMode.InteractiveAuto @rendermode InteractiveRenderMode
<RadzenStack> <RadzenStack>
<RadzenStack Gap="0"> <RadzenStack Gap="0">

View File

@ -1,5 +1,5 @@
@using Overflow.SouthernWater @using Overflow.SouthernWater
@rendermode RenderMode.InteractiveAuto @rendermode InteractiveRenderMode
@inject DialogService DialogService @inject DialogService DialogService
@if (Job == null) @if (Job == null)

View File

@ -1,6 +1,6 @@
@using System.Globalization @using System.Globalization
@using Overflow.SouthernWater @using Overflow.SouthernWater
@rendermode RenderMode.InteractiveAuto @rendermode InteractiveRenderMode
@if (Job == null) @if (Job == null)
{ {

View File

@ -1,16 +1,37 @@
@inherits LayoutComponentBase @inherits LayoutComponentBase
<div class="page">
<div class="sidebar"> <RadzenLayout>
<RadzenHeader>
<NavMenu/> <NavMenu/>
</div> </RadzenHeader>
<RadzenBody>
<main> <div class="page">
<div class="top-row px-4"> <main>
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a> <article class="content px-4">
@Body
</article>
</main>
</div> </div>
</RadzenBody>
<RadzenFooter>
<div style="text-align: center">
<a href="https://sarsoo.xyz/about/" style="display: inline-block">
<img src="/andy.png"
alt="AP"
width="100px"
style="display: block;
margin-left: auto;
margin-right: auto;
filter: contrast(70%);">
</a>
</div>
</RadzenFooter>
</RadzenLayout>
<article class="content px-4"> <div id="blazor-error-ui">
@Body An unhandled error has occurred.
</article> <a href="" class="reload">Reload</a>
</main> <a class="dismiss">🗙</a>
</div> </div>
<RadzenComponents @rendermode="InteractiveRenderMode"/>

View File

@ -1,40 +1,25 @@
<div class="top-row ps-3 navbar navbar-dark"> @rendermode InteractiveRenderMode
<div class="container-fluid">
<a class="navbar-brand" href="">Overflow.Web.Client</a>
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span>
</button>
</div>
</div>
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu"> <RadzenMenu Click="OnParentClicked" Style="height:100%;">
<nav class="flex-column"> <RadzenMenuItem Text="Home" Icon="home" Path="/">
<div class="nav-item px-3"> </RadzenMenuItem>
<NavLink class="nav-link" href="" Match="NavLinkMatch.All"> <RadzenMenuItem Text="Southern Water" Icon="water_drop">
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home <RadzenMenuItem Text="About" Path="/sw-about" Icon="apartment"></RadzenMenuItem>
</NavLink> <RadzenMenuItem Text="Spills Data" Path="/spills" Icon="table_view"></RadzenMenuItem>
</div> <RadzenMenuItem Text="Spill Events" Path="/spills-cal" Icon="event"></RadzenMenuItem>
<div class="nav-item px-3"> </RadzenMenuItem>
<NavLink class="nav-link" href="counter"> <RadzenAppearanceToggle />
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter </RadzenMenu>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="weather">
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather
</NavLink>
</div>
</nav>
</div>
@code { @code {
private bool collapseNavMenu = true;
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; void OnParentClicked(MenuItemEventArgs args)
{
private void ToggleNavMenu()
{
collapseNavMenu = !collapseNavMenu;
}
} }
void OnChildClicked(MenuItemEventArgs args)
{
}
}

View File

@ -9,9 +9,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.6" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all"/> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
<PackageReference Include="Radzen.Blazor" Version="4.32.6" /> <PackageReference Include="Radzen.Blazor" Version="5.2.5" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,19 +0,0 @@
@page "/counter"
<PageTitle>Counter</PageTitle>
<h1>Counter</h1>
<p role="status">Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private int currentCount = 0;
private void IncrementCount()
{
currentCount++;
}
}

View File

@ -1,7 +1,59 @@
@page "/" @page "/"
<PageTitle>Home</PageTitle> <PageTitle>Overflow</PageTitle>
<h1>Hello, world!</h1> <div class="rz-p-12">
<RadzenText TextStyle="TextStyle.DisplayH1">Overflow</RadzenText>
</div>
Welcome to your new app. <div>
<RadzenRow class="rz-text-align-center" Gap="1rem">
<RadzenColumn class="rz-p-3">
<RadzenCard>
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Start" Gap="1rem" Class="rz-p-4">
<RadzenIcon Icon="shower"/>
<RadzenStack Gap="0">
<RadzenText TextStyle="TextStyle.Subtitle1">Woops</RadzenText>
</RadzenStack>
</RadzenStack>
<p>During times of overwhelming rainfall in the UK, storm overflows release unprocessed sewage into waterways and oceans to avoid sewage systems backing up and eventually flooding.</p>
<p>There have been controversies for many of the private water companies of the UK that suggest these storm overflows are overused - contaminating British waterways and oceans.</p>
</RadzenCard>
</RadzenColumn>
<RadzenColumn class="rz-p-3">
<RadzenCard>
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Start" Gap="1rem" Class="rz-p-4">
<RadzenIcon Icon="monitor"/>
<RadzenStack Gap="0">
<RadzenText TextStyle="TextStyle.Subtitle1">Having a look</RadzenText>
</RadzenStack>
</RadzenStack>
<p>I have found that the websites that the water companies use to report overflow usage can be poor at best. Overflow aims to cache this data and present it in an easier to consume fashion</p>
</RadzenCard>
</RadzenColumn>
<RadzenColumn class="rz-p-3">
<RadzenCard>
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Start" Gap="1rem" Class="rz-p-4">
<RadzenIcon Icon="water_drop"/>
<RadzenStack Gap="0">
<RadzenText TextStyle="TextStyle.Subtitle1">Context</RadzenText>
</RadzenStack>
</RadzenStack>
<p>Like a lot of UK public infrastructure, the water utility companies were privatised in the 1980s.</p>
<p>The UK is one of very few countries to have a fully privatised water system and was the first to do so.</p>
</RadzenCard>
</RadzenColumn>
<RadzenColumn class="rz-p-3">
<RadzenCard>
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Start" Gap="1rem" Class="rz-p-4">
<RadzenIcon Icon="currency_pound"/>
<RadzenStack Gap="0">
<RadzenText TextStyle="TextStyle.Subtitle1">Investment/Plundering</RadzenText>
</RadzenStack>
</RadzenStack>
While <RadzenLink Path="https://www.ofwat.gov.uk/investment-in-the-water-industry/#qu1" Text="OFWAT suggests" target="_blank"/> that investment in UK water systems has only increased since privatisation,
<RadzenLink Path="https://www.bbc.co.uk/news/articles/cw4478wnjdpo" Text="Research from the University of Greenwich" target="_blank"/> has found that investors have managed to withdraw £85.2bn between 1989 and 2023.
</RadzenCard>
</RadzenColumn>
</RadzenRow>
</div>

View File

@ -1,7 +1,7 @@
@page "/spills" @page "/spills"
@using MongoDB.Driver @using MongoDB.Driver
@using Overflow.SouthernWater @using Overflow.SouthernWater
@rendermode RenderMode.InteractiveServer @rendermode InteractiveRenderMode
<PageTitle>Southern Water Spills</PageTitle> <PageTitle>Southern Water Spills</PageTitle>

View File

@ -1,7 +1,7 @@
@page "/spills-cal" @page "/spills-cal"
@using MongoDB.Driver @using MongoDB.Driver
@using Overflow.SouthernWater @using Overflow.SouthernWater
@rendermode RenderMode.InteractiveServer @rendermode InteractiveRenderMode
<PageTitle>Southern Water Spills</PageTitle> <PageTitle>Southern Water Spills</PageTitle>

View File

@ -1,60 +0,0 @@
@page "/weather"
@inject HttpClient Http
<PageTitle>Weather</PageTitle>
<h1>Weather</h1>
<p>This component demonstrates fetching data from the server.</p>
@if (forecasts == null)
{
<p>
<em>Loading...</em>
</p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
</tbody>
</table>
}
@code {
private WeatherForecast[]? forecasts;
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
}
public class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public string? Summary { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}

View File

@ -0,0 +1,8 @@
using Microsoft.AspNetCore.Components;
namespace Overflow.Web.Client;
public static class RenderModeSettings
{
public static IComponentRenderMode? InteractiveRenderMode { get; set; }
}

View File

@ -3,10 +3,13 @@
@using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web @using Microsoft.AspNetCore.Components.Web
@using static Microsoft.AspNetCore.Components.Web.RenderMode
@using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop @using Microsoft.JSInterop
@using Overflow.Web.Client @using Overflow.Web
@using Overflow.Web.Client.Pages
@using Overflow.Web.Client.Components
@using Overflow.Web.Client.Layout @using Overflow.Web.Client.Layout
@using Radzen @using Radzen
@using Radzen.Blazor @using Radzen.Blazor
@using static RenderModeSettings

View File

@ -5,11 +5,12 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<base href="/"/> <base href="/"/>
<link rel="stylesheet" href="_content/Radzen.Blazor/css/material-base.css">
<link rel="stylesheet" href="bootstrap/bootstrap.min.css"/> <link rel="stylesheet" href="bootstrap/bootstrap.min.css"/>
<link rel="stylesheet" href="app.css"/> <link rel="stylesheet" href="app.css"/>
<link rel="stylesheet" href="Overflow.Web.styles.css"/> <link rel="stylesheet" href="Overflow.Web.styles.css"/>
<link rel="stylesheet" href="Overflow.Web.Client.styles.css"/>
<link rel="icon" type="image/png" href="favicon.png"/> <link rel="icon" type="image/png" href="favicon.png"/>
<RadzenTheme Theme="material-dark" @rendermode="InteractiveRenderMode" />
<HeadOutlet/> <HeadOutlet/>
</head> </head>
@ -19,22 +20,4 @@
<script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script> <script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
</body> </body>
<footer class="footer text-muted" style="margin-top: 50px">
<div class="container">
&copy; 2024 - Overflow
</div>
<div style="text-align: center">
<a href="https://sarsoo.xyz/about/" style="display: inline-block">
<img src="/andy.png"
alt="AP"
width="120px"
style="display: block;
margin-left: auto;
margin-right: auto;
filter: contrast(70%);
padding: 8px">
</a>
</div>
</footer>
</html> </html>

View File

@ -1,19 +0,0 @@
@inherits LayoutComponentBase
<NavMenu/>
<div class="page">
<main>
<article class="content px-4">
@Body
</article>
</main>
</div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<RadzenComponents @rendermode="InteractiveServer"/>

View File

@ -1,96 +0,0 @@
.page {
position: relative;
display: flex;
flex-direction: column;
}
main {
flex: 1;
}
.sidebar {
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
}
.top-row {
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
}
.top-row ::deep a, .top-row ::deep .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
text-decoration: none;
}
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
text-decoration: underline;
}
.top-row ::deep a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
@media (max-width: 640.98px) {
.top-row {
justify-content: space-between;
}
.top-row ::deep a, .top-row ::deep .btn-link {
margin-left: 0;
}
}
@media (min-width: 641px) {
.page {
flex-direction: row;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row.auth ::deep a:first-child {
flex: 1;
text-align: right;
width: 0;
}
.top-row, article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}
#blazor-error-ui {
background: lightyellow;
bottom: 0;
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
display: none;
left: 0;
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
position: fixed;
width: 100%;
z-index: 1000;
}
#blazor-error-ui .dismiss {
cursor: pointer;
position: absolute;
right: 0.75rem;
top: 0.5rem;
}

View File

@ -1,24 +0,0 @@
@rendermode InteractiveServer
<RadzenMenu Click="OnParentClicked">
<RadzenMenuItem Text="Home" Icon="home" Path="/">
</RadzenMenuItem>
<RadzenMenuItem Text="Southern Water" Icon="water_drop">
<RadzenMenuItem Text="About" Path="/sw-about" Icon="apartment"></RadzenMenuItem>
<RadzenMenuItem Text="Spills Data" Path="/spills" Icon="table_view"></RadzenMenuItem>
<RadzenMenuItem Text="Spill Events" Path="/spills-cal" Icon="event"></RadzenMenuItem>
</RadzenMenuItem>
</RadzenMenu>
@code {
void OnParentClicked(MenuItemEventArgs args)
{
}
void OnChildClicked(MenuItemEventArgs args)
{
}
}

View File

@ -1,59 +0,0 @@
@page "/"
<PageTitle>Overflow</PageTitle>
<div class="rz-p-12">
<RadzenText TextStyle="TextStyle.DisplayH1">Overflow</RadzenText>
</div>
<div>
<RadzenRow class="rz-text-align-center" Gap="1rem">
<RadzenColumn class="rz-p-3">
<RadzenCard>
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Start" Gap="1rem" Class="rz-p-4">
<RadzenIcon Icon="shower"/>
<RadzenStack Gap="0">
<RadzenText TextStyle="TextStyle.Subtitle1">Woops</RadzenText>
</RadzenStack>
</RadzenStack>
<p>During times of overwhelming rainfall in the UK, storm overflows release unprocessed sewage into waterways and oceans to avoid sewage systems backing up and eventually flooding.</p>
<p>There have been controversies for many of the private water companies of the UK that suggest these storm overflows are overused - contaminating British waterways and oceans.</p>
</RadzenCard>
</RadzenColumn>
<RadzenColumn class="rz-p-3">
<RadzenCard>
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Start" Gap="1rem" Class="rz-p-4">
<RadzenIcon Icon="monitor"/>
<RadzenStack Gap="0">
<RadzenText TextStyle="TextStyle.Subtitle1">Having a look</RadzenText>
</RadzenStack>
</RadzenStack>
<p>I have found that the websites that the water companies use to report overflow usage can be poor at best. Overflow aims to cache this data and present it in an easier to consume fashion</p>
</RadzenCard>
</RadzenColumn>
<RadzenColumn class="rz-p-3">
<RadzenCard>
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Start" Gap="1rem" Class="rz-p-4">
<RadzenIcon Icon="water_drop"/>
<RadzenStack Gap="0">
<RadzenText TextStyle="TextStyle.Subtitle1">Context</RadzenText>
</RadzenStack>
</RadzenStack>
<p>Like a lot of UK public infrastructure, the water utility companies were privatised in the 1980s.</p>
<p>The UK is one of very few countries to have a fully privatised water system and was the first to do so.</p>
</RadzenCard>
</RadzenColumn>
<RadzenColumn class="rz-p-3">
<RadzenCard>
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Start" Gap="1rem" Class="rz-p-4">
<RadzenIcon Icon="currency_pound"/>
<RadzenStack Gap="0">
<RadzenText TextStyle="TextStyle.Subtitle1">Investment/Plundering</RadzenText>
</RadzenStack>
</RadzenStack>
While <RadzenLink Path="https://www.ofwat.gov.uk/investment-in-the-water-industry/#qu1" Text="OFWAT suggests" target="_blank"/> that investment in UK water systems has only increased since privatisation,
<RadzenLink Path="https://www.bbc.co.uk/news/articles/cw4478wnjdpo" Text="Research from the University of Greenwich" target="_blank"/> has found that investors have managed to withdraw £85.2bn between 1989 and 2023.
</RadzenCard>
</RadzenColumn>
</RadzenRow>
</div>

View File

@ -1,6 +1,7 @@
<Router AppAssembly="@typeof(Program).Assembly"> <Router AppAssembly="@typeof(Program).Assembly"
AdditionalAssemblies="new[] {typeof(Overflow.Web.Client.Components.SpillsCalendar).Assembly}">
<Found Context="routeData"> <Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(Layout.MainLayout)"/> <RouteView RouteData="@routeData" DefaultLayout="@typeof(Overflow.Web.Client.Layout.MainLayout)"/>
<FocusOnNavigate RouteData="@routeData" Selector="h1"/> <FocusOnNavigate RouteData="@routeData" Selector="h1"/>
</Found> </Found>
</Router> </Router>

View File

@ -12,3 +12,4 @@
@using Overflow.Web.Client.Components @using Overflow.Web.Client.Components
@using Radzen @using Radzen
@using Radzen.Blazor @using Radzen.Blazor
@using static Overflow.Web.Client.RenderModeSettings

View File

@ -7,16 +7,16 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.6" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.8" />
<PackageReference Include="MongoDB.Driver" Version="2.25.0" /> <PackageReference Include="MongoDB.Driver" Version="2.29.0" />
<PackageReference Include="NLog" Version="5.3.2" /> <PackageReference Include="NLog" Version="5.3.4" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.11" /> <PackageReference Include="NLog.Extensions.Logging" Version="5.3.14" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.11" /> <PackageReference Include="NLog.Web.AspNetCore" Version="5.3.14" />
<PackageReference Include="Quartz" Version="3.9.0" /> <PackageReference Include="Quartz" Version="3.13.0" />
<PackageReference Include="Quartz.AspNetCore" Version="3.9.0" /> <PackageReference Include="Quartz.AspNetCore" Version="3.13.0" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.9.0" /> <PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.13.0" />
<PackageReference Include="Quartz.Extensions.Hosting" Version="3.9.0" /> <PackageReference Include="Quartz.Extensions.Hosting" Version="3.13.0" />
<PackageReference Include="Radzen.Blazor" Version="4.32.6" /> <PackageReference Include="Radzen.Blazor" Version="5.2.5" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -37,4 +37,8 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Components\Layout\" />
</ItemGroup>
</Project> </Project>

View File

@ -1,34 +1,38 @@
using Overflow.Web.Components; using Microsoft.AspNetCore.Components.Web;
using Overflow; using Overflow;
using MongoDB.Driver; using MongoDB.Driver;
using NLog.Extensions.Logging; using NLog.Extensions.Logging;
using Overflow.SouthernWater; using Overflow.SouthernWater;
using Overflow.Web.Client;
using Quartz; using Quartz;
using Quartz.AspNetCore; using Quartz.AspNetCore;
using Radzen; using Radzen;
using App = Overflow.Web.Components.App;
RenderModeSettings.InteractiveRenderMode = RenderMode.InteractiveAuto;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// Add services to the container. // Add services to the container.
builder.Services.AddRazorComponents() builder.Services.AddRazorComponents()
.AddInteractiveServerComponents() .AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents(); .AddInteractiveWebAssemblyComponents();
builder.Logging.ClearProviders(); builder.Logging.ClearProviders();
builder.Logging.AddNLog(builder.Configuration); builder.Logging.AddNLog(builder.Configuration);
var driver = new MongoClient(builder.Configuration.GetConnectionString("Default")); var driver = new MongoClient(builder.Configuration.GetConnectionString("Default"));
builder.Services.AddSingleton(driver); builder.Services.AddSingleton(driver)
builder.Services.AddScoped<IMongoDatabase>(s => s.GetRequiredService<MongoClient>().GetDatabase(Static.DatabaseName)); .AddScoped<IMongoDatabase>(s => s.GetRequiredService<MongoClient>().GetDatabase(Static.DatabaseName));
builder.Services.AddControllers(); builder.Services.AddControllers();
// base configuration from appsettings.json // base configuration from appsettings.json
builder.Services.Configure<QuartzOptions>(builder.Configuration.GetSection("Quartz")); builder.Services.Configure<QuartzOptions>(builder.Configuration.GetSection("Quartz"))
// if you are using persistent job store, you might want to alter some options // if you are using persistent job store, you might want to alter some options
builder.Services.Configure<QuartzOptions>(options => .Configure<QuartzOptions>(options =>
{ {
options.Scheduling.IgnoreDuplicates = true; // default: false options.Scheduling.IgnoreDuplicates = true; // default: false
options.Scheduling.OverWriteExistingData = true; // default: true options.Scheduling.OverWriteExistingData = true; // default: true
@ -85,14 +89,14 @@ builder.Services.AddQuartzServer(options =>
options.WaitForJobsToComplete = false; options.WaitForJobsToComplete = false;
}); });
builder.Services.AddHttpClient(); builder.Services.AddHttpClient()
builder.Services.AddSingleton<SouthernWaterApi>(); .AddSingleton<SouthernWaterApi>()
builder.Services.AddScoped<SouthernWaterApiJobRunner, SouthernWaterApiJobRunnerPersisting>(); .AddScoped<SouthernWaterApiJobRunner, SouthernWaterApiJobRunnerPersisting>()
builder.Services.AddTransient<SouthernWaterJob>(); .AddTransient<SouthernWaterJob>();
builder.Services.AddSingleton<SpillCache>(); builder.Services.AddSingleton<SpillCache>()
builder.Services.AddSingleton<SouthernWaterSpillCache>(); .AddSingleton<SouthernWaterSpillCache>()
builder.Services.AddHostedService<LoadCacheOnStart>(); .AddHostedService<LoadCacheOnStart>();
builder.Services.AddRadzenComponents(); builder.Services.AddRadzenComponents();
@ -108,11 +112,12 @@ if (!app.Environment.IsDevelopment())
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseStaticFiles(); app.UseStaticFiles()
app.UseAntiforgery(); .UseAntiforgery();
app.MapControllers(); app.MapControllers();
app.MapRazorComponents<App>() app.MapRazorComponents<App>()
.AddAdditionalAssemblies(typeof(Overflow.Web.Client.Components.SpillsCalendar).Assembly)
.AddInteractiveServerRenderMode() .AddInteractiveServerRenderMode()
.AddInteractiveWebAssemblyRenderMode(); .AddInteractiveWebAssemblyRenderMode();

View File

@ -8,12 +8,12 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="MongoDB.Driver" Version="2.25.0" /> <PackageReference Include="MongoDB.Driver" Version="2.29.0" />
<PackageReference Include="Quartz" Version="3.9.0" /> <PackageReference Include="Quartz" Version="3.13.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>