fix(web): support runId in Detail page from both route parameters and query strings
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
@page "{runId}"
|
||||
@page "{runId?}"
|
||||
@model QuantEngine.Web.Pages.Admin.Collection.DetailModel
|
||||
@{
|
||||
ViewData["Title"] = "수집 실행 상세";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using QuantEngine.Core.Interfaces;
|
||||
using QuantEngine.Web.Services;
|
||||
@@ -19,16 +20,31 @@ public class DetailModel : PageModel
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task OnGetAsync(string runId)
|
||||
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 == runId);
|
||||
Run = runs.FirstOrDefault(r => r.RunId == targetRunId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to load collection run detail");
|
||||
_logger.LogError(ex, "Failed to load collection run detail for runId: {RunId}", targetRunId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user