feat(mtconnect): warn at Test Connect and deploy when SampleCount >= the Agent bufferSize (#825)
Parse the /probe Header bufferSize; MTConnectDriverProbe reads sampleCount (default 1000) and answers Ok with a WARNING message (amber chip in the Test Connect button); InitializeAsync logs the same Warning and exposes agentBufferSize on the diagnostics bag. Live-checked against the shared cppagent fixture (bufferSize 16384).
This commit is contained in:
+20
-1
@@ -12,7 +12,16 @@
|
||||
|
||||
@if (_result is not null)
|
||||
{
|
||||
@if (_result.Ok)
|
||||
@if (_result.Ok && WarningOf(_result.Message) is { } warning)
|
||||
{
|
||||
@* Reachable but misconfigured (e.g. MTConnect SampleCount >= the Agent's bufferSize, #825): a probe
|
||||
that answers Ok with a "WARNING:" message is shown amber with the warning, never a plain green OK. *@
|
||||
<span class="chip chip-warn" title="@warning">
|
||||
OK with warning · @_result.LatencyMs?.ToString("F0") ms
|
||||
</span>
|
||||
<div class="small text-warning mt-1">@warning</div>
|
||||
}
|
||||
else if (_result.Ok)
|
||||
{
|
||||
<span class="chip chip-ok" title="@($"Probe succeeded in {_result.LatencyMs:F0} ms")">
|
||||
OK · @_result.LatencyMs?.ToString("F0") ms
|
||||
@@ -28,6 +37,16 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
/// <summary>The marker a probe puts in an <c>Ok</c> message to flag a warning (see <c>MTConnectDriverProbe</c>).</summary>
|
||||
internal const string WarningMarker = "WARNING:";
|
||||
|
||||
/// <summary>The warning text after <see cref="WarningMarker"/>, or null when the message carries none.</summary>
|
||||
internal static string? WarningOf(string? message)
|
||||
{
|
||||
var at = message?.IndexOf(WarningMarker, StringComparison.Ordinal) ?? -1;
|
||||
return at < 0 ? null : message![(at + WarningMarker.Length)..].Trim();
|
||||
}
|
||||
|
||||
/// <summary>Driver type key — must match an installed <c>IDriverProbe.DriverType</c>.</summary>
|
||||
[Parameter, EditorRequired] public string DriverType { get; set; } = "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user