feat: initialize manufacturing progress dashboard
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using DongfangHydro.Dashboard.Api.Contracts;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace DongfangHydro.Dashboard.Api.Realtime;
|
||||
|
||||
public sealed class SignalRDashboardNotifier(IHubContext<DashboardHub> hubContext)
|
||||
: IDashboardNotifier
|
||||
{
|
||||
public async Task PublishUpdateAsync(
|
||||
UpdateNodeProgressResultDto update,
|
||||
DashboardOverviewDto overview,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var clients = hubContext.Clients.All;
|
||||
await Task.WhenAll(
|
||||
clients.SendAsync("nodeUpdated", update.Node, cancellationToken),
|
||||
clients.SendAsync("orderUpdated", update.Order, cancellationToken),
|
||||
clients.SendAsync("trendAppended", update.TrendPoint, cancellationToken),
|
||||
clients.SendAsync("overviewUpdated", overview, cancellationToken),
|
||||
update.RiskEvent is null
|
||||
? Task.CompletedTask
|
||||
: clients.SendAsync("riskEventCreated", update.RiskEvent, cancellationToken));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user