[성현모] TRA 컨피그, 레이아웃 생성
This commit is contained in:
17
Projects/Config/WebClient.Tra.Config.json
Normal file
17
Projects/Config/WebClient.Tra.Config.json
Normal file
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
@page "/counter"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Counter</PageTitle>
|
||||
|
||||
|
||||
@ -10,11 +10,13 @@
|
||||
<link rel="stylesheet" href="Web.Tra.styles.css" />
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<HeadOutlet />
|
||||
<RadzenTheme Theme="material-dark" @rendermode="InteractiveServer" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<Routes />
|
||||
<script src="_framework/blazor.web.js"></script>
|
||||
<script src="_content/Radzen.Blazor/Radzen.Blazor.js?v=@(typeof(Radzen.Colors).Assembly.GetName().Version)"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@ -1,23 +1,32 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<div class="page">
|
||||
<div class="sidebar">
|
||||
<NavMenu />
|
||||
</div>
|
||||
<RadzenComponents @rendermode="InteractiveServer" />
|
||||
<RadzenLayout>
|
||||
<RadzenHeader>
|
||||
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Gap="0">
|
||||
<RadzenSidebarToggle Click="@(() => sidebarExpanded = !sidebarExpanded)" />
|
||||
<RadzenLabel Text="Header" />
|
||||
</RadzenStack>
|
||||
</RadzenHeader>
|
||||
<RadzenSidebar @bind-Expanded="@sidebarExpanded">
|
||||
<RadzenPanelMenu>
|
||||
<RadzenPanelMenuItem Text="Home" Icon="home" Path="/" />
|
||||
<RadzenPanelMenuItem Text="TRA" Icon="assessment" Path="/tra" />
|
||||
</RadzenPanelMenu>
|
||||
|
||||
<main>
|
||||
<div class="top-row px-4">
|
||||
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
|
||||
</div>
|
||||
|
||||
<article class="content px-4">
|
||||
</RadzenSidebar>
|
||||
<RadzenBody>
|
||||
<div class="rz-p-4">
|
||||
@Body
|
||||
</article>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</RadzenBody>
|
||||
<RadzenFooter>
|
||||
Footer
|
||||
</RadzenFooter>
|
||||
</RadzenLayout>
|
||||
|
||||
@code {
|
||||
bool sidebarExpanded = true;
|
||||
}
|
||||
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
<div class="top-row ps-3 navbar navbar-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="">Web.Tra</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="checkbox" title="Navigation menu" class="navbar-toggler" />
|
||||
|
||||
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
|
||||
<nav class="flex-column">
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
||||
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="counter">
|
||||
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="weather">
|
||||
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather
|
||||
</NavLink>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
@page "/counter"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Counter</PageTitle>
|
||||
|
||||
<h1>Counter</h1>
|
||||
|
||||
<p role="status">Current count: @currentCount</p>
|
||||
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
|
||||
private void IncrementCount()
|
||||
{
|
||||
currentCount++;
|
||||
}
|
||||
}
|
||||
7
Projects/WebClient/Web.Tra/Components/Pages/TRA.razor
Normal file
7
Projects/WebClient/Web.Tra/Components/Pages/TRA.razor
Normal file
@ -0,0 +1,7 @@
|
||||
@page "/tra"
|
||||
|
||||
<h3>TRA</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
@page "/weather"
|
||||
@attribute [StreamRendering]
|
||||
|
||||
<PageTitle>Weather</PageTitle>
|
||||
|
||||
<h1>Weather</h1>
|
||||
|
||||
<p>This component demonstrates showing data.</p>
|
||||
|
||||
@if (forecasts == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Temp. (C)</th>
|
||||
<th>Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var forecast in forecasts)
|
||||
{
|
||||
<tr>
|
||||
<td>@forecast.Date.ToShortDateString()</td>
|
||||
<td>@forecast.TemperatureC</td>
|
||||
<td>@forecast.TemperatureF</td>
|
||||
<td>@forecast.Summary</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,6 @@
|
||||
<Router AppAssembly="typeof(Program).Assembly">
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<Router AppAssembly="typeof(Program).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
|
||||
<FocusOnNavigate RouteData="routeData" Selector="h1" />
|
||||
|
||||
@ -8,3 +8,6 @@
|
||||
@using Microsoft.JSInterop
|
||||
@using Web.Tra
|
||||
@using Web.Tra.Components
|
||||
|
||||
@using Radzen
|
||||
@using Radzen.Blazor
|
||||
@ -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<ConfigService<WebClientConfig>>();
|
||||
|
||||
//db
|
||||
builder.Services.AddSingleton<DbContextProvider>(); // Generic <20><><EFBFBD><EFBFBD>
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorComponents()
|
||||
.AddInteractiveServerComponents();
|
||||
|
||||
builder.Services.AddRadzenComponents();
|
||||
|
||||
//config preload, auth set
|
||||
ConfigService<WebClientConfig> preloadConfig = new ConfigService<WebClientConfig>();
|
||||
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<ConfigService<WebClientConfig>>();
|
||||
bool isIIS = false;
|
||||
|
||||
if (configService?.OpenConfig($@"{configDir}/{configFileName}") == true)
|
||||
{
|
||||
LogXnet.WriteLine("WebClient Config Success.");
|
||||
var apiConfig = ConfigService<WebClientConfig>.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<DbContextProvider>();
|
||||
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<App>()
|
||||
.AddInteractiveServerRenderMode();
|
||||
|
||||
app.Run();
|
||||
if (isIIS == true)
|
||||
{
|
||||
app.Run();
|
||||
}
|
||||
else
|
||||
{
|
||||
LogXnet.WriteLine($"Operation Url: {serverUrl}");
|
||||
app.Run($"{serverUrl}");
|
||||
}
|
||||
|
||||
@ -6,4 +6,22 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Radzen.Blazor" Version="7.3.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WebClient.Library\WebClient.Library.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="SystemX.Core">
|
||||
<HintPath>..\..\DLL\SystemX.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SystemX.Core.DB">
|
||||
<HintPath>..\..\DLL\SystemX.Core.DB.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -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>? DataBase { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.19" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.19" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="SystemX.Core">
|
||||
<HintPath>..\..\DLL\SystemX.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SystemX.Core.DB">
|
||||
<HintPath>..\..\DLL\SystemX.Core.DB.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user