fix: 코드리뷰 즉시수정 4건 + 모니터링 실제 API 연동
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (push) Failing after 7s
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 13s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
Deploy to Production / Build & Deploy to Production (push) Successful in 2m19s

[1] NavMenu.razor — 하드코딩 'v2.1.0-Release' 버전 블록 완전 제거
    버전 표시는 MainLayout의 version.json 단일 소스로 통일

[2] MainLayout.razor — 로그아웃 URL 버그 수정
    /Account/Login?handler=Logout → /Account/Login
    (Razor Pages GET 핸들러는 쿼리스트링 ?handler=로 호출되지 않음)

[3] Dashboard.razor — AllowAnonymous 제거, debug 코드 정리
    - @attribute [AllowAnonymous] 삭제
    - DEBUG MARKER div 삭제
    - TEMPORARY 주석·Console.WriteLine 정리
    - 미인증 시 /Account/Login 리다이렉트 활성화

[4] DataCollectionMonitoring.razor — 전체 하드코딩 더미 데이터 제거
    - 'RUN-2026-07-05-002 진행중 30분+' 등 모든 더미 데이터 제거
    - /api/collection/runs + /api/collection/state 실제 API 연동
    - 로딩 스피너, 새로고침 버튼, 실제 상태 카운트 구현
This commit is contained in:
2026-07-06 17:59:31 +09:00
parent 4e23a87085
commit 055b7b3082
4 changed files with 117 additions and 201 deletions
@@ -133,7 +133,7 @@
{
var customProvider = (CustomAuthenticationStateProvider)AuthStateProvider;
await customProvider.LogoutFromServerAsync();
NavigationManager.NavigateTo("/Account/Login?handler=Logout", forceLoad: true);
NavigationManager.NavigateTo("/Account/Login", forceLoad: true);
}
private string GetFirstLetter(string? name)
@@ -15,13 +15,4 @@
<MudNavLink Href="/operations" Icon="@Icons.Material.Filled.PlaylistPlay" Match="NavLinkMatch.Prefix">
운영 리포트
</MudNavLink>
<!-- Divider -->
<MudDivider Class="my-2" />
<!-- System Version Status -->
<div class="px-4 py-2">
<MudText Typo="Typo.caption" Class="text-muted d-block">QuantEngine System</MudText>
<MudText Typo="Typo.caption" Class="text-muted">v2.1.0-Release</MudText>
</div>
</MudNavMenu>
@@ -1,6 +1,6 @@
@page "/dashboard"
@rendermode InteractiveWebAssembly
@attribute [Microsoft.AspNetCore.Authorization.AllowAnonymous]
@using QuantEngine.Core.Infrastructure
@using Microsoft.AspNetCore.Components.Authorization
@inject HttpClient Http
@@ -9,8 +9,7 @@
<PageTitle>QuantEngine - Admin Dashboard</PageTitle>
<!-- 🎯 DEBUG MARKER: DASHBOARD_RENDERING -->
<div id="dashboard-debug-marker" style="display:none;">DASHBOARD_RENDERING_ACTIVE</div>
<!-- Page Header -->
<div class="mb-6">
@@ -244,26 +243,15 @@
protected override async Task OnInitializedAsync()
{
// TEMPORARY: Disable auth check to verify dashboard loads
Console.WriteLine("[Dashboard] Page loading (auth check disabled for testing)");
// Check authentication
var authState = await AuthStateProvider.GetAuthenticationStateAsync();
Console.WriteLine($"[Dashboard] Auth state: IsAuthenticated={authState.User.Identity?.IsAuthenticated}, Name={authState.User.Identity?.Name}");
// TEMPORARY: Skip redirect, allow page to load
// if (!authState.User.Identity?.IsAuthenticated ?? true)
// {
// Console.WriteLine("[Dashboard] Not authenticated. Redirecting to login...");
// NavManager.NavigateTo("/login.html", forceLoad: true);
// return;
// }
Console.WriteLine($"[Dashboard] Page allowed to load");
if (!(authState.User.Identity?.IsAuthenticated ?? false))
{
NavManager.NavigateTo("/Account/Login", forceLoad: true);
return;
}
try
{
// Load operational report
var report = await Http.GetFromJsonAsync<OperationalReportData>("api/operational-report");
if (report != null)
{
@@ -276,7 +264,6 @@
// Handle error silently
}
// Load recent activities
LoadRecentActivities();
}
@@ -1,39 +1,54 @@
@page "/monitoring"
@attribute [Authorize]
@inject HttpClient Http
@inject ISnackbar Snackbar
<PageTitle>QuantEngine - 데이터 수집 모니터링</PageTitle>
<!-- Page Header -->
<div class="mb-6">
<div class="d-flex justify-content-between align-items-center">
<div>
<MudText Typo="Typo.h4" Class="mb-2">데이터 수집 모니터링</MudText>
<MudText Typo="Typo.body1" Class="text-muted">실시간 수집 작업 상태 및 에러 추적</MudText>
</div>
<MudButton Variant="Variant.Outlined" Color="Color.Primary" Size="Size.Small"
OnClick="RefreshAsync" Disabled="_loading">
<MudIcon Icon="@Icons.Material.Filled.Refresh" Size="Size.Small" Class="mr-2" />
새로고침
</MudButton>
</div>
</div>
@if (_loading)
{
<MudProgressLinear Indeterminate="true" Color="Color.Primary" Class="mb-4" />
}
<!-- Collection Status Cards -->
<MudGrid Spacing="3" Class="mb-6">
<MudItem xs="12" sm="6" md="3">
<MudPaper Class="pa-4" Elevation="0" Style="border: 1px solid var(--mud-palette-divider);">
<MudText Typo="Typo.caption" Class="text-muted mb-2">진행 중인 작업</MudText>
<MudText Typo="Typo.h5">@RunningCount</MudText>
<MudText Typo="Typo.h5">@_runningCount</MudText>
</MudPaper>
</MudItem>
<MudItem xs="12" sm="6" md="3">
<MudPaper Class="pa-4" Elevation="0" Style="border: 1px solid var(--mud-palette-divider);">
<MudText Typo="Typo.caption" Class="text-muted mb-2">완료</MudText>
<MudText Typo="Typo.h5" Class="text-success">@CompletedCount</MudText>
<MudText Typo="Typo.h5" Style="color: var(--mud-palette-success);">@_completedCount</MudText>
</MudPaper>
</MudItem>
<MudItem xs="12" sm="6" md="3">
<MudPaper Class="pa-4" Elevation="0" Style="border: 1px solid var(--mud-palette-divider);">
<MudText Typo="Typo.caption" Class="text-muted mb-2">실패</MudText>
<MudText Typo="Typo.h5" Class="text-error">@FailedCount</MudText>
<MudText Typo="Typo.h5" Style="color: var(--mud-palette-error);">@_failedCount</MudText>
</MudPaper>
</MudItem>
<MudItem xs="12" sm="6" md="3">
<MudPaper Class="pa-4" Elevation="0" Style="border: 1px solid var(--mud-palette-divider);">
<MudText Typo="Typo.caption" Class="text-muted mb-2">대기 중</MudText>
<MudText Typo="Typo.h5" Class="text-warning">@PendingCount</MudText>
<MudText Typo="Typo.caption" Class="text-muted mb-2">총 스냅샷</MudText>
<MudText Typo="Typo.h5">@_totalSnapshots</MudText>
</MudPaper>
</MudItem>
</MudGrid>
@@ -44,30 +59,30 @@
<MudTabPanel Text="최근 실행">
<div class="py-4">
<MudPaper Class="pa-4" Elevation="1">
@if (RecentRuns.Count == 0)
@if (_recentRuns.Count == 0 && !_loading)
{
<MudAlert Severity="Severity.Info">최근 실행 기록이 없습니다.</MudAlert>
}
else
{
<MudTable Items="@RecentRuns" Dense="true" Hover="true" Striped="true">
<MudTable Items="@_recentRuns" Dense="true" Hover="true" Striped="true">
<HeaderContent>
<MudTh>실행 ID</MudTh>
<MudTh>시작 시간</MudTh>
<MudTh>종료 시간</MudTh>
<MudTh>상태</MudTh>
<MudTh>수집된 항목</MudTh>
<MudTh>작업</MudTh>
<MudTh>스냅샷</MudTh>
<MudTh>에러</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Run ID">
<MudText Typo="Typo.body2" Class="font-monospace">@context.RunId</MudText>
</MudTd>
<MudTd DataLabel="Start">
<MudText Typo="Typo.body2">@context.StartTime.ToString("yyyy-MM-dd HH:mm:ss")</MudText>
<MudText Typo="Typo.body2">@FormatTime(context.StartedAt)</MudText>
</MudTd>
<MudTd DataLabel="End">
<MudText Typo="Typo.body2">@(context.EndTime?.ToString("yyyy-MM-dd HH:mm:ss") ?? "-")</MudText>
<MudText Typo="Typo.body2">@(string.IsNullOrEmpty(context.FinishedAt) ? "-" : FormatTime(context.FinishedAt))</MudText>
</MudTd>
<MudTd DataLabel="Status">
<MudChip T="string" Label="true" Size="Size.Small"
@@ -76,14 +91,20 @@
@context.Status
</MudChip>
</MudTd>
<MudTd DataLabel="Items">
<MudText Typo="Typo.body2">@context.ItemCount</MudText>
<MudTd DataLabel="Snapshots">
<MudText Typo="Typo.body2">@(context.TotalSnapshots?.ToString() ?? "-")</MudText>
</MudTd>
<MudTd DataLabel="Actions">
<MudButton Variant="Variant.Text" Size="Size.Small" Color="Color.Primary"
OnClick="@(() => ViewRunDetails(context))">
상세
</MudButton>
<MudTd DataLabel="Errors">
@if (context.TotalErrors > 0)
{
<MudChip T="string" Label="true" Size="Size.Small" Color="Color.Error" Variant="Variant.Outlined">
@context.TotalErrors
</MudChip>
}
else
{
<MudText Typo="Typo.body2">-</MudText>
}
</MudTd>
</RowTemplate>
</MudTable>
@@ -96,196 +117,113 @@
<MudTabPanel Text="에러 로그">
<div class="py-4">
<MudPaper Class="pa-4" Elevation="1">
@if (Errors.Count == 0)
@if (_errors.Count == 0 && !_loading)
{
<MudAlert Severity="Severity.Success">에러가 없습니다.</MudAlert>
}
else
{
<MudStack Spacing="2">
@foreach (var error in Errors)
@foreach (var error in _errors)
{
<div class="pa-3" style="border-left: 3px solid #f44336; background-color: var(--mud-palette-surface);">
<div class="d-flex justify-content-between align-items-start mb-2">
<MudText Typo="Typo.body2" Class="font-weight-500">@error.Message</MudText>
<MudText Typo="Typo.caption" Class="text-muted">@error.Timestamp.ToString("yyyy-MM-dd HH:mm:ss")</MudText>
<MudText Typo="Typo.body2" Class="font-weight-500">[@error.ErrorKind] @error.ErrorMessage</MudText>
<MudText Typo="Typo.caption" Class="text-muted">@FormatTime(error.CreatedAt)</MudText>
</div>
<MudText Typo="Typo.caption" Class="text-muted">Run ID: @error.RunId</MudText>
<MudText Typo="Typo.caption" Class="text-muted mt-1">@error.StackTrace</MudText>
</div>
}
</MudStack>
}
</MudPaper>
</div>
</MudTabPanel>
<!-- Collection Status -->
<MudTabPanel Text="수집 상태">
<div class="py-4">
<MudPaper Class="pa-4" Elevation="1">
<MudStack Spacing="3">
@foreach (var ticker in CollectionStatus)
<MudText Typo="Typo.caption" Class="text-muted">Run: @error.RunId</MudText>
@if (!string.IsNullOrEmpty(error.Ticker))
{
<div class="pa-3" style="border-bottom: 1px solid var(--mud-palette-divider);">
<div class="d-flex justify-content-between align-items-center mb-2">
<MudText Typo="Typo.body2" Class="font-weight-500">@ticker.Ticker</MudText>
<MudChip T="string" Label="true" Size="Size.Small"
Color="@(ticker.IsSuccessful ? Color.Success : Color.Warning)"
Variant="Variant.Filled">
@(ticker.IsSuccessful ? "성공" : "실패")
</MudChip>
</div>
<MudText Typo="Typo.caption" Class="text-muted">
마지막 수집: @ticker.LastCollectionTime.ToString("yyyy-MM-dd HH:mm:ss")
</MudText>
<MudText Typo="Typo.caption" Class="text-muted">
데이터 포인트: @(ticker.DataPointCount)개
</MudText>
<MudText Typo="Typo.caption" Class="text-muted ml-3">Ticker: @error.Ticker</MudText>
}
</div>
}
</MudStack>
}
</MudPaper>
</div>
</MudTabPanel>
</MudTabs>
@code {
// Status counts
private int RunningCount = 2;
private int CompletedCount = 156;
private int FailedCount = 8;
private int PendingCount = 5;
private bool _loading = false;
private int _runningCount;
private int _completedCount;
private int _failedCount;
private int _totalSnapshots;
// Recent runs
private List<RunModel> RecentRuns = new();
// Errors
private List<ErrorModel> Errors = new();
// Collection status
private List<CollectionStatusModel> CollectionStatus = new();
private List<CollectionRunDto> _recentRuns = new();
private List<CollectionErrorDto> _errors = new();
protected override async Task OnInitializedAsync()
{
await LoadData();
await RefreshAsync();
}
private async Task LoadData()
private async Task RefreshAsync()
{
// Load recent runs
RecentRuns = new List<RunModel>
{
new RunModel
{
RunId = "RUN-2026-07-05-001",
StartTime = DateTime.Now.AddMinutes(-45),
EndTime = DateTime.Now.AddMinutes(-40),
Status = "완료",
ItemCount = 142
},
new RunModel
{
RunId = "RUN-2026-07-05-002",
StartTime = DateTime.Now.AddMinutes(-30),
EndTime = null,
Status = "진행 중",
ItemCount = 87
},
new RunModel
{
RunId = "RUN-2026-07-04-012",
StartTime = DateTime.Now.AddHours(-8).AddMinutes(-15),
EndTime = DateTime.Now.AddHours(-8).AddMinutes(-5),
Status = "완료",
ItemCount = 189
}
};
_loading = true;
StateHasChanged();
// Load errors
Errors = new List<ErrorModel>
try
{
new ErrorModel
// 최근 실행 목록 로드
var runsResponse = await Http.GetFromJsonAsync<CollectionRunsResponse>("api/collection/runs?limit=20");
if (runsResponse?.Runs is not null)
{
RunId = "RUN-2026-07-04-011",
Message = "API Rate Limit Exceeded",
StackTrace = "Exception at CollectionService.FetchData()",
Timestamp = DateTime.Now.AddHours(-2)
},
new ErrorModel
{
RunId = "RUN-2026-07-03-015",
Message = "Connection Timeout",
StackTrace = "Exception at HttpClient.GetAsync()",
Timestamp = DateTime.Now.AddHours(-5)
}
};
// Load collection status
CollectionStatus = new List<CollectionStatusModel>
{
new CollectionStatusModel
{
Ticker = "005930",
IsSuccessful = true,
LastCollectionTime = DateTime.Now.AddMinutes(-2),
DataPointCount = 1450
},
new CollectionStatusModel
{
Ticker = "000660",
IsSuccessful = true,
LastCollectionTime = DateTime.Now.AddMinutes(-5),
DataPointCount = 1203
},
new CollectionStatusModel
{
Ticker = "051910",
IsSuccessful = false,
LastCollectionTime = DateTime.Now.AddHours(-1),
DataPointCount = 945
}
};
await Task.CompletedTask;
_recentRuns = runsResponse.Runs;
_runningCount = _recentRuns.Count(r => string.Equals(r.Status, "running", StringComparison.OrdinalIgnoreCase));
_completedCount = _recentRuns.Count(r => string.Equals(r.Status, "completed", StringComparison.OrdinalIgnoreCase)
|| string.Equals(r.Status, "PASS", StringComparison.OrdinalIgnoreCase));
_failedCount = _recentRuns.Count(r => string.Equals(r.Status, "failed", StringComparison.OrdinalIgnoreCase)
|| string.Equals(r.Status, "error", StringComparison.OrdinalIgnoreCase));
_totalSnapshots = _recentRuns.Sum(r => r.TotalSnapshots ?? 0);
}
private Color GetStatusColor(string status) => status switch
// 대시보드 상태 로드 (전체 오류 목록)
var state = await Http.GetFromJsonAsync<CollectionDashboardStateDto>("api/collection/state");
if (state?.RecentErrors is not null)
{
"완료" => Color.Success,
"진행 중" => Color.Info,
"실패" => Color.Error,
_errors = state.RecentErrors;
}
}
catch (Exception ex)
{
Snackbar.Add($"데이터 로드 실패: {ex.Message}", Severity.Error);
}
finally
{
_loading = false;
}
}
private Color GetStatusColor(string status) => status?.ToLowerInvariant() switch
{
"running" => Color.Info,
"completed" => Color.Success,
"pass" => Color.Success,
"failed" => Color.Error,
"error" => Color.Error,
_ => Color.Warning
};
private async Task ViewRunDetails(RunModel run)
private string FormatTime(string? isoTime)
{
// View details dialog
await Task.CompletedTask;
if (string.IsNullOrEmpty(isoTime)) return "-";
return DateTimeOffset.TryParse(isoTime, out var dt)
? dt.LocalDateTime.ToString("yyyy-MM-dd HH:mm:ss")
: isoTime;
}
private class RunModel
{
public string RunId { get; set; }
public DateTime StartTime { get; set; }
public DateTime? EndTime { get; set; }
public string Status { get; set; }
public int ItemCount { get; set; }
}
private class ErrorModel
{
public string RunId { get; set; }
public string Message { get; set; }
public string StackTrace { get; set; }
public DateTime Timestamp { get; set; }
}
private class CollectionStatusModel
{
public string Ticker { get; set; }
public bool IsSuccessful { get; set; }
public DateTime LastCollectionTime { get; set; }
public int DataPointCount { get; set; }
}
// DTOs (shared with ApiClient)
private record CollectionRunsResponse(List<CollectionRunDto> Runs, int Count);
private record CollectionRunDto(
string RunId, string Status, string StartedAt,
string? FinishedAt, int? TotalSnapshots, int? TotalErrors);
private record CollectionDashboardStateDto(
string? LastRunId, string? LastRunStatus, string? LastFinishedAt,
int TotalSnapshots, int TotalErrors, List<CollectionErrorDto> RecentErrors);
private record CollectionErrorDto(
string RunId, string SourceName, string ErrorKind,
string ErrorMessage, string? Ticker, string CreatedAt);
}