refactor: 프론트엔드 SSO 인증 통합 및 API 경로 정리

- Gateway 로그인/포탈 페이지 SSO 연동
- System1 web/fastapi-bridge API base URL 동적 설정
- SSO 토큰 기반 인증 흐름 통일
- deprecated JS 파일 삭제

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-06 23:18:09 +09:00
parent ec755ed52f
commit 61c810bd47
63 changed files with 255 additions and 1357 deletions

View File

@@ -13,7 +13,6 @@ let errorTimelineChart = null;
// 페이지 초기화
document.addEventListener('DOMContentLoaded', function() {
console.log('📈 작업 분석 페이지 초기화 시작');
initializePage();
loadInitialData();
@@ -35,7 +34,6 @@ function initializePage() {
setupLogoutButton();
// 기본 날짜 설정은 HTML에서 처리됨 (새로운 UI)
console.log('✅ 작업 분석 페이지 초기화 완료');
}
// 현재 시간 업데이트 (시 분 초 형식으로 고정)
@@ -92,7 +90,6 @@ function setupLogoutButton() {
// 초기 데이터 로드
async function loadInitialData() {
try {
console.log('📊 초기 데이터 로딩 시작');
// 프로젝트 목록 로드
const projects = await apiCall('/projects/active/list', 'GET');
@@ -101,7 +98,6 @@ async function loadInitialData() {
// 프로젝트 필터 옵션 업데이트
updateProjectFilters(projectData);
console.log('✅ 초기 데이터 로딩 완료');
} catch (error) {
console.error('초기 데이터 로딩 오류:', error);
@@ -145,7 +141,6 @@ function switchAnalysisMode(mode) {
});
document.getElementById(`${mode}-mode`).classList.add('active');
console.log(`🔄 분석 모드 전환: ${mode}`);
}
// 분석 탭 전환
@@ -164,7 +159,6 @@ function switchAnalysisTab(tab) {
});
document.getElementById(`${tab}-analysis`).classList.add('active');
console.log(`🔄 분석 탭 전환: ${tab}`);
}
// 기간별 분석 로드
@@ -186,7 +180,6 @@ async function loadPeriodAnalysis() {
showLoading(true);
try {
console.log('📊 기간별 분석 데이터 로딩 시작');
// API 호출 파라미터 구성
const params = new URLSearchParams({
@@ -199,28 +192,26 @@ async function loadPeriodAnalysis() {
}
// 여러 API를 병렬로 호출하여 종합 분석 데이터 구성
console.log('📡 API 파라미터:', params.toString());
const [statsRes, workerStatsRes, projectStatsRes, errorAnalysisRes] = await Promise.all([
apiCall(`/work-analysis/stats?${params}`, 'GET').catch(err => {
console.error(' stats API 오류:', err);
console.error(' stats API 오류:', err);
return { data: null };
}),
apiCall(`/work-analysis/worker-stats?${params}`, 'GET').catch(err => {
console.error(' worker-stats API 오류:', err);
console.error(' worker-stats API 오류:', err);
return { data: [] };
}),
apiCall(`/work-analysis/project-stats?${params}`, 'GET').catch(err => {
console.error(' project-stats API 오류:', err);
console.error(' project-stats API 오류:', err);
return { data: [] };
}),
apiCall(`/work-analysis/error-analysis?${params}`, 'GET').catch(err => {
console.error(' error-analysis API 오류:', err);
console.error(' error-analysis API 오류:', err);
return { data: {} };
})
]);
console.log('📊 개별 API 응답:');
console.log(' - stats:', statsRes);
console.log(' - worker-stats:', workerStatsRes);
console.log(' - project-stats:', projectStatsRes);
@@ -234,11 +225,6 @@ async function loadPeriodAnalysis() {
errorStats: errorAnalysisRes.data || errorAnalysisRes
};
console.log('📊 분석 데이터:', analysisData);
console.log('📊 요약 통계:', analysisData.summary);
console.log('👥 작업자 통계:', analysisData.workerStats);
console.log('📁 프로젝트 통계:', analysisData.projectStats);
console.log('⚠️ 오류 통계:', analysisData.errorStats);
// 결과 표시
displayPeriodAnalysis(analysisData);
@@ -284,13 +270,8 @@ function updateSummaryStats(summary) {
function displayWorkerAnalysis(workerStats) {
const grid = document.getElementById('workerAnalysisGrid');
console.log('👥 작업자 분석 데이터 확인:', workerStats);
console.log('👥 데이터 타입:', typeof workerStats);
console.log('👥 배열 여부:', Array.isArray(workerStats));
console.log('👥 길이:', workerStats ? workerStats.length : 'undefined');
if (!workerStats || (Array.isArray(workerStats) && workerStats.length === 0)) {
console.log('👥 빈 데이터로 인한 empty-state 표시');
grid.innerHTML = `
<div class="empty-state">
<div class="empty-icon">👥</div>
@@ -383,17 +364,11 @@ function displayWorkerAnalysis(workerStats) {
function displayProjectAnalysis(projectStats) {
const detailsContainer = document.getElementById('projectDetails');
console.log('📁 프로젝트 분석 데이터 확인:', projectStats);
console.log('📁 데이터 타입:', typeof projectStats);
console.log('📁 배열 여부:', Array.isArray(projectStats));
console.log('📁 길이:', projectStats ? projectStats.length : 'undefined');
if (projectStats && projectStats.length > 0) {
console.log('📁 첫 번째 프로젝트 데이터:', projectStats[0]);
}
if (!projectStats || projectStats.length === 0) {
console.log('📁 빈 데이터로 인한 empty-state 표시');
detailsContainer.innerHTML = `
<div class="empty-state">
<div class="empty-icon">📁</div>
@@ -412,7 +387,6 @@ function displayProjectAnalysis(projectStats) {
}, 0);
projectStats.forEach(project => {
console.log('📁 개별 프로젝트 처리:', project);
const projectName = project.project_name || project.name || project.projectName || '프로젝트';
const totalHours = project.totalHours || project.total_hours || project.hours || 0;
@@ -451,8 +425,6 @@ function updateProjectChart(projectStats) {
const labels = projectStats.map(p => p.project_name || p.name || p.projectName || '프로젝트');
const data = projectStats.map(p => p.totalHours || p.total_hours || p.hours || 0);
console.log('📊 차트 라벨:', labels);
console.log('📊 차트 데이터:', data);
const colors = [
'#3b82f6', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6',
'#06b6d4', '#84cc16', '#f97316', '#ec4899', '#6366f1'
@@ -487,15 +459,11 @@ function updateProjectChart(projectStats) {
// 오류 분석 표시
function displayErrorAnalysis(errorStats, allData) {
console.log('⚠️ 오류 분석 데이터 확인:', errorStats);
console.log('⚠️ 데이터 타입:', typeof errorStats);
console.log('⚠️ 배열 여부:', Array.isArray(errorStats));
// errorStats가 배열인 경우 첫 번째 요소 사용
let errorData = errorStats;
if (Array.isArray(errorStats) && errorStats.length > 0) {
errorData = errorStats[0];
console.log('⚠️ 배열에서 첫 번째 요소 사용:', errorData);
}
// 오류 요약 업데이트 - 실제 데이터 구조에 맞게 수정
@@ -506,7 +474,6 @@ function displayErrorAnalysis(errorStats, allData) {
const totalHours = allData && allData.summary ? allData.summary.totalHours : 0;
const normalHours = Math.max(0, totalHours - errorHours);
console.log('⚠️ 정규 시간:', normalHours, '오류 시간:', errorHours);
document.getElementById('normalHours').textContent = `${normalHours}h`;
document.getElementById('errorHours').textContent = `${errorHours}h`;
@@ -671,7 +638,6 @@ async function loadProjectAnalysis() {
showLoading(true);
try {
console.log('📁 프로젝트별 분석 데이터 로딩 시작');
// API 호출 파라미터 구성
const params = new URLSearchParams({
@@ -685,7 +651,6 @@ async function loadProjectAnalysis() {
const response = await apiCall(`/work-analysis/project-worktype-analysis?${params}`, 'GET');
const projectAnalysisData = response.data || response;
console.log('📁 프로젝트 분석 데이터:', projectAnalysisData);
// 결과 표시
displayProjectModeAnalysis(projectAnalysisData);