Compare commits

..

3 Commits

Author SHA1 Message Date
Loretta 005645de9c Isolate InfoPanel templates, document DataItem contract
- Added MGGRID_TODO.md entry (ACBLAZOR-GRID-T-E3B6) for ErrorBoundary isolation of consumer templates and DataItem contract documentation.
- Updated GridShippingDocumentInfoPanel.razor to guard against null ShippingItems after add/save, preventing unhandled exceptions.
- Added PowerShell command in settings.local.json to count MGGRID_TODO.md lines for monitoring.
2026-07-13 08:57:07 +02:00
Loretta 71ffb4a2f6 Update logger SignalR hub to use LogItemClient wire type
- Switched LoggerSignalRHub and SignaRClientLogItemWriter to use LogItemClient as the AcBinary wire type for symmetric client-server logging.
- Added LogItemClient.cs with AcBinary serialization attribute.
- Added direct AyCode.Entities.dll reference for base type resolution.
- Improved README docs for logger hub, client writer, and DI constructor fix.
- Updated build/test scripts and removed obsolete FbLogItem.cs.
2026-07-13 08:38:37 +02:00
Loretta d1217700b4 Centralize SignalR hub URL config via BaseUrl property
Refactored hub URL handling to use a single BaseUrl property in FruitBankConstClient, set at startup from appsettings ("AyCode:Urls:BaseUrl"). Removed hardcoded and commented-out URLs. All startup files now hydrate BaseUrl and construct hub URLs at runtime, ensuring both fbHub and loggerHub use the same base. The AcHubConnection:Url setting is now ignored in appsettings.json. Added fast-fail if BaseUrl is missing. Also updated PowerShell build/test commands in settings.local.json. This prevents environment mismatches and enforces explicit configuration.
2026-07-13 07:01:42 +02:00
16 changed files with 119 additions and 33 deletions

File diff suppressed because one or more lines are too long

View File

@ -29,6 +29,10 @@
<Reference Include="AyCode.Core">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\$(Configuration)\net9.0\AyCode.Core.dll</HintPath>
</Reference>
<!-- FbLogItem : AcLogItemClient — a hub TLogItem-constraintjéhez kell a bázistípus assembly-je (a DLL-referencia nem tranzitív). -->
<Reference Include="AyCode.Entities">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\$(Configuration)\net9.0\AyCode.Entities.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\$(Configuration)\net9.0\AyCode.Interfaces.dll</HintPath>
</Reference>

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,11 @@
using AyCode.Services.Server.SignalRs;
using AyCode.Services.Server.SignalRs;
using FruitBank.Common.Loggers;
using FruitBank.Common.Server.Services.Loggers;
namespace FruitBank.Common.Server.Services.SignalRs;
public class LoggerSignalRHub(LoggerToLoggerApiController logger) : AcLoggerSignalRHub<LoggerToLoggerApiController>(logger)
// LogItemClient: a kliens-writerrel (SignaRClientLogItemWriter : AcSignaRClientLogItemWriter<LogItemClient>) azonos
// wire-típus — a SignalR erre deserializál, AcBinary-nál a LogItemClient generált serializere fut.
public class LoggerSignalRHub(LoggerToLoggerApiController logger) : AcLoggerSignalRHub<LoggerToLoggerApiController, LogItemClient>(logger)
{ }

File diff suppressed because one or more lines are too long

View File

@ -7,18 +7,20 @@ public static class FruitBankConstClient
{
public static string DefaultLocale = "en-US";
//public static string BaseUrl = "https://localhost:59579"; //FrutiBank nop
//public static string BaseUrl = "https://localhost:44372"; //FrutiBank nop
public static string BaseUrl = "https://shop.fruitbank.hu"; //FrutiBank nop
//public static string BaseUrl = "https://fruitbank.mangoweb.hu"; //FrutiBank nop test
#if RELEASE
//public static string BaseUrl = "https://shop.fruitbank.hu"; //FrutiBank nop
#endif
//public static string BaseUrl = "http://localhost:59579"; //FrutiBank nop
//public static string BaseUrl = "http://10.0.2.2:59579"; //FrutiBank (android) nop
//public static string BaseUrl = "https://localhost:7144"; //HybridApp
// A nop szerver base URL-je. Induláskor a host tölti fel az appsettings "AyCode:Urls:BaseUrl"-ből
// (ld. Program.cs / MauiProgram.cs). Az fbHub ÉS a loggerHub is EBBŐL az egy értékből származik (+/fbHub, +/loggerHub).
// Default: null — ha nincs beállítva, az OLVASÁS exception-t dob, nem megy tovább csendben hiányzó/rossz URL-lel.
// A környezet-váltás az appsettings-ben történik:
// dev: https://localhost:59579 | prod: https://shop.fruitbank.hu | test: https://fruitbank.mangoweb.hu | android: http://10.0.2.2:59579
private static string? _baseUrl;
public static string BaseUrl
{
get => !string.IsNullOrWhiteSpace(_baseUrl)
? _baseUrl
: throw new InvalidOperationException("FruitBankConstClient.BaseUrl nincs beállítva — a host indulásakor hidratáld az appsettings 'AyCode:Urls:BaseUrl' értékéből (Program.cs / MauiProgram.cs).");
set => _baseUrl = value;
}
public static string DefaultHubName = "fbHub";
public static string LoggerHubName = "loggerHub";

View File

@ -0,0 +1,16 @@
using AyCode.Core.Serializers.Attributes;
using AyCode.Entities.LogItems;
namespace FruitBank.Common.Loggers;
/// <summary>
/// A FruitBank kliens↔szerver log-feltöltés wire-típusa (writer és loggerHub ugyanezt használja — szimmetrikus wire).
/// Az AcLogItemClient az AyCode.Entities generator-mentes rétegében él; itt, a FruitBank.Common-ban (ahol az
/// AcBinary source-generator fut) kap generált serializert — így a loggerHub AcBinary-protokollal mehet.
/// A generator az örökölt propertyket is felveszi (derived → base sorrend, runtime-kompatibilis).
/// Feature-ök kikapcsolva (false): kis, lapos POCO — id/ref/intern/metadata nem kell, a sorosítás így a leggyorsabb.
/// </summary>
[AcBinarySerializable(false)]
public class LogItemClient : AcLogItemClient
{
}

File diff suppressed because one or more lines are too long

View File

@ -1,17 +1,38 @@
using AyCode.Core.Enums;
using AyCode.Core.Enums;
using AyCode.Core.Loggers;
using AyCode.Core.Serializers.Binaries;
using AyCode.Services.Loggers;
using AyCode.Services.SignalRs;
using Microsoft.Extensions.Logging.Abstractions;
namespace FruitBank.Common.Loggers
{
public class SignaRClientLogItemWriter : AcSignaRClientLogItemWriter
/// <summary>
/// FruitBank log-feltöltő: LogItemClient wire-típussal, AcBinary-protokollon (egységes a fbHub-bal).
/// Cél: {BaseUrl}/loggerHub — a BaseUrl-t a host hidratálja az appsettings-ből.
/// </summary>
public class SignaRClientLogItemWriter : AcSignaRClientLogItemWriter<LogItemClient>
{
public SignaRClientLogItemWriter() : this(AppType.Web, LogLevel.Detail, null)
{
}
public SignaRClientLogItemWriter(AppType appType, LogLevel logLevel, string? categoryName = null) : base($"{FruitBankConstClient.BaseUrl}/{FruitBankConstClient.LoggerHubName}", appType, logLevel, categoryName)
public SignaRClientLogItemWriter(AppType appType, LogLevel logLevel, string? categoryName = null)
: base($"{FruitBankConstClient.BaseUrl}/{FruitBankConstClient.LoggerHubName}", appType, logLevel, categoryName, CreateProtocolOptions())
{
}
}
// ⚠️ VÉGTELEN-CIKLUS VESZÉLY — NE ADJ LOGGERT A PROTOKOLLNAK! ⚠️
// Ez a writer maga A log-feltöltő csatorna. Ha a protokoll loggert kapna (LoggerClient, ILogger, bármi,
// ami ebbe a writerbe torkollik), akkor minden feltöltés sorosítása ÚJABB log-sorokat termelne
// (Serialize start / WriteArgument / ...), amiket ez a writer megint felküldene → sorosítás → log → ...
// → robbanó visszacsatolás, a kliens másodpercek alatt megfullad.
// Ezért a Logger EXPLICIT NullLogger.Instance (nem null! — a null-t az AddAcBinaryProtocol ??= fallbackje
// a DI ILogger<AcBinaryHubProtocol>-jával pótolná, ami visszahozná a hurkot).
// Ugyanezért erre a hub-builderre AddAcDefaults/ConfigureLogging SOHA nem kerülhet.
private static AcBinaryHubProtocolOptions CreateProtocolOptions() => new()
{
ProtocolMode = BinaryProtocolMode.Bytes, // WASM-safe, ugyanaz, mint az fbHub-on
Logger = NullLogger.Instance, // süket logger — ld. a fenti figyelmeztetést
};
}
}

View File

@ -25,7 +25,9 @@
<AfterColumnsTemplate Context="ctx">
@if (ctx.DataItem is not ShippingDocument && ctx.DataItem is not ShippingItem) return;
@if (ctx is { DataItem: ShippingDocument doc, IsEditMode: false })
@* ShippingItems: not null — add után a kijelölt sor a szerver-válasz NYERS entitása lehet (relációk betöltése
nélkül, ShippingItems == null), amíg a grid-reload le nem cseréli; a tétel-táblázat addig nem renderelődik. *@
@if (ctx is { DataItem: ShippingDocument { ShippingItems: not null } doc, IsEditMode: false })
{
<table class="table table-sm table-bordered table-striped" style="margin-top: 35px;">
<colgroup>

View File

@ -26,8 +26,7 @@
},
"AcHubConnection": {
"Url": "https://localhost:59579/fbHub",
//"Url": "https://shop.fruitbank.hu/fbHub",
// Az Url innen KIVÉVE: az fbHub és a loggerHub is az AyCode:Urls:BaseUrl-ből származik (kódban: +/fbHub, +/loggerHub).
"TransportMaxBufferSize": 30000000,
"ApplicationMaxBufferSize": 30000000,
"CloseTimeout": "00:00:10",

View File

@ -18,6 +18,11 @@ using Microsoft.Extensions.Options;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
// Hub-URL-ek EGY forrásból: az fbHub és a loggerHub is az AyCode:Urls:BaseUrl-ből származik.
// A loggerHub writer a FruitBankConstClient.BaseUrl-t olvassa, ezért induláskor onnan hidratáljuk.
FruitBankConstClient.BaseUrl = builder.Configuration["AyCode:Urls:BaseUrl"]
?? throw new InvalidOperationException("Hiányzik az 'AyCode:Urls:BaseUrl' az appsettings-ből — a hub-ok URL-je ebből származik.");
builder.Services.AddDevExpressBlazor(configure => configure.SizeMode = DevExpress.Blazor.SizeMode.Medium);
// Add device-specific services used by the FruitBankHybrid.Shared project
@ -32,7 +37,12 @@ builder.Services.AddSingleton<LoggedInModel>(sp => new LoggedInModel(sp.GetRequi
// Bind SignalR options from wwwroot/appsettings.json (loaded automatically by WebAssemblyHostBuilder) —
// single Configure call per options type, combining section Bind with runtime overrides.
builder.Services.Configure<AcHubConnectionOptions>(opts => builder.Configuration.GetSection("AcHubConnection").Bind(opts));
builder.Services.Configure<AcHubConnectionOptions>(opts =>
{
builder.Configuration.GetSection("AcHubConnection").Bind(opts);
// Az fbHub URL a közös BaseUrl-ből (nem külön AcHubConnection:Url) — így nem tud eltérni a loggerHub-tól.
opts.Url = $"{FruitBankConstClient.BaseUrl}/{FruitBankConstClient.DefaultHubName}";
});
builder.Services.Configure<AcBinaryHubProtocolOptions>(opts =>
{

View File

@ -26,8 +26,7 @@
},
"AcHubConnection": {
"Url": "https://localhost:59579/fbHub",
//"Url": "https://shop.fruitbank.hu/fbHub",
// Az Url innen KIVÉVE: az fbHub és a loggerHub is az AyCode:Urls:BaseUrl-ből származik (kódban: +/fbHub, +/loggerHub).
"TransportMaxBufferSize": 30000000,
"ApplicationMaxBufferSize": 30000000,
"CloseTimeout": "00:00:10",

View File

@ -17,6 +17,10 @@ using Microsoft.Extensions.Options;
var builder = WebApplication.CreateBuilder(args);
// Hub-URL-ek EGY forrásból: az fbHub és a loggerHub is az AyCode:Urls:BaseUrl-ből származik.
FruitBankConstClient.BaseUrl = builder.Configuration["AyCode:Urls:BaseUrl"]
?? throw new InvalidOperationException("Hiányzik az 'AyCode:Urls:BaseUrl' az appsettings-ből — a hub-ok URL-je ebből származik.");
builder.Services.AddRazorComponents().AddInteractiveWebAssemblyComponents();
builder.Services.AddDevExpressBlazor(configure => configure.SizeMode = DevExpress.Blazor.SizeMode.Medium);
builder.Services.AddMvc();
@ -36,7 +40,12 @@ builder.Services.AddSingleton<LoggedInModel>(sp => new LoggedInModel(sp.GetRequi
// Bind SignalR options from appsettings.json — single Configure call per options type.
// The lambda runs the appsettings Bind first, then any runtime overrides (e.g. the WASM safety net).
builder.Services.Configure<AcHubConnectionOptions>(opts => builder.Configuration.GetSection("AcHubConnection").Bind(opts));
builder.Services.Configure<AcHubConnectionOptions>(opts =>
{
builder.Configuration.GetSection("AcHubConnection").Bind(opts);
// Az fbHub URL a közös BaseUrl-ből (nem külön AcHubConnection:Url) — így nem tud eltérni a loggerHub-tól.
opts.Url = $"{FruitBankConstClient.BaseUrl}/{FruitBankConstClient.DefaultHubName}";
});
builder.Services.Configure<AcBinaryHubProtocolOptions>(opts =>
{

View File

@ -26,8 +26,7 @@
},
"AcHubConnection": {
"Url": "https://localhost:59579/fbHub",
//"Url": "https://shop.fruitbank.hu/fbHub",
// Az Url innen KIVÉVE: az fbHub és a loggerHub is az AyCode:Urls:BaseUrl-ből származik (kódban: +/fbHub, +/loggerHub).
"TransportMaxBufferSize": 30000000,
"ApplicationMaxBufferSize": 30000000,
"CloseTimeout": "00:00:10",

View File

@ -1,6 +1,7 @@
using AyCode.Core.Enums;
using AyCode.Core.Loggers;
using AyCode.Services.SignalRs;
using FruitBank.Common;
using FruitBank.Common.Loggers;
using FruitBank.Common.Models;
using FruitBank.Common.Services;
@ -46,6 +47,10 @@ namespace FruitBankHybrid
}
}
// Hub-URL-ek EGY forrásból: az fbHub és a loggerHub is az AyCode:Urls:BaseUrl-ből származik.
FruitBankConstClient.BaseUrl = builder.Configuration["AyCode:Urls:BaseUrl"]
?? throw new InvalidOperationException("Hiányzik az 'AyCode:Urls:BaseUrl' az appsettings-ből — a hub-ok URL-je ebből származik.");
#if DEBUG
builder.Services.AddSingleton<IAcLogWriterClientBase, BrowserConsoleLogWriter>();
#endif
@ -59,7 +64,12 @@ namespace FruitBankHybrid
// Bind SignalR options from configuration.
// Precedence: code default → appsettings.json (this line) → any later Configure<T> action.
builder.Services.Configure<AcHubConnectionOptions>(builder.Configuration.GetSection("AcHubConnection"));
builder.Services.Configure<AcHubConnectionOptions>(opts =>
{
builder.Configuration.GetSection("AcHubConnection").Bind(opts);
// Az fbHub URL a közös BaseUrl-ből (nem külön AcHubConnection:Url) — így nem tud eltérni a loggerHub-tól.
opts.Url = $"{FruitBankConstClient.BaseUrl}/{FruitBankConstClient.DefaultHubName}";
});
builder.Services.Configure<AcBinaryHubProtocolOptions>(builder.Configuration.GetSection("AcBinaryHubProtocol"));
// Add device-specific services used by the FruitBankHybrid.Shared project