From 0f8199cadf0fa96026c06fc67a687cc192edb3e8 Mon Sep 17 00:00:00 2001 From: SHM Date: Fri, 29 Aug 2025 10:56:41 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=84=B1=ED=98=84=EB=AA=A8]=20TRA=20=EC=BB=A8?= =?UTF-8?q?=ED=94=BC=EA=B7=B8,=20=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/Config/WebClient.Tra.Config.json | 17 +++ .../Components/Pages/Counter.razor | 1 - .../WebClient/Web.Tra/Components/App.razor | 2 + .../Components/Layout/MainLayout.razor | 47 ++++---- .../Web.Tra/Components/Layout/NavMenu.razor | 30 ----- .../Components/Layout/NavMenu.razor.css | 105 ------------------ .../Web.Tra/Components/Pages/Counter.razor | 19 ---- .../Web.Tra/Components/Pages/TRA.razor | 7 ++ .../Web.Tra/Components/Pages/Weather.razor | 64 ----------- .../WebClient/Web.Tra/Components/Routes.razor | 4 +- .../Web.Tra/Components/_Imports.razor | 3 + Projects/WebClient/Web.Tra/Program.cs | 73 +++++++++++- Projects/WebClient/Web.Tra/Web.Tra.csproj | 18 +++ .../Config/WebClientConfig.cs | 17 +++ .../WebClient.Library.csproj | 24 ++++ Projects/WebClient/WebClient.sln | 11 ++ 16 files changed, 202 insertions(+), 240 deletions(-) create mode 100644 Projects/Config/WebClient.Tra.Config.json delete mode 100644 Projects/WebClient/Web.Tra/Components/Layout/NavMenu.razor delete mode 100644 Projects/WebClient/Web.Tra/Components/Layout/NavMenu.razor.css delete mode 100644 Projects/WebClient/Web.Tra/Components/Pages/Counter.razor create mode 100644 Projects/WebClient/Web.Tra/Components/Pages/TRA.razor delete mode 100644 Projects/WebClient/Web.Tra/Components/Pages/Weather.razor create mode 100644 Projects/WebClient/WebClient.Library/Config/WebClientConfig.cs create mode 100644 Projects/WebClient/WebClient.Library/WebClient.Library.csproj diff --git a/Projects/Config/WebClient.Tra.Config.json b/Projects/Config/WebClient.Tra.Config.json new file mode 100644 index 0000000..60aba7e --- /dev/null +++ b/Projects/Config/WebClient.Tra.Config.json @@ -0,0 +1,17 @@ +{ + "Server": { + "Address": "https://*", + "Port": 11000, + "IIS": false + }, + "DataBase": [ + { + "IP": "127.0.0.1", + "Port": 1433, + "DBName": "CPXV2", + "DBID": 1, + "UserID": "Alis", + "Password": "Kefico!@34" + } + ] +} \ No newline at end of file diff --git a/Projects/WebClient/Web.Operation/Components/Pages/Counter.razor b/Projects/WebClient/Web.Operation/Components/Pages/Counter.razor index 1a4f8e7..ef23cb3 100644 --- a/Projects/WebClient/Web.Operation/Components/Pages/Counter.razor +++ b/Projects/WebClient/Web.Operation/Components/Pages/Counter.razor @@ -1,5 +1,4 @@ @page "/counter" -@rendermode InteractiveServer Counter diff --git a/Projects/WebClient/Web.Tra/Components/App.razor b/Projects/WebClient/Web.Tra/Components/App.razor index ea5605c..e4025cd 100644 --- a/Projects/WebClient/Web.Tra/Components/App.razor +++ b/Projects/WebClient/Web.Tra/Components/App.razor @@ -10,11 +10,13 @@ + + diff --git a/Projects/WebClient/Web.Tra/Components/Layout/MainLayout.razor b/Projects/WebClient/Web.Tra/Components/Layout/MainLayout.razor index 5a24bb1..8c32590 100644 --- a/Projects/WebClient/Web.Tra/Components/Layout/MainLayout.razor +++ b/Projects/WebClient/Web.Tra/Components/Layout/MainLayout.razor @@ -1,23 +1,32 @@ @inherits LayoutComponentBase -
- - -
-
- About -
- -
+ + + + + + + + + + + + + + + + +
@Body -
-
-
+ + + + Footer + + + +@code { + bool sidebarExpanded = true; +} + -
- An unhandled error has occurred. - Reload - 🗙 -
diff --git a/Projects/WebClient/Web.Tra/Components/Layout/NavMenu.razor b/Projects/WebClient/Web.Tra/Components/Layout/NavMenu.razor deleted file mode 100644 index 6aa4981..0000000 --- a/Projects/WebClient/Web.Tra/Components/Layout/NavMenu.razor +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - diff --git a/Projects/WebClient/Web.Tra/Components/Layout/NavMenu.razor.css b/Projects/WebClient/Web.Tra/Components/Layout/NavMenu.razor.css deleted file mode 100644 index 4e15395..0000000 --- a/Projects/WebClient/Web.Tra/Components/Layout/NavMenu.razor.css +++ /dev/null @@ -1,105 +0,0 @@ -.navbar-toggler { - appearance: none; - cursor: pointer; - width: 3.5rem; - height: 2.5rem; - color: white; - position: absolute; - top: 0.5rem; - right: 1rem; - border: 1px solid rgba(255, 255, 255, 0.1); - background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1); -} - -.navbar-toggler:checked { - background-color: rgba(255, 255, 255, 0.5); -} - -.top-row { - height: 3.5rem; - background-color: rgba(0,0,0,0.4); -} - -.navbar-brand { - font-size: 1.1rem; -} - -.bi { - display: inline-block; - position: relative; - width: 1.25rem; - height: 1.25rem; - margin-right: 0.75rem; - top: -1px; - background-size: cover; -} - -.bi-house-door-fill-nav-menu { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E"); -} - -.bi-plus-square-fill-nav-menu { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E"); -} - -.bi-list-nested-nav-menu { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E"); -} - -.nav-item { - font-size: 0.9rem; - padding-bottom: 0.5rem; -} - - .nav-item:first-of-type { - padding-top: 1rem; - } - - .nav-item:last-of-type { - padding-bottom: 1rem; - } - - .nav-item ::deep .nav-link { - color: #d7d7d7; - background: none; - border: none; - border-radius: 4px; - height: 3rem; - display: flex; - align-items: center; - line-height: 3rem; - width: 100%; - } - -.nav-item ::deep a.active { - background-color: rgba(255,255,255,0.37); - color: white; -} - -.nav-item ::deep .nav-link:hover { - background-color: rgba(255,255,255,0.1); - color: white; -} - -.nav-scrollable { - display: none; -} - -.navbar-toggler:checked ~ .nav-scrollable { - display: block; -} - -@media (min-width: 641px) { - .navbar-toggler { - display: none; - } - - .nav-scrollable { - /* Never collapse the sidebar for wide screens */ - display: block; - - /* Allow sidebar to scroll for tall menus */ - height: calc(100vh - 3.5rem); - overflow-y: auto; - } -} diff --git a/Projects/WebClient/Web.Tra/Components/Pages/Counter.razor b/Projects/WebClient/Web.Tra/Components/Pages/Counter.razor deleted file mode 100644 index 1a4f8e7..0000000 --- a/Projects/WebClient/Web.Tra/Components/Pages/Counter.razor +++ /dev/null @@ -1,19 +0,0 @@ -@page "/counter" -@rendermode InteractiveServer - -Counter - -

Counter

- -

Current count: @currentCount

- - - -@code { - private int currentCount = 0; - - private void IncrementCount() - { - currentCount++; - } -} diff --git a/Projects/WebClient/Web.Tra/Components/Pages/TRA.razor b/Projects/WebClient/Web.Tra/Components/Pages/TRA.razor new file mode 100644 index 0000000..e4b4e2a --- /dev/null +++ b/Projects/WebClient/Web.Tra/Components/Pages/TRA.razor @@ -0,0 +1,7 @@ +@page "/tra" + +

TRA

+ +@code { + +} diff --git a/Projects/WebClient/Web.Tra/Components/Pages/Weather.razor b/Projects/WebClient/Web.Tra/Components/Pages/Weather.razor deleted file mode 100644 index 43a1ecb..0000000 --- a/Projects/WebClient/Web.Tra/Components/Pages/Weather.razor +++ /dev/null @@ -1,64 +0,0 @@ -@page "/weather" -@attribute [StreamRendering] - -Weather - -

Weather

- -

This component demonstrates showing data.

- -@if (forecasts == null) -{ -

Loading...

-} -else -{ - - - - - - - - - - - @foreach (var forecast in forecasts) - { - - - - - - - } - -
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
-} - -@code { - private WeatherForecast[]? forecasts; - - protected override async Task OnInitializedAsync() - { - // Simulate asynchronous loading to demonstrate streaming rendering - await Task.Delay(500); - - var startDate = DateOnly.FromDateTime(DateTime.Now); - var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; - forecasts = Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = startDate.AddDays(index), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = summaries[Random.Shared.Next(summaries.Length)] - }).ToArray(); - } - - private 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); - } -} diff --git a/Projects/WebClient/Web.Tra/Components/Routes.razor b/Projects/WebClient/Web.Tra/Components/Routes.razor index f756e19..f7f43eb 100644 --- a/Projects/WebClient/Web.Tra/Components/Routes.razor +++ b/Projects/WebClient/Web.Tra/Components/Routes.razor @@ -1,4 +1,6 @@ - +@rendermode InteractiveServer + + diff --git a/Projects/WebClient/Web.Tra/Components/_Imports.razor b/Projects/WebClient/Web.Tra/Components/_Imports.razor index 68939cb..c569c68 100644 --- a/Projects/WebClient/Web.Tra/Components/_Imports.razor +++ b/Projects/WebClient/Web.Tra/Components/_Imports.razor @@ -8,3 +8,6 @@ @using Microsoft.JSInterop @using Web.Tra @using Web.Tra.Components + +@using Radzen +@using Radzen.Blazor \ No newline at end of file diff --git a/Projects/WebClient/Web.Tra/Program.cs b/Projects/WebClient/Web.Tra/Program.cs index b332814..e63b545 100644 --- a/Projects/WebClient/Web.Tra/Program.cs +++ b/Projects/WebClient/Web.Tra/Program.cs @@ -1,13 +1,76 @@ +using Radzen; +using SystemX.Core.Services; using Web.Tra.Components; +using WebClient.Library.Config; + +string configDir = @"../../Config"; +string configFileName = "WebClient.Tra.Config.json"; + +//raed log4net configs +if (LogXnet.ReadConfig(@$"{configDir}/LogXnetConfig.json") == true) +{ + LogXnet.WriteLine("LogXnet Init Success"); +} +else +{ + Console.WriteLine("LogXnet Init Failed"); + return; +} var builder = WebApplication.CreateBuilder(args); +//singleton +builder.Services.AddSingleton>(); + +//db +builder.Services.AddSingleton(); // Generic µî·Ï + // Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); +builder.Services.AddRadzenComponents(); + +//config preload, auth set +ConfigService preloadConfig = new ConfigService(); +if (preloadConfig.OpenConfig($@"{configDir}/{configFileName}") == true) +{ + var config = preloadConfig.GetConfig(); +} +else +{ + LogXnet.WriteLine("Config Preload Load Error.", LogXLabel.Error); + return; +} + var app = builder.Build(); +//read api config and set +string serverUrl = string.Empty; +var configService = app.Services.GetService>(); +bool isIIS = false; + +if (configService?.OpenConfig($@"{configDir}/{configFileName}") == true) +{ + LogXnet.WriteLine("WebClient Config Success."); + var apiConfig = ConfigService.Config; + if (apiConfig != null) + { + serverUrl = $"{apiConfig?.Server?.Address}:{apiConfig?.Server?.Port}"; + isIIS = apiConfig!.Server.IIS; + + using (var scoped = app.Services.CreateScope()) + { + var dbProvider = scoped.ServiceProvider.GetRequiredService(); + dbProvider?.SetDBList(apiConfig?.DataBase); + } + } +} +else +{ + LogXnet.WriteLine("WebClient Config Error."); + return; +} // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { @@ -24,4 +87,12 @@ app.UseAntiforgery(); app.MapRazorComponents() .AddInteractiveServerRenderMode(); -app.Run(); +if (isIIS == true) +{ + app.Run(); +} +else +{ + LogXnet.WriteLine($"Operation Url: {serverUrl}"); + app.Run($"{serverUrl}"); +} diff --git a/Projects/WebClient/Web.Tra/Web.Tra.csproj b/Projects/WebClient/Web.Tra/Web.Tra.csproj index 1b28a01..5339b48 100644 --- a/Projects/WebClient/Web.Tra/Web.Tra.csproj +++ b/Projects/WebClient/Web.Tra/Web.Tra.csproj @@ -6,4 +6,22 @@ enable + + + + + + + + + + + + ..\..\DLL\SystemX.Core.dll + + + ..\..\DLL\SystemX.Core.DB.dll + + + diff --git a/Projects/WebClient/WebClient.Library/Config/WebClientConfig.cs b/Projects/WebClient/WebClient.Library/Config/WebClientConfig.cs new file mode 100644 index 0000000..788e885 --- /dev/null +++ b/Projects/WebClient/WebClient.Library/Config/WebClientConfig.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json.Serialization; +using System.Threading.Tasks; +using SystemX.Core.Config; +using SystemX.Core.Config.Model; + +namespace WebClient.Library.Config +{ + public class WebClientConfig : WebCommonConfig + { + [JsonPropertyName("DataBase")] + public List? DataBase { get; set; } + } +} diff --git a/Projects/WebClient/WebClient.Library/WebClient.Library.csproj b/Projects/WebClient/WebClient.Library/WebClient.Library.csproj new file mode 100644 index 0000000..800db7d --- /dev/null +++ b/Projects/WebClient/WebClient.Library/WebClient.Library.csproj @@ -0,0 +1,24 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + ..\..\DLL\SystemX.Core.dll + + + ..\..\DLL\SystemX.Core.DB.dll + + + + diff --git a/Projects/WebClient/WebClient.sln b/Projects/WebClient/WebClient.sln index fbc0cc8..959706b 100644 --- a/Projects/WebClient/WebClient.sln +++ b/Projects/WebClient/WebClient.sln @@ -7,6 +7,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web.Operation", "Web.Operat EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web.Tra", "Web.Tra\Web.Tra.csproj", "{50F6BD6D-4B1C-4BA7-AE35-081AD71652EB}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{C8D5274F-AC00-46C7-1F8D-E88E81087A52}" + ProjectSection(SolutionItems) = preProject + ..\Config\WebClient.Tra.Config.json = ..\Config\WebClient.Tra.Config.json + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebClient.Library", "WebClient.Library\WebClient.Library.csproj", "{7E6C5983-F4AB-4E1C-91A7-70D2F6FE2546}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +28,10 @@ Global {50F6BD6D-4B1C-4BA7-AE35-081AD71652EB}.Debug|Any CPU.Build.0 = Debug|Any CPU {50F6BD6D-4B1C-4BA7-AE35-081AD71652EB}.Release|Any CPU.ActiveCfg = Release|Any CPU {50F6BD6D-4B1C-4BA7-AE35-081AD71652EB}.Release|Any CPU.Build.0 = Release|Any CPU + {7E6C5983-F4AB-4E1C-91A7-70D2F6FE2546}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E6C5983-F4AB-4E1C-91A7-70D2F6FE2546}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E6C5983-F4AB-4E1C-91A7-70D2F6FE2546}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E6C5983-F4AB-4E1C-91A7-70D2F6FE2546}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE