Skip to content

Commit

Permalink
added offline page support
Browse files Browse the repository at this point in the history
  • Loading branch information
ytqsl committed Dec 5, 2024
1 parent 5080b03 commit 471fcd4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/Spd.Presentation.Screening/ClientApp/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
"src/assets",
"src/offline.html"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
Expand All @@ -47,8 +48,8 @@
],
"allowedCommonJsDependencies": [
"moment"
],
"browser": "src/main.ts"
],
"browser": "src/main.ts"
},
"configurations": {
"production": {
Expand Down
10 changes: 10 additions & 0 deletions src/Spd.Presentation.Screening/ClientApp/src/offline.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
The Portal is now offline
</body>
</html>
9 changes: 8 additions & 1 deletion src/Spd.Presentation.Screening/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@
app.UseRequestDecompression();
app.UseResponseCompression();
app.UseStaticFiles();
app.MapFallbackToFile("index.html");
if (app.Configuration.GetValue("MaintenanceMode", false))
{
app.MapFallbackToFile("offline.html");
}
else
{
app.MapFallbackToFile("index.html");
}
app.UseRouting();
app.UseObservabilityMiddleware();
app.UseHealthChecks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
<UserSecretsId>5050035b-d63a-4c6e-a973-fe8e5d35829b</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<Folder Include="ClientApp\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" />
<PackageReference Include="FluentValidation" />
Expand Down

0 comments on commit 471fcd4

Please sign in to comment.