[REFACTOR] Name change projects and solution
This commit is contained in:
22
Manager.App/Components/App.razor
Normal file
22
Manager.App/Components/App.razor
Normal file
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Application</title>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<base href="/"/>
|
||||
<link rel="stylesheet" href="app.css"/>
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet"/>
|
||||
<link href="_content/MudBlazor/MudBlazor.min.css?v=@Metadata.Version" rel="stylesheet"/>
|
||||
<HeadOutlet/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<Routes @rendermode="InteractiveServer"/>
|
||||
<script src="_framework/blazor.web.js"></script>
|
||||
<script src="_content/MudBlazor/MudBlazor.min.js?v=@Metadata.Version"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
20
Manager.App/Components/Layout/ApplicationLayout.razor
Normal file
20
Manager.App/Components/Layout/ApplicationLayout.razor
Normal file
@@ -0,0 +1,20 @@
|
||||
@inherits LayoutComponentBase
|
||||
@layout BaseLayout
|
||||
|
||||
<CascadingValue Value="this">
|
||||
<MudAppBar Color="Color.Primary">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@(_ => ToggleDrawerOpen())" />
|
||||
<MudText Typo="Typo.h6">@AppText</MudText>
|
||||
<MudSpacer/>
|
||||
<MudTooltip Text="Gitea source">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Source" Href="https://git.netzbyte.com/max/Yt-Import" Target="_blank"/>
|
||||
</MudTooltip>
|
||||
@if (BaseLayout != null)
|
||||
{
|
||||
<MudTooltip Text="@(BaseLayout.DarkTheme ? "Toggle to light mode" : "Toggle to dark mode")">
|
||||
<MudToggleIconButton @bind-Toggled="@BaseLayout.DarkTheme" Color="Color.Dark" ToggledColor="Color.Warning" Icon="@Icons.Material.Filled.DarkMode" ToggledIcon="@Icons.Material.Filled.LightMode"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
</MudAppBar>
|
||||
@Body
|
||||
</CascadingValue>
|
16
Manager.App/Components/Layout/ApplicationLayout.razor.cs
Normal file
16
Manager.App/Components/Layout/ApplicationLayout.razor.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Manager.App.Components.Layout;
|
||||
|
||||
public partial class ApplicationLayout
|
||||
{
|
||||
[CascadingParameter]
|
||||
public BaseLayout? BaseLayout { get; set; }
|
||||
public bool DrawerOpen { get; set; } = true;
|
||||
public string AppText { get; set; } = "YouTube Import";
|
||||
|
||||
private void ToggleDrawerOpen()
|
||||
{
|
||||
DrawerOpen = !DrawerOpen;
|
||||
}
|
||||
}
|
20
Manager.App/Components/Layout/BaseLayout.razor
Normal file
20
Manager.App/Components/Layout/BaseLayout.razor
Normal file
@@ -0,0 +1,20 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<MudThemeProvider @ref="@_themeProvider" Theme="@_mudTheme" IsDarkMode="@DarkTheme"/>
|
||||
<MudPopoverProvider />
|
||||
<MudDialogProvider/>
|
||||
<MudSnackbarProvider/>
|
||||
|
||||
<CascadingValue Value="this">
|
||||
<MudLayout>
|
||||
<MudMainContent>
|
||||
@Body
|
||||
</MudMainContent>
|
||||
</MudLayout>
|
||||
</CascadingValue>
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
37
Manager.App/Components/Layout/BaseLayout.razor.cs
Normal file
37
Manager.App/Components/Layout/BaseLayout.razor.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
namespace Manager.App.Components.Layout;
|
||||
|
||||
public partial class BaseLayout
|
||||
{
|
||||
private readonly MudTheme _mudTheme = new MudTheme();
|
||||
private MudThemeProvider? _themeProvider;
|
||||
private bool _isDarkTheme = true;
|
||||
|
||||
public event EventHandler<bool>? OnDarkThemeChanged;
|
||||
|
||||
public bool DarkTheme
|
||||
{
|
||||
get => _isDarkTheme;
|
||||
set
|
||||
{
|
||||
_isDarkTheme = value;
|
||||
ThemeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void ThemeChanged()
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender && _themeProvider != null)
|
||||
{
|
||||
DarkTheme = await _themeProvider.GetSystemDarkModeAsync();
|
||||
_themeProvider.IsDarkModeChanged = EventCallback.Factory.Create<bool>(this, x => OnDarkThemeChanged?.Invoke(this, x));
|
||||
}
|
||||
}
|
||||
}
|
18
Manager.App/Components/Layout/BaseLayout.razor.css
Normal file
18
Manager.App/Components/Layout/BaseLayout.razor.css
Normal file
@@ -0,0 +1,18 @@
|
||||
#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;
|
||||
}
|
16
Manager.App/Components/Layout/MainLayout.razor
Normal file
16
Manager.App/Components/Layout/MainLayout.razor
Normal file
@@ -0,0 +1,16 @@
|
||||
@inherits LayoutComponentBase
|
||||
@layout ApplicationLayout
|
||||
|
||||
@if (ApplicationLayout != null)
|
||||
{
|
||||
<MudDrawer @bind-Open="@ApplicationLayout.DrawerOpen" ClipMode="DrawerClipMode.Always">
|
||||
<NavMenu/>
|
||||
<MudSpacer/>
|
||||
</MudDrawer>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudAlert Severity="Severity.Error" Variant="Variant.Outlined">Error getting cascading parameter 'ApplicationLayout'!</MudAlert>
|
||||
}
|
||||
|
||||
@Body
|
9
Manager.App/Components/Layout/MainLayout.razor.cs
Normal file
9
Manager.App/Components/Layout/MainLayout.razor.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Manager.App.Components.Layout;
|
||||
|
||||
public partial class MainLayout
|
||||
{
|
||||
[CascadingParameter]
|
||||
public ApplicationLayout? ApplicationLayout { get; set; }
|
||||
}
|
10
Manager.App/Components/Layout/MainLayout.razor.css
Normal file
10
Manager.App/Components/Layout/MainLayout.razor.css
Normal file
@@ -0,0 +1,10 @@
|
||||
.page {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1;
|
||||
}
|
||||
|
9
Manager.App/Components/Layout/NavMenu.razor
Normal file
9
Manager.App/Components/Layout/NavMenu.razor
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
<MudNavMenu>
|
||||
<MudText Typo="Typo.h6" Class="px-4">YouTube Import</MudText>
|
||||
<MudDivider Class="my-2"/>
|
||||
<MudNavLink Href="/" Match="NavLinkMatch.Prefix">Home</MudNavLink>
|
||||
<MudNavLink Href="/Accounts" Match="NavLinkMatch.All">Accounts</MudNavLink>
|
||||
<MudNavLink Href="/Library" Match="NavLinkMatch.All">Library</MudNavLink>
|
||||
<MudNavLink Href="/Playlists" Match="NavLinkMatch.All">Playlists</MudNavLink>
|
||||
</MudNavMenu>
|
0
Manager.App/Components/Layout/NavMenu.razor.css
Normal file
0
Manager.App/Components/Layout/NavMenu.razor.css
Normal file
36
Manager.App/Components/Pages/Error.razor
Normal file
36
Manager.App/Components/Pages/Error.razor
Normal file
@@ -0,0 +1,36 @@
|
||||
@page "/Error"
|
||||
@using System.Diagnostics
|
||||
|
||||
<PageTitle>Error</PageTitle>
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
|
||||
@code{
|
||||
[CascadingParameter] private HttpContext? HttpContext { get; set; }
|
||||
|
||||
private string? RequestId { get; set; }
|
||||
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
protected override void OnInitialized() =>
|
||||
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
|
||||
|
||||
}
|
3
Manager.App/Components/Pages/Home.razor
Normal file
3
Manager.App/Components/Pages/Home.razor
Normal file
@@ -0,0 +1,3 @@
|
||||
@page "/"
|
||||
|
||||
<PageTitle>Home</PageTitle>
|
6
Manager.App/Components/Routes.razor
Normal file
6
Manager.App/Components/Routes.razor
Normal file
@@ -0,0 +1,6 @@
|
||||
<Router AppAssembly="typeof(Program).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)"/>
|
||||
<FocusOnNavigate RouteData="routeData" Selector="h1"/>
|
||||
</Found>
|
||||
</Router>
|
13
Manager.App/Components/_Imports.razor
Normal file
13
Manager.App/Components/_Imports.razor
Normal file
@@ -0,0 +1,13 @@
|
||||
@using System.Net.Http
|
||||
@using System.Net.Http.Json
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using static Microsoft.AspNetCore.Components.Web.RenderMode
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.JSInterop
|
||||
@using Manager.App
|
||||
@using Manager.App.Components
|
||||
|
||||
@* MudBlazor *@
|
||||
@using MudBlazor
|
55
Manager.App/DependencyInjection.cs
Normal file
55
Manager.App/DependencyInjection.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using DotBased.Logging;
|
||||
using DotBased.Logging.MEL;
|
||||
using DotBased.Logging.Serilog;
|
||||
using Serilog;
|
||||
|
||||
namespace Manager.App;
|
||||
|
||||
public static class DependencyInjection
|
||||
{
|
||||
public static WebApplicationBuilder InjectDependencies(this WebApplicationBuilder builder)
|
||||
{
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static void SetupLogging(this WebApplicationBuilder builder)
|
||||
{
|
||||
var isDevelopment = builder.Environment.IsDevelopment();
|
||||
var logSeverity = isDevelopment ? LogSeverity.Debug : LogSeverity.Info;
|
||||
var severityFilters = new Dictionary<string, LogSeverity>();
|
||||
|
||||
var dotBasedLogSection = builder.Configuration.GetSection("DotBased:Logging");
|
||||
if (dotBasedLogSection.Exists())
|
||||
{
|
||||
logSeverity = dotBasedLogSection.GetValue<LogSeverity>("Severity");
|
||||
severityFilters = dotBasedLogSection.GetSection("SeverityFilters").GetChildren()
|
||||
.ToDictionary(
|
||||
x => x.Key,
|
||||
x => x.Get<LogSeverity>()
|
||||
);
|
||||
}
|
||||
|
||||
LogService.Initialize(options =>
|
||||
{
|
||||
options.Severity = logSeverity;
|
||||
foreach (var filter in severityFilters)
|
||||
{
|
||||
options.AddSeverityFilter(filter.Key, filter.Value);
|
||||
}
|
||||
});
|
||||
Log.Logger = new LoggerConfiguration().UseBasedExtension()
|
||||
.MinimumLevel.Verbose()
|
||||
.Enrich.WithProperty("Application", "ImportUI")
|
||||
.WriteTo.Console(outputTemplate: BasedSerilog.OutputTemplate)
|
||||
.WriteTo.File(path: Path.Combine("Logs", $"{(isDevelopment ? "Debug" : "Release")}", "log_.log"), rollingInterval: RollingInterval.Day, outputTemplate: BasedSerilog.OutputTemplate)
|
||||
.Destructure.ToMaximumDepth(4)
|
||||
.Destructure.ToMaximumStringLength(100)
|
||||
.Destructure.ToMaximumCollectionCount(10).CreateLogger();
|
||||
|
||||
LogService.AddLogAdapter(new BasedSerilogAdapter(Log.Logger));
|
||||
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Logging.SetMinimumLevel(isDevelopment ? LogLevel.Trace : LogLevel.Information);
|
||||
builder.Logging.AddDotBasedLoggerProvider(LogService.Options);
|
||||
}
|
||||
}
|
28
Manager.App/Manager.App.csproj
Normal file
28
Manager.App/Manager.App.csproj
Normal file
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotBased" Version="1.0.0" />
|
||||
<PackageReference Include="DotBased.Logging.MEL" Version="1.0.0" />
|
||||
<PackageReference Include="DotBased.Logging.Serilog" Version="1.0.0" />
|
||||
<PackageReference Include="MudBlazor" Version="8.10.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="wwwroot\bootstrap\bootstrap.min.css" />
|
||||
<_ContentIncludedByDefault Remove="wwwroot\bootstrap\bootstrap.min.css.map" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Manager.Shared\Manager.Shared.csproj" />
|
||||
<ProjectReference Include="..\Manager.YouTube\Manager.YouTube.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
34
Manager.App/Program.cs
Normal file
34
Manager.App/Program.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Manager.App;
|
||||
using Manager.App.Components;
|
||||
using MudBlazor.Services;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorComponents()
|
||||
.AddInteractiveServerComponents();
|
||||
|
||||
builder.SetupLogging();
|
||||
|
||||
/* MudBlazor */
|
||||
builder.Services.AddMudServices();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseStaticFiles();
|
||||
app.UseAntiforgery();
|
||||
|
||||
app.MapRazorComponents<App>()
|
||||
.AddInteractiveServerRenderMode();
|
||||
|
||||
app.Run();
|
38
Manager.App/Properties/launchSettings.json
Normal file
38
Manager.App/Properties/launchSettings.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:9053",
|
||||
"sslPort": 44322
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5101",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7013;http://localhost:5101",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
Manager.App/appsettings.Development.json
Normal file
20
Manager.App/appsettings.Development.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"DotBased": {
|
||||
"Logging": {
|
||||
"Severity": "Debug",
|
||||
"SeverityFilters":{
|
||||
"Microsoft": "Debug",
|
||||
"Microsoft.Hosting.Lifetime": "Debug",
|
||||
"Microsoft.AspNetCore": "Warning",
|
||||
"Microsoft.AspNetCore.Authentication": "Debug",
|
||||
"MudBlazor": "Debug"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Trace",
|
||||
"Microsoft.AspNetCore": "Debug"
|
||||
}
|
||||
}
|
||||
}
|
21
Manager.App/appsettings.json
Normal file
21
Manager.App/appsettings.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"DotBased": {
|
||||
"Logging": {
|
||||
"Severity": "Info",
|
||||
"SeverityFilters":{
|
||||
"Microsoft": "Info",
|
||||
"Microsoft.Hosting.Lifetime": "Info",
|
||||
"Microsoft.AspNetCore": "Warning",
|
||||
"Microsoft.AspNetCore.Authentication": "Info",
|
||||
"MudBlazor": "Info"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
0
Manager.App/wwwroot/app.css
Normal file
0
Manager.App/wwwroot/app.css
Normal file
BIN
Manager.App/wwwroot/favicon.png
Normal file
BIN
Manager.App/wwwroot/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user