Skip to content

Add the dashboard

The Blazor Server dashboard is a pure consumer of UKBatch.Api over HTTP/SignalR. In embedded mode you point it at your own loopback /api.

using UKBatch.Api;
using UKBatch.AspNetCore;
using UKBatch.Dashboard;
using UKBatch.Dashboard.Configuration;
var builder = WebApplication.CreateBuilder(args);
builder.AddUKBatchAspNetCore(b => b.AddJob<HelloJob>());
builder.Services.AddUKBatchApi();
builder.Services.AddUKBatchDashboard(opts =>
{
opts.Services.Add(new UKBatchServiceDescriptor
{
Name = "self",
BaseUrl = new Uri("http://localhost:5050/api/"),
DisplayName = "Local",
});
});
builder.Services.AddAntiforgery();
var app = builder.Build();
app.UseAntiforgery(); // REQUIRED for Razor Components — see Gotchas
app.MapGroup("/api").MapUKBatchApi(); // REST + SignalR hub at /api/hubs/jobs
app.MapUKBatchDashboard(); // UI at /dashboard
app.MapStaticAssets(); // serves Blazor framework assets (.NET 9+; on .NET 8 use app.UseStaticFiles())
app.Run();

Open http://localhost:5050/dashboard. The Jobs, Batches, Executions, and Approvals pages appear immediately.

For multi-service configuration (one central dashboard fanned out across many services), see the UKBatch.Dashboard package page.