Compare commits

..

No commits in common. "25f39344083f7ece04ba599913e369b6db731520" and "ef67e172979a3ebe4f353e1cba3cbab0f51b5452" have entirely different histories.

29 changed files with 397 additions and 307 deletions

View File

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

View File

@ -10,17 +10,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0"/>
<PackageReference Include="NUnit" Version="4.2.2" /> <PackageReference Include="NUnit" Version="3.13.3"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" /> <PackageReference Include="NUnit3TestAdapter" Version="4.2.1"/>
<PackageReference Include="NUnit.Analyzers" Version="4.3.0"> <PackageReference Include="NUnit.Analyzers" Version="3.6.1"/>
<PrivateAssets>all</PrivateAssets> <PackageReference Include="coverlet.collector" Version="6.0.0"/>
<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 InteractiveRenderMode @rendermode RenderMode.InteractiveAuto
<RadzenStack> <RadzenStack>
<RadzenStack Gap="0"> <RadzenStack Gap="0">

View File

@ -1,5 +1,5 @@
@using Overflow.SouthernWater @using Overflow.SouthernWater
@rendermode InteractiveRenderMode @rendermode RenderMode.InteractiveAuto
@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 InteractiveRenderMode @rendermode RenderMode.InteractiveAuto
@if (Job == null) @if (Job == null)
{ {

View File

@ -1,37 +1,16 @@
@inherits LayoutComponentBase @inherits LayoutComponentBase
<div class="page">
<RadzenLayout> <div class="sidebar">
<RadzenHeader>
<NavMenu/> <NavMenu/>
</RadzenHeader> </div>
<RadzenBody>
<div class="page">
<main>
<article class="content px-4">
@Body
</article>
</main>
</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>
<div id="blazor-error-ui"> <main>
An unhandled error has occurred. <div class="top-row px-4">
<a href="" class="reload">Reload</a> <a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
<a class="dismiss">🗙</a> </div>
</div>
<RadzenComponents @rendermode="InteractiveRenderMode"/> <article class="content px-4">
@Body
</article>
</main>
</div>

View File

@ -1,25 +1,40 @@
@rendermode InteractiveRenderMode <div class="top-row ps-3 navbar navbar-dark">
<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>
<RadzenMenu Click="OnParentClicked" Style="height:100%;"> <div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
<RadzenMenuItem Text="Home" Icon="home" Path="/"> <nav class="flex-column">
</RadzenMenuItem> <div class="nav-item px-3">
<RadzenMenuItem Text="Southern Water" Icon="water_drop"> <NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<RadzenMenuItem Text="About" Path="/sw-about" Icon="apartment"></RadzenMenuItem> <span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
<RadzenMenuItem Text="Spills Data" Path="/spills" Icon="table_view"></RadzenMenuItem> </NavLink>
<RadzenMenuItem Text="Spill Events" Path="/spills-cal" Icon="event"></RadzenMenuItem> </div>
</RadzenMenuItem> <div class="nav-item px-3">
<RadzenAppearanceToggle /> <NavLink class="nav-link" href="counter">
</RadzenMenu> <span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter
</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;
void OnParentClicked(MenuItemEventArgs args) private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
{
} 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.8" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all"/>
<PackageReference Include="Radzen.Blazor" Version="5.2.5" /> <PackageReference Include="Radzen.Blazor" Version="4.32.6" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,19 @@
@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,59 +1,7 @@
@page "/" @page "/"
<PageTitle>Overflow</PageTitle> <PageTitle>Home</PageTitle>
<div class="rz-p-12"> <h1>Hello, world!</h1>
<RadzenText TextStyle="TextStyle.DisplayH1">Overflow</RadzenText>
</div>
<div> Welcome to your new app.
<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,117 +0,0 @@
@page "/sw-about"
<PageTitle>Southern Water</PageTitle>
<div class="rz-p-12">
<RadzenText TextStyle="TextStyle.DisplayH1">Southern Water</RadzenText>
</div>
<div Class="rz-p-0 rz-p-md-12">
<RadzenTimeline Orientation="Orientation.Vertical" LinePosition="LinePosition.Center" Reverse="false" Class="rz-m-4">
<Items>
<RadzenTimelineItem PointStyle="PointStyle.Primary">
<LabelContent>
<RadzenText TextStyle="TextStyle.Subtitle2" Class="rz-m-0 rz-color-primary">JUL 1989</RadzenText>
</LabelContent>
<ChildContent>
Southern Water Ltd. is formed from Southern Water Authority
</ChildContent>
</RadzenTimelineItem>
<RadzenTimelineItem>
<LabelContent>
<RadzenText TextStyle="TextStyle.Subtitle2" Class="rz-m-0 rz-color-primary">JUN 1996</RadzenText>
</LabelContent>
<ChildContent>
Southern Water overtaken by Scottish Power in a hostile takeover. Majority of in-house scientific laboratory services and assets sold off
</ChildContent>
</RadzenTimelineItem>
<RadzenTimelineItem>
<LabelContent>
<RadzenText TextStyle="TextStyle.Subtitle2" Class="rz-m-0 rz-color-primary">MAR 2002</RadzenText>
</LabelContent>
<ChildContent>
Scottish Power sells Southern Water to First Aqua Limited
</ChildContent>
</RadzenTimelineItem>
<RadzenTimelineItem>
<LabelContent>
<RadzenText TextStyle="TextStyle.Subtitle2" Class="rz-m-0 rz-color-primary">OCT 2007</RadzenText>
</LabelContent>
<ChildContent>
Greensands Investments Limited buys Southern Water
</ChildContent>
</RadzenTimelineItem>
<RadzenTimelineItem>
<LabelContent>
<RadzenText TextStyle="TextStyle.Subtitle2" Class="rz-m-0 rz-color-primary">MAY 2007</RadzenText>
</LabelContent>
<ChildContent>
<RadzenLink Path="https://www.kentonline.co.uk/kent/news/southern-water-fined-after-herne-a66532/" Text="£10,000 fine after sewage spills into stream in Beltinge, Kent - polluting 550 yards of Bishopstone Glen" target="_blank"></RadzenLink>
</ChildContent>
</RadzenTimelineItem>
<RadzenTimelineItem>
<LabelContent>
<RadzenText TextStyle="TextStyle.Subtitle2" Class="rz-m-0 rz-color-primary">NOV 2007</RadzenText>
</LabelContent>
<ChildContent>
<RadzenLink Path="https://www.theguardian.com/business/2007/nov/15/southernwater" Text="OFWAT fine of £20.3m for 'deliberate misreporting' and failing to meet guaranteed standards of service to customers" target="_blank"></RadzenLink>
</ChildContent>
</RadzenTimelineItem>
<RadzenTimelineItem>
<LabelContent>
<RadzenText TextStyle="TextStyle.Subtitle2" Class="rz-m-0 rz-color-primary">JUN 2010</RadzenText>
</LabelContent>
<ChildContent>
<RadzenLink Path="https://www.waterbriefing.org/index.php/home/company-news/item/1206-southern-water-fined-for-polluting-river-with-raw-sewage)" Text="£3,000 fine for polluting 2km of Sussex stream with raw sewage, killing up to 100 brown trout and devastating the fish population for the second time in five years" target="_blank"></RadzenLink>
</ChildContent>
</RadzenTimelineItem>
<RadzenTimelineItem>
<LabelContent>
<RadzenText TextStyle="TextStyle.Subtitle2" Class="rz-m-0 rz-color-primary">SEP 2011</RadzenText>
</LabelContent>
<ChildContent>
<RadzenLink Path="https://www.bbc.co.uk/news/uk-england-hampshire-15122040" Text="£25,000 fine when Southampton water is flooded by sewage" target="_blank"></RadzenLink>
</ChildContent>
</RadzenTimelineItem>
<RadzenTimelineItem>
<LabelContent>
<RadzenText TextStyle="TextStyle.Subtitle2" Class="rz-m-0 rz-color-primary">MAR 2012</RadzenText>
</LabelContent>
<ChildContent>
<RadzenLink Path="https://www.kentonline.co.uk/kent/news/southern-water-fined-after-herne-a66532/" Text="£50,000 fine after 60 houses in Beltinge, Kent are flooded with Sewage" target="_blank"></RadzenLink>
</ChildContent>
</RadzenTimelineItem>
<RadzenTimelineItem>
<LabelContent>
<RadzenText TextStyle="TextStyle.Subtitle2" Class="rz-m-0 rz-color-primary">2020/2021</RadzenText>
</LabelContent>
<ChildContent>
<RadzenLink Path="https://www.portsmouth.co.uk/business/southern-water-bosses-handed-bonuses-totalling-ps840000-3313892" Text="CEO & CFO get £840,000 of bonuses" target="_blank"></RadzenLink>
</ChildContent>
</RadzenTimelineItem>
<RadzenTimelineItem>
<LabelContent>
<RadzenText TextStyle="TextStyle.Subtitle2" Class="rz-m-0 rz-color-primary">AUG 2021</RadzenText>
</LabelContent>
<ChildContent>
The Macquarie Group buys a majority stake
</ChildContent>
</RadzenTimelineItem>
<RadzenTimelineItem>
<LabelContent>
<RadzenText TextStyle="TextStyle.Subtitle2" Class="rz-m-0 rz-color-primary">2022/2023</RadzenText>
</LabelContent>
<ChildContent>
<RadzenLink Path="https://www.dailyecho.co.uk/news/23910692.reaction-southern-water-bosses-paid-600-000/" Text="Execs get £587,000 in total renumeration" target="_blank"></RadzenLink>
</ChildContent>
</RadzenTimelineItem>
</Items>
</RadzenTimeline>
</div>
<div>
<RadzenLink Path="https://en.wikipedia.org/wiki/Southern_Water" Text="Source [Wikipedia]" target="_blank"></RadzenLink>
</div>
@code {
}

View File

@ -0,0 +1,60 @@
@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

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

View File

@ -3,13 +3,10 @@
@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 @using Overflow.Web.Client
@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,12 +5,11 @@
<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>
@ -20,4 +19,22 @@
<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

@ -0,0 +1,19 @@
@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

@ -0,0 +1,96 @@
.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

@ -0,0 +1,23 @@
@rendermode InteractiveServer
<RadzenMenu Click="OnParentClicked">
<RadzenMenuItem Text="Home" Icon="home" Path="/">
</RadzenMenuItem>
<RadzenMenuItem Text="Southern Water" Icon="water_drop">
<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

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

View File

@ -1,7 +1,6 @@
<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(Overflow.Web.Client.Layout.MainLayout)"/> <RouteView RouteData="@routeData" DefaultLayout="@typeof(Layout.MainLayout)"/>
<FocusOnNavigate RouteData="@routeData" Selector="h1"/> <FocusOnNavigate RouteData="@routeData" Selector="h1"/>
</Found> </Found>
</Router> </Router>

View File

@ -11,5 +11,4 @@
@using Overflow.Web.Client.Pages @using Overflow.Web.Client.Pages
@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.8" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.6" />
<PackageReference Include="MongoDB.Driver" Version="2.29.0" /> <PackageReference Include="MongoDB.Driver" Version="2.25.0" />
<PackageReference Include="NLog" Version="5.3.4" /> <PackageReference Include="NLog" Version="5.3.2" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.14" /> <PackageReference Include="NLog.Extensions.Logging" Version="5.3.11" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.14" /> <PackageReference Include="NLog.Web.AspNetCore" Version="5.3.11" />
<PackageReference Include="Quartz" Version="3.13.0" /> <PackageReference Include="Quartz" Version="3.9.0" />
<PackageReference Include="Quartz.AspNetCore" Version="3.13.0" /> <PackageReference Include="Quartz.AspNetCore" Version="3.9.0" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.13.0" /> <PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.9.0" />
<PackageReference Include="Quartz.Extensions.Hosting" Version="3.13.0" /> <PackageReference Include="Quartz.Extensions.Hosting" Version="3.9.0" />
<PackageReference Include="Radzen.Blazor" Version="5.2.5" /> <PackageReference Include="Radzen.Blazor" Version="4.32.6" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -36,9 +36,5 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Components\Layout\" />
</ItemGroup>
</Project> </Project>

View File

@ -1,38 +1,34 @@
using Microsoft.AspNetCore.Components.Web; using Overflow.Web.Components;
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);
.AddScoped<IMongoDatabase>(s => s.GetRequiredService<MongoClient>().GetDatabase(Static.DatabaseName)); builder.Services.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
.Configure<QuartzOptions>(options => builder.Services.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
@ -89,14 +85,14 @@ builder.Services.AddQuartzServer(options =>
options.WaitForJobsToComplete = false; options.WaitForJobsToComplete = false;
}); });
builder.Services.AddHttpClient() builder.Services.AddHttpClient();
.AddSingleton<SouthernWaterApi>() builder.Services.AddSingleton<SouthernWaterApi>();
.AddScoped<SouthernWaterApiJobRunner, SouthernWaterApiJobRunnerPersisting>() builder.Services.AddScoped<SouthernWaterApiJobRunner, SouthernWaterApiJobRunnerPersisting>();
.AddTransient<SouthernWaterJob>(); builder.Services.AddTransient<SouthernWaterJob>();
builder.Services.AddSingleton<SpillCache>() builder.Services.AddSingleton<SpillCache>();
.AddSingleton<SouthernWaterSpillCache>() builder.Services.AddSingleton<SouthernWaterSpillCache>();
.AddHostedService<LoadCacheOnStart>(); builder.Services.AddHostedService<LoadCacheOnStart>();
builder.Services.AddRadzenComponents(); builder.Services.AddRadzenComponents();
@ -112,12 +108,11 @@ if (!app.Environment.IsDevelopment())
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseStaticFiles() app.UseStaticFiles();
.UseAntiforgery(); app.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.1" /> <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0" />
<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.29.0" /> <PackageReference Include="MongoDB.Driver" Version="2.25.0" />
<PackageReference Include="Quartz" Version="3.13.0" /> <PackageReference Include="Quartz" Version="3.9.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -22,7 +22,7 @@ public partial class SouthernWaterApi
_logger = logger; _logger = logger;
} }
[GeneratedRegex(@".APIURL=""(?<APIURL>.*)"".*APIGWKEY=""(?<APIKEY>.*?)"".*", RegexOptions.IgnoreCase)] [GeneratedRegex(@".*const APIURL = '(?<APIURL>.*)'.*\n.*const APIGWKEY = '(?<APIKEY>.*)'.*", RegexOptions.IgnoreCase)]
private static partial Regex ApiUrlAndKey(); private static partial Regex ApiUrlAndKey();
public async Task LoadApiUrl() public async Task LoadApiUrl()
@ -67,13 +67,11 @@ public partial class SouthernWaterApi
if (apiUrlFound) if (apiUrlFound)
{ {
baseUrl = apiUrl.Value; baseUrl = apiUrl.Value;
_logger.LogInformation("API url found [{APIUrl}]", apiUrl);
} }
if (apiKeyFound) if (apiKeyFound)
{ {
this.apiKey = apiKey.Value; this.apiKey = apiKey.Value;
_logger.LogInformation("API key found [{APIKey}]", apiKey);
} }
} }
catch (HttpRequestException e) catch (HttpRequestException e)

View File

@ -8,7 +8,7 @@ public class SouthernWaterApiJobRunner(SouthernWaterApi client, ILogger<Southern
{ {
protected readonly ILogger<SouthernWaterApiJobRunner> _logger = logger; protected readonly ILogger<SouthernWaterApiJobRunner> _logger = logger;
public async Task LoadSpills(int? pageLimit = null) public async Task<SouthernWaterApiJob> LoadSpills(int? pageLimit = null)
{ {
var interval = Static.Interval; var interval = Static.Interval;
var job = new SouthernWaterApiJob var job = new SouthernWaterApiJob
@ -39,7 +39,7 @@ public class SouthernWaterApiJobRunner(SouthernWaterApi client, ILogger<Southern
page.items.ForEach(s => s.JobId = job._id); page.items.ForEach(s => s.JobId = job._id);
job.TotalItems = page.totalItems; job.TotalItems = page.totalItems;
// job.Spills.AddRange(page.items); job.Spills.AddRange(page.items);
try try
{ {
await PageLoaded(job, page); await PageLoaded(job, page);
@ -62,6 +62,8 @@ public class SouthernWaterApiJobRunner(SouthernWaterApi client, ILogger<Southern
{ {
_logger.LogError(e, "Exception while running job finished callback"); _logger.LogError(e, "Exception while running job finished callback");
} }
return job;
} }
protected virtual Task JobCreated(SouthernWaterApiJob job) protected virtual Task JobCreated(SouthernWaterApiJob job)