@page "/dashboard" @attribute [Authorize] @using QuantEngine.Core.Infrastructure @inject HttpClient Http QuantEngine - Admin Dashboard
관리자 대시보드 시스템 현황 및 데이터 수집 모니터링
총 수집 실행 @TotalRuns 이번 주 +@WeeklyRuns
성공률 @SuccessRate% 최근 30일
최근 에러 @RecentErrors 지난 7일
마지막 동기화 @LastSyncTime @(IsLastSyncSuccess ? "성공" : "경고")
최근 활동 @if (RecentActivities.Count == 0) { 활동 기록이 없습니다. } else { @foreach (var activity in RecentActivities) {
@activity.Title @activity.Timestamp.ToString("yyyy-MM-dd HH:mm:ss") @activity.Description
}
}
시스템 상태
API 서버 온라인
데이터베이스 연결됨
KIS API @(KisApiStatus ? "활성" : "비활성")
마지막 점검: @SystemCheckTime
최근 데이터 수집 실행 새로고침
@if (Sections.Count == 0) { 데이터 수집 기록이 없습니다. } else { 이름 상태 시작 시간 작업 @context.Name @context.Title @context.Preview 상세 }
@code { private readonly List Sections = new(); private readonly List RecentActivities = new(); // KPI values private int TotalRuns = 47; private int WeeklyRuns = 12; private int SuccessRate = 94; private int RecentErrors = 3; private string LastSyncTime = "2분 전"; private bool IsLastSyncSuccess = true; private bool KisApiStatus = true; private string SystemCheckTime = DateTime.Now.ToString("HH:mm:ss"); protected override async Task OnInitializedAsync() { try { // Load operational report var report = await Http.GetFromJsonAsync("api/operational-report"); if (report != null) { Sections.Clear(); Sections.AddRange(report.Sections); } } catch { // Handle error silently } // Load recent activities LoadRecentActivities(); } private void LoadRecentActivities() { RecentActivities.Clear(); RecentActivities.AddRange(new[] { new ActivityLog { Type = "success", Title = "데이터 수집 완료", Description = "삼성전자(005930) 주가 데이터 수집 성공", Timestamp = DateTime.Now.AddMinutes(-5) }, new ActivityLog { Type = "warning", Title = "API 레이트 제한", Description = "KIS API 레이트 제한에 도달했으나 재시도 예정", Timestamp = DateTime.Now.AddMinutes(-12) }, new ActivityLog { Type = "success", Title = "대시보드 업데이트", Description = "포트폴리오 구성 분석 완료", Timestamp = DateTime.Now.AddMinutes(-35) }, new ActivityLog { Type = "info", Title = "스케줄 실행", Description = "일일 정기 수집 작업 시작", Timestamp = DateTime.Now.AddHours(-1) } }); } private async Task RefreshData() { await OnInitializedAsync(); } private string GetActivityIcon(string type) => type switch { "success" => Icons.Material.Filled.CheckCircle, "warning" => Icons.Material.Filled.WarningAmber, "error" => Icons.Material.Filled.Error, _ => Icons.Material.Filled.Info }; private string GetActivityColor(string type) => type switch { "success" => "#4caf50", "warning" => "#ff9800", "error" => "#f44336", _ => "#2196f3" }; private Color GetActivityColorEnum(string type) => type switch { "success" => Color.Success, "warning" => Color.Warning, "error" => Color.Error, _ => Color.Info }; private class ActivityLog { public string Type { get; set; } public string Title { get; set; } public string Description { get; set; } public DateTime Timestamp { get; set; } } }