f40da64a05
Validators (Pushes and Pull Requests) / validate-ui-and-storage (push) Successful in 24s
Prepare Release / Build & Create Release (push) Successful in 56s
Prepare Release / Release Notification (push) Successful in 1s
Validators (Pushes and Pull Requests) / validate-core (push) Successful in 2m8s
51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using QuantEngine.Core.Interfaces;
|
|
using QuantEngine.Web.Services;
|
|
|
|
namespace QuantEngine.Web.Pages.Admin.Collection;
|
|
|
|
[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)]
|
|
public class DetailModel : PageModel
|
|
{
|
|
private readonly ICollectionRepository _collectionRepository;
|
|
private readonly ILogger<DetailModel> _logger;
|
|
|
|
public CollectionRunRecord? Run { get; set; }
|
|
|
|
public DetailModel(ICollectionRepository collectionRepository, ILogger<DetailModel> logger)
|
|
{
|
|
_collectionRepository = collectionRepository;
|
|
_logger = logger;
|
|
}
|
|
|
|
public async Task OnGetAsync([FromQuery] string? runId, [FromRoute] string? routeRunId)
|
|
{
|
|
var targetRunId = runId ?? routeRunId;
|
|
if (string.IsNullOrEmpty(targetRunId))
|
|
{
|
|
if (RouteData.Values.TryGetValue("runId", out var routeVal))
|
|
{
|
|
targetRunId = routeVal?.ToString();
|
|
}
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(targetRunId))
|
|
{
|
|
_logger.LogWarning("Detail page loaded without a runId");
|
|
return;
|
|
}
|
|
|
|
try
|
|
{
|
|
var runs = await _collectionRepository.GetRecentRunsAsync(limit: 100);
|
|
Run = runs.FirstOrDefault(r => r.RunId == targetRunId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError(ex, "Failed to load collection run detail for runId: {RunId}", targetRunId);
|
|
}
|
|
}
|
|
}
|