Initial commit
This commit is contained in:
parent
8f64b4ff6a
commit
183c3996bc
83
TomPIT.Connected.UI.sln
Normal file
83
TomPIT.Connected.UI.sln
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.4.32916.344
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TomPIT.Connected.UI", "TomPIT.Connected.UI\TomPIT.Connected.UI.csproj", "{8400DF60-DEEF-452F-B32F-03E43B296E15}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependencies", "Dependencies", "{371C0F2E-F0AA-4924-BF79-0F2A473B5C3D}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mock.UI", "Mock.UI\Mock.UI.csproj", "{09ACAAEA-C94B-4733-B1D1-D6977C0437A3}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Types.Model", "..\Common.Types\Common.Types.Model\Common.Types.Model.csproj", "{F5C21493-61AF-4145-943A-24F1F6C916F4}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Types.Client", "..\Common.Types\Common.Types.Client\Common.Types.Client.csproj", "{5C445129-4B51-4119-BBF3-1A7D3EC6EF85}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Types.UI", "..\Common.Types\Common.Types.UI\Common.Types.UI.csproj", "{17E24578-278D-4294-9950-AB42EFBC63D2}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connected.Client", "..\Connected\Connected.Client\Connected.Client.csproj", "{D593BBE3-4E78-4682-9504-5AEEFAC0D55B}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connected.UI", "..\Connected\Connected.UI\Connected.UI.csproj", "{FAFDB16E-CBCC-45FA-B8C7-4CBFEDBC5835}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connected", "..\Connected\Connected\Connected.csproj", "{5546A8B8-1088-4E38-A677-CF0DE6848131}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Connected.UI.Test", "Connected.UI.Test\Connected.UI.Test.csproj", "{6D83EC2C-3E5B-4092-8F16-9A502330B7D3}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{8400DF60-DEEF-452F-B32F-03E43B296E15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8400DF60-DEEF-452F-B32F-03E43B296E15}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8400DF60-DEEF-452F-B32F-03E43B296E15}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8400DF60-DEEF-452F-B32F-03E43B296E15}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{09ACAAEA-C94B-4733-B1D1-D6977C0437A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{09ACAAEA-C94B-4733-B1D1-D6977C0437A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{09ACAAEA-C94B-4733-B1D1-D6977C0437A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{09ACAAEA-C94B-4733-B1D1-D6977C0437A3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{F5C21493-61AF-4145-943A-24F1F6C916F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F5C21493-61AF-4145-943A-24F1F6C916F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F5C21493-61AF-4145-943A-24F1F6C916F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F5C21493-61AF-4145-943A-24F1F6C916F4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{5C445129-4B51-4119-BBF3-1A7D3EC6EF85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5C445129-4B51-4119-BBF3-1A7D3EC6EF85}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5C445129-4B51-4119-BBF3-1A7D3EC6EF85}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5C445129-4B51-4119-BBF3-1A7D3EC6EF85}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{17E24578-278D-4294-9950-AB42EFBC63D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{17E24578-278D-4294-9950-AB42EFBC63D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{17E24578-278D-4294-9950-AB42EFBC63D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{17E24578-278D-4294-9950-AB42EFBC63D2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D593BBE3-4E78-4682-9504-5AEEFAC0D55B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D593BBE3-4E78-4682-9504-5AEEFAC0D55B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D593BBE3-4E78-4682-9504-5AEEFAC0D55B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D593BBE3-4E78-4682-9504-5AEEFAC0D55B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{FAFDB16E-CBCC-45FA-B8C7-4CBFEDBC5835}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{FAFDB16E-CBCC-45FA-B8C7-4CBFEDBC5835}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{FAFDB16E-CBCC-45FA-B8C7-4CBFEDBC5835}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{FAFDB16E-CBCC-45FA-B8C7-4CBFEDBC5835}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{5546A8B8-1088-4E38-A677-CF0DE6848131}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5546A8B8-1088-4E38-A677-CF0DE6848131}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5546A8B8-1088-4E38-A677-CF0DE6848131}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5546A8B8-1088-4E38-A677-CF0DE6848131}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{6D83EC2C-3E5B-4092-8F16-9A502330B7D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{6D83EC2C-3E5B-4092-8F16-9A502330B7D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{6D83EC2C-3E5B-4092-8F16-9A502330B7D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{6D83EC2C-3E5B-4092-8F16-9A502330B7D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{F5C21493-61AF-4145-943A-24F1F6C916F4} = {371C0F2E-F0AA-4924-BF79-0F2A473B5C3D}
|
||||||
|
{5C445129-4B51-4119-BBF3-1A7D3EC6EF85} = {371C0F2E-F0AA-4924-BF79-0F2A473B5C3D}
|
||||||
|
{17E24578-278D-4294-9950-AB42EFBC63D2} = {371C0F2E-F0AA-4924-BF79-0F2A473B5C3D}
|
||||||
|
{D593BBE3-4E78-4682-9504-5AEEFAC0D55B} = {371C0F2E-F0AA-4924-BF79-0F2A473B5C3D}
|
||||||
|
{FAFDB16E-CBCC-45FA-B8C7-4CBFEDBC5835} = {371C0F2E-F0AA-4924-BF79-0F2A473B5C3D}
|
||||||
|
{5546A8B8-1088-4E38-A677-CF0DE6848131} = {371C0F2E-F0AA-4924-BF79-0F2A473B5C3D}
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {AA89A239-1D72-490A-9F3B-F085F2AAF994}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
35
TomPIT.Connected.UI/App.razor
Normal file
35
TomPIT.Connected.UI/App.razor
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
@using Microsoft.AspNetCore.Components.Routing
|
||||||
|
@using Microsoft.AspNetCore.Components.WebAssembly.Services
|
||||||
|
@using Microsoft.Extensions.Logging
|
||||||
|
@using System.Reflection
|
||||||
|
|
||||||
|
@inject LazyAssemblyLoader AssemblyLoader
|
||||||
|
@inject ILogger<App> Logger
|
||||||
|
|
||||||
|
<Router AppAssembly="@typeof(App).Assembly" AdditionalAssemblies="@additionalAssemblies">
|
||||||
|
<Found Context="routeData">
|
||||||
|
<RouteView RouteData="@routeData" />
|
||||||
|
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||||||
|
</Found>
|
||||||
|
<NotFound>
|
||||||
|
<PageTitle>Not found</PageTitle>
|
||||||
|
<LayoutView>
|
||||||
|
<p role="alert">Sorry, there's nothing at this address.</p>
|
||||||
|
</LayoutView>
|
||||||
|
</NotFound>
|
||||||
|
</Router>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private List<Assembly> additionalAssemblies;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await Task.CompletedTask;
|
||||||
|
|
||||||
|
additionalAssemblies = new List<Assembly>
|
||||||
|
{
|
||||||
|
typeof(Common.Types.Bootstrapper).Assembly,
|
||||||
|
typeof(UITest.Bootstrap).Assembly
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
33
TomPIT.Connected.UI/Program.cs
Normal file
33
TomPIT.Connected.UI/Program.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using Connected;
|
||||||
|
using Connected.Middleware;
|
||||||
|
using Connected.Startup;
|
||||||
|
using TomPIT.Connected;
|
||||||
|
|
||||||
|
var types = new List<IStartup>
|
||||||
|
{
|
||||||
|
new CoreStartup(),
|
||||||
|
new ClientStartup(),
|
||||||
|
new Common.Types.ClientBootstrapper(),
|
||||||
|
new UITest.Bootstrap()
|
||||||
|
//new MockUIStart()
|
||||||
|
};
|
||||||
|
|
||||||
|
await Instance.Start<App>(types, ParseArguments(args));
|
||||||
|
|
||||||
|
|
||||||
|
static Dictionary<string, string> ParseArguments(params string[] args)
|
||||||
|
{
|
||||||
|
var result = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
foreach (var i in args)
|
||||||
|
{
|
||||||
|
var tokens = i.Split('=', 2);
|
||||||
|
|
||||||
|
if (tokens.Length == 1)
|
||||||
|
result.Add(tokens[0].Trim(), string.Empty);
|
||||||
|
else
|
||||||
|
result.Add(tokens[0].Trim(), tokens[1].Trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
30
TomPIT.Connected.UI/Properties/launchSettings.json
Normal file
30
TomPIT.Connected.UI/Properties/launchSettings.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:44920",
|
||||||
|
"sslPort": 44367
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"TomPIT.Connected": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||||
|
"applicationUrl": "https://localhost:7204;http://localhost:5204",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
TomPIT.Connected.UI/TomPIT.Connected.UI.csproj
Normal file
29
TomPIT.Connected.UI/TomPIT.Connected.UI.csproj
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<RootNamespace>TomPIT.Connected</RootNamespace>
|
||||||
|
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-rc.2.22476.2" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-rc.2.22476.2" PrivateAssets="all" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\Common.Types\Common.Types.Client\Common.Types.Client.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Common.Types\Common.Types.UI\Common.Types.UI.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Connected\Connected.Client\Connected.Client.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Connected\Connected.UI\Connected.UI.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Connected\Connected\Connected.csproj" />
|
||||||
|
<ProjectReference Include="..\Connected.UI.Test\Connected.UI.Test.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
16
TomPIT.Connected.UI/wwwroot/index.html
Normal file
16
TomPIT.Connected.UI/wwwroot/index.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
|
<base href="/" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="app">Loading...</div>
|
||||||
|
<script src="_framework/blazor.webassembly.js"></script>
|
||||||
|
<script>navigator.serviceWorker.register('service-worker.js');</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
4
TomPIT.Connected.UI/wwwroot/service-worker.js
Normal file
4
TomPIT.Connected.UI/wwwroot/service-worker.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// In development, always fetch from the network and do not enable offline support.
|
||||||
|
// This is because caching would make development more difficult (changes would not
|
||||||
|
// be reflected on the first load after each change).
|
||||||
|
self.addEventListener('fetch', () => { });
|
48
TomPIT.Connected.UI/wwwroot/service-worker.published.js
Normal file
48
TomPIT.Connected.UI/wwwroot/service-worker.published.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// Caution! Be sure you understand the caveats before publishing an application with
|
||||||
|
// offline support. See https://aka.ms/blazor-offline-considerations
|
||||||
|
|
||||||
|
self.importScripts('./service-worker-assets.js');
|
||||||
|
self.addEventListener('install', event => event.waitUntil(onInstall(event)));
|
||||||
|
self.addEventListener('activate', event => event.waitUntil(onActivate(event)));
|
||||||
|
self.addEventListener('fetch', event => event.respondWith(onFetch(event)));
|
||||||
|
|
||||||
|
const cacheNamePrefix = 'offline-cache-';
|
||||||
|
const cacheName = `${cacheNamePrefix}${self.assetsManifest.version}`;
|
||||||
|
const offlineAssetsInclude = [ /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/ ];
|
||||||
|
const offlineAssetsExclude = [ /^service-worker\.js$/ ];
|
||||||
|
|
||||||
|
async function onInstall(event) {
|
||||||
|
console.info('Service worker: Install');
|
||||||
|
|
||||||
|
// Fetch and cache all matching items from the assets manifest
|
||||||
|
const assetsRequests = self.assetsManifest.assets
|
||||||
|
.filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url)))
|
||||||
|
.filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url)))
|
||||||
|
.map(asset => new Request(asset.url, { integrity: asset.hash, cache: 'no-cache' }));
|
||||||
|
await caches.open(cacheName).then(cache => cache.addAll(assetsRequests));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onActivate(event) {
|
||||||
|
console.info('Service worker: Activate');
|
||||||
|
|
||||||
|
// Delete unused caches
|
||||||
|
const cacheKeys = await caches.keys();
|
||||||
|
await Promise.all(cacheKeys
|
||||||
|
.filter(key => key.startsWith(cacheNamePrefix) && key !== cacheName)
|
||||||
|
.map(key => caches.delete(key)));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onFetch(event) {
|
||||||
|
let cachedResponse = null;
|
||||||
|
if (event.request.method === 'GET') {
|
||||||
|
// For all navigation requests, try to serve index.html from cache
|
||||||
|
// If you need some URLs to be server-rendered, edit the following check to exclude those URLs
|
||||||
|
const shouldServeIndexHtml = event.request.mode === 'navigate';
|
||||||
|
|
||||||
|
const request = shouldServeIndexHtml ? 'index.html' : event.request;
|
||||||
|
const cache = await caches.open(cacheName);
|
||||||
|
cachedResponse = await cache.match(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cachedResponse || fetch(event.request);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user