Browse Source

Merge pull request #21747 from abpframework/CheckLibsUIPage

Add more infomation to `CheckLibs` page.
pull/21749/head
Alper Ebiçoğlu 1 year ago
committed by GitHub
parent
commit
da0a037b51
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 106
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsErrorPage.Designer.cs
  2. 104
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsErrorPage.cshtml
  3. 5
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsService.cs

106
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsErrorPage.Designer.cs

@ -27,20 +27,100 @@ using Volo.Abp.AspNetCore.RazorViews;
#line hidden
#nullable disable
WriteLiteral(@"
<html>
<head>
<meta charset=""utf-8"" />
<title>Error - The Libs folder is missing!</title>
</head>
<body>
<h1> &#9888;&#65039; The Libs folder under the <code style=""background-color: #e7e7e7;"">wwwroot/libs</code> directory is empty!</h1>
<!DOCTYPE html>
<html lang=""en"">
<head>
<meta charset=""UTF-8"">
<meta name=""viewport"" content=""width=device-width, initial-scale=1.0"">
<title>Error - The Libs Folder is Missing!</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f9f9f9;
margin: 0;
padding: 0;
}
header {
background-color: #ff4d4f;
color: white;
text-align: center;
padding: 20px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
header h1 {
margin: 0;
font-size: 1.8em;
}
main {
max-width: 800px;
margin: 30px auto;
background-color: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
main h2 {
color: #333;
}
p {
font-size: 1em;
line-height: 1.6;
");
WriteLiteral(@"color: #555;
}
code {
background-color: #f4f4f4;
padding: 3px 6px;
border-radius: 4px;
font-family: ""Courier New"", Courier, monospace;
}
pre {
background-color: #f4f4f4;
padding: 15px;
border-radius: 5px;
border: 1px solid #ddd;
overflow-x: auto;
font-size: 0.95em;
line-height: 1.4;
}
a {
color: #1890ff;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
footer {
text-align: center;
margin-top: 20px;
font-size: 0.9em;
color: #888;
}
</style>
</head>
<body>
<header>
<h1>&#9888;&#65039; The Libs folder is missing!</h1>
</header>
<main>
<p>The Libs folder contains mandatory NPM Packages for running the project.</p>
<p>Make sure you run the <code style=""background-color: #e7e7e7;"">abp install-libs</code> CLI tool command.</p>
<p>For more information, check out the <a href=""https://abp.io/docs/latest/CLI#install-libs"">ABP CLI documentation</a></p>
</body>
<p>Make sure you run the <code>abp install-lib");
WriteLiteral(@"s</code> CLI tool command.</p>
<p>
If your application does not use any client-side libraries, you can disable this check by setting
<code>AbpMvcLibsOptions.CheckLibs</code> to <code>false</code>, as shown below:
</p>
<pre>
Configure&lt;AbpMvcLibsOptions&gt;(options =&gt;
{
options.CheckLibs = false;
});</pre>
<p>For more information, check out the <a href=""https://abp.io/docs/latest/CLI#install-libs"" target=""_blank"">ABP CLI documentation</a>.</p>
</main>
<footer>
&copy; ABP Framework
</footer>
</body>
</html>
");
}

104
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsErrorPage.cshtml

@ -5,18 +5,96 @@
Response.StatusCode = 500;
}
<html>
<head>
<meta charset="utf-8" />
<title>Error - The Libs folder is missing!</title>
</head>
<body>
<h1> &#9888;&#65039; The Libs folder under the <code style="background-color: #e7e7e7;">wwwroot/libs</code> directory is empty!</h1>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Error - The Libs Folder is Missing!</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f9f9f9;
margin: 0;
padding: 0;
}
header {
background-color: #ff4d4f;
color: white;
text-align: center;
padding: 20px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
header h1 {
margin: 0;
font-size: 1.8em;
}
main {
max-width: 800px;
margin: 30px auto;
background-color: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
main h2 {
color: #333;
}
p {
font-size: 1em;
line-height: 1.6;
color: #555;
}
code {
background-color: #f4f4f4;
padding: 3px 6px;
border-radius: 4px;
font-family: "Courier New", Courier, monospace;
}
pre {
background-color: #f4f4f4;
padding: 15px;
border-radius: 5px;
border: 1px solid #ddd;
overflow-x: auto;
font-size: 0.95em;
line-height: 1.4;
}
a {
color: #1890ff;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
footer {
text-align: center;
margin-top: 20px;
font-size: 0.9em;
color: #888;
}
</style>
</head>
<body>
<header>
<h1>&#9888;&#65039; The Libs folder is missing!</h1>
</header>
<main>
<p>The Libs folder contains mandatory NPM Packages for running the project.</p>
<p>Make sure you run the <code style="background-color: #e7e7e7;">abp install-libs</code> CLI tool command.</p>
<p>For more information, check out the <a href="https://abp.io/docs/latest/CLI#install-libs">ABP CLI documentation</a></p>
</body>
<p>Make sure you run the <code>abp install-libs</code> CLI tool command.</p>
<p>
If your application does not use any client-side libraries, you can disable this check by setting
<code>AbpMvcLibsOptions.CheckLibs</code> to <code>false</code>, as shown below:
</p>
<pre>
Configure&lt;AbpMvcLibsOptions&gt;(options =&gt;
{
options.CheckLibs = false;
});</pre>
<p>For more information, check out the <a href="https://abp.io/docs/latest/CLI#install-libs" target="_blank">ABP CLI documentation</a>.</p>
</main>
<footer>
&copy; ABP Framework
</footer>
</body>
</html>

5
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsService.cs

@ -64,7 +64,7 @@ public class AbpMvcLibsService : IAbpMvcLibsService, ITransientDependency
var webHostEnvironment = httpContext.RequestServices.GetRequiredService<IWebHostEnvironment>();
if (webHostEnvironment.WebRootPath.IsNullOrWhiteSpace())
{
logger.LogWarning("The 'WebRootPath' is not set! The 'CheckLibs' feature is disabled!");
logger.LogInformation("The 'WebRootPath' is not set, The 'CheckLibs' feature not needed.");
return Task.FromResult(true);
}
@ -72,7 +72,8 @@ public class AbpMvcLibsService : IAbpMvcLibsService, ITransientDependency
var libsFolder = fileProvider.GetDirectoryContents("/libs");
if (!libsFolder.Exists || !libsFolder.Any())
{
logger.LogError("The 'wwwroot/libs' folder does not exist or empty!");
logger.LogError("The 'wwwroot/libs' folder does not exist or empty! " +
"If your application does not use any client-side libraries, you can disable this check by setting 'AbpMvcLibsOptions.CheckLibs' to 'false'");
return Task.FromResult(false);
}
}

Loading…
Cancel
Save