Expand XML docs across bridge and test code
This commit is contained in:
@@ -21,12 +21,24 @@ namespace ZB.MOM.WW.LmxOpcUa.Host.Status
|
||||
private GalaxyRepositoryStats? _galaxyStats;
|
||||
private OpcUaServerHost? _serverHost;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new status report service for the dashboard using the supplied health-check policy and refresh interval.
|
||||
/// </summary>
|
||||
/// <param name="healthCheck">The health-check component used to derive the overall dashboard health status.</param>
|
||||
/// <param name="refreshIntervalSeconds">The HTML auto-refresh interval, in seconds, for the dashboard page.</param>
|
||||
public StatusReportService(HealthCheckService healthCheck, int refreshIntervalSeconds)
|
||||
{
|
||||
_healthCheck = healthCheck;
|
||||
_refreshIntervalSeconds = refreshIntervalSeconds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Supplies the live bridge components whose status should be reflected in generated dashboard snapshots.
|
||||
/// </summary>
|
||||
/// <param name="mxAccessClient">The runtime client whose connection and subscription state should be reported.</param>
|
||||
/// <param name="metrics">The performance metrics collector whose operation statistics should be reported.</param>
|
||||
/// <param name="galaxyStats">The Galaxy repository statistics to surface on the dashboard.</param>
|
||||
/// <param name="serverHost">The OPC UA server host whose active session count should be reported.</param>
|
||||
public void SetComponents(IMxAccessClient? mxAccessClient, PerformanceMetrics? metrics,
|
||||
GalaxyRepositoryStats? galaxyStats, OpcUaServerHost? serverHost)
|
||||
{
|
||||
@@ -36,6 +48,10 @@ namespace ZB.MOM.WW.LmxOpcUa.Host.Status
|
||||
_serverHost = serverHost;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the structured dashboard snapshot consumed by the HTML and JSON renderers.
|
||||
/// </summary>
|
||||
/// <returns>The current dashboard status data for the bridge.</returns>
|
||||
public StatusData GetStatusData()
|
||||
{
|
||||
var connectionState = _mxAccessClient?.State ?? ConnectionState.Disconnected;
|
||||
@@ -71,6 +87,10 @@ namespace ZB.MOM.WW.LmxOpcUa.Host.Status
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the operator-facing HTML dashboard for the current bridge status.
|
||||
/// </summary>
|
||||
/// <returns>An HTML document containing the latest dashboard snapshot.</returns>
|
||||
public string GenerateHtml()
|
||||
{
|
||||
var data = GetStatusData();
|
||||
@@ -131,12 +151,20 @@ namespace ZB.MOM.WW.LmxOpcUa.Host.Status
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates an indented JSON status payload for API consumers.
|
||||
/// </summary>
|
||||
/// <returns>A JSON representation of the current dashboard snapshot.</returns>
|
||||
public string GenerateJson()
|
||||
{
|
||||
var data = GetStatusData();
|
||||
return JsonSerializer.Serialize(data, new JsonSerializerOptions { WriteIndented = true });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the bridge should currently be considered healthy for the dashboard health endpoint.
|
||||
/// </summary>
|
||||
/// <returns><see langword="true"/> when the bridge meets the health policy; otherwise, <see langword="false"/>.</returns>
|
||||
public bool IsHealthy()
|
||||
{
|
||||
var state = _mxAccessClient?.State ?? ConnectionState.Disconnected;
|
||||
|
||||
Reference in New Issue
Block a user