refactor: move buildable .NET source into src/, update CI/doc paths
TaxBaik CI/CD / build-and-deploy (push) Successful in 2m7s
TaxBaik CI/CD / build-and-deploy (push) Successful in 2m7s
Groups the repo root into src (buildable source), docs (already existed), and everything else (db/, scripts/, tests/, deploy/ - deployment/ops/test assets that aren't compiled, already organized as their own folders). CI now only needs src/ to build: dotnet restore/build/test/publish all point at src/TaxBaik.sln, src/TaxBaik.Web/, src/TaxBaik.Proxy/. - git mv every project (Domain, Infrastructure, Application, Application.Tests, Web, Web.Client, Proxy) and TaxBaik.sln into src/ as a unit, so relative ProjectReference/.sln paths stay valid unchanged. - .gitea/workflows/deploy.yml: 6 dotnet restore/clean/build/test/publish invocations now point at src/. db/migrations and scripts/ stay at root (deploy_gb.sh and browser-e2e.yml only touch published output and the deployed URL, not source paths - verified, no changes needed there). - scripts/validate_admin_render.sh: admin render-mode file paths now src/TaxBaik.Web.Client/... - scripts/validate_kst_timestamps.sh: dropped deploy.sh from its target list - that script was removed in the prior cleanup commit (dead, no CI workflow referenced it) but this validator still expected it to exist. - CLAUDE.md, docs/ENGINEERING_HARNESS.md, docs/ADMIN_PATTERN_CRITIQUE_WBS.md: updated project-structure diagram, dotnet run/build commands, and grep targets to the new src/ paths (also fixed a pre-existing stale path in ADMIN_PATTERN_CRITIQUE_WBS.md that still said TaxBaik.Web/Components/Admin from before that ever moved to TaxBaik.Web.Client). - Added a Repo Root harness rule + Architecture Guardrail entries: new files belong under src/docs/tests/scripts/db/deploy, not loose at root; temp work stays outside the repo (or under a gitignored .scratch/) and is never committed. Verified locally: dotnet build/test src/TaxBaik.sln (26/26 tests), and all three scripts/validate_*.sh pass against the new layout. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,395 +0,0 @@
|
||||
window.taxbaikAdminSession = {
|
||||
clientLogState: {
|
||||
enabled: true,
|
||||
windowStart: 0,
|
||||
sentCount: 0,
|
||||
suppressedCount: 0,
|
||||
fingerprints: {},
|
||||
eventCounts: {},
|
||||
screen: '',
|
||||
feature: '',
|
||||
action: '',
|
||||
step: '',
|
||||
entity: '',
|
||||
entityId: '',
|
||||
dataKey: ''
|
||||
},
|
||||
|
||||
initErrorLogging: function () {
|
||||
if (window._taxbaikClientLogInitialized) return;
|
||||
window._taxbaikClientLogInitialized = true;
|
||||
|
||||
const postLog = function (payload) {
|
||||
try {
|
||||
if (!window.taxbaikAdminSession.shouldSendClientLog(payload)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const body = JSON.stringify(payload);
|
||||
if (navigator.sendBeacon) {
|
||||
const blob = new Blob([body], { type: 'application/json' });
|
||||
if (navigator.sendBeacon('/taxbaik/api/client-logs', blob)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fetch('/taxbaik/api/client-logs', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body,
|
||||
keepalive: true
|
||||
}).catch(function () { });
|
||||
} catch {
|
||||
// Logging must never break the UI.
|
||||
}
|
||||
};
|
||||
|
||||
window.taxbaikAdminSession.postClientLog = postLog;
|
||||
|
||||
window.addEventListener('error', function (event) {
|
||||
postLog({
|
||||
level: 'error',
|
||||
source: 'window.error',
|
||||
message: event.message || 'unknown error',
|
||||
url: event.filename || window.location.href,
|
||||
route: window.location.pathname + window.location.search,
|
||||
screen: window.taxbaikAdminSession.clientLogState.screen || '',
|
||||
feature: window.taxbaikAdminSession.clientLogState.feature || '',
|
||||
action: window.taxbaikAdminSession.clientLogState.action || '',
|
||||
step: window.taxbaikAdminSession.clientLogState.step || '',
|
||||
entity: window.taxbaikAdminSession.clientLogState.entity || '',
|
||||
entityId: window.taxbaikAdminSession.clientLogState.entityId || '',
|
||||
dataKey: window.taxbaikAdminSession.clientLogState.dataKey || '',
|
||||
buildVersion: window.taxbaikAdminBuildVersion || '',
|
||||
component: window.taxbaikAdminComponent || '',
|
||||
viewportWidth: window.taxbaikAdminSession.getViewportWidth(),
|
||||
userAgent: navigator.userAgent || '',
|
||||
stack: event.error?.stack || ''
|
||||
});
|
||||
});
|
||||
|
||||
window.addEventListener('unhandledrejection', function (event) {
|
||||
const reason = event.reason;
|
||||
postLog({
|
||||
level: 'error',
|
||||
source: 'window.unhandledrejection',
|
||||
message: reason?.message || String(reason || 'unknown rejection'),
|
||||
url: window.location.href,
|
||||
route: window.location.pathname + window.location.search,
|
||||
screen: window.taxbaikAdminSession.clientLogState.screen || '',
|
||||
feature: window.taxbaikAdminSession.clientLogState.feature || '',
|
||||
action: window.taxbaikAdminSession.clientLogState.action || '',
|
||||
step: window.taxbaikAdminSession.clientLogState.step || '',
|
||||
entity: window.taxbaikAdminSession.clientLogState.entity || '',
|
||||
entityId: window.taxbaikAdminSession.clientLogState.entityId || '',
|
||||
dataKey: window.taxbaikAdminSession.clientLogState.dataKey || '',
|
||||
buildVersion: window.taxbaikAdminBuildVersion || '',
|
||||
component: window.taxbaikAdminComponent || '',
|
||||
viewportWidth: window.taxbaikAdminSession.getViewportWidth(),
|
||||
userAgent: navigator.userAgent || '',
|
||||
stack: reason?.stack || ''
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
setContext: function (screen, feature, action, step, entity, entityId, dataKey) {
|
||||
const state = window.taxbaikAdminSession.clientLogState;
|
||||
state.screen = screen || '';
|
||||
state.feature = feature || '';
|
||||
state.action = action || '';
|
||||
state.step = step || '';
|
||||
state.entity = entity || '';
|
||||
state.entityId = entityId || '';
|
||||
state.dataKey = dataKey || '';
|
||||
},
|
||||
|
||||
shouldSendClientLog: function (payload) {
|
||||
try {
|
||||
const state = window.taxbaikAdminSession.clientLogState;
|
||||
if (!state.enabled) return false;
|
||||
|
||||
const now = Date.now();
|
||||
if (!state.windowStart || now - state.windowStart >= 60000) {
|
||||
state.windowStart = now;
|
||||
state.sentCount = 0;
|
||||
state.suppressedCount = 0;
|
||||
state.fingerprints = {};
|
||||
}
|
||||
|
||||
const fingerprint = [
|
||||
payload?.source || '',
|
||||
payload?.message || '',
|
||||
payload?.route || '',
|
||||
payload?.component || '',
|
||||
payload?.screen || '',
|
||||
payload?.feature || '',
|
||||
payload?.action || '',
|
||||
payload?.entity || '',
|
||||
payload?.entityId || ''
|
||||
].join('|').slice(0, 256);
|
||||
|
||||
state.fingerprints[fingerprint] = (state.fingerprints[fingerprint] || 0) + 1;
|
||||
|
||||
if (state.sentCount >= 8) {
|
||||
state.suppressedCount += 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (state.fingerprints[fingerprint] > 2) {
|
||||
state.suppressedCount += 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
state.sentCount += 1;
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
traceUiState: function (source, details) {
|
||||
try {
|
||||
const payload = {
|
||||
level: 'info',
|
||||
source: source || 'ui-state',
|
||||
message: details || '',
|
||||
url: window.location.href,
|
||||
route: window.location.pathname + window.location.search,
|
||||
screen: window.taxbaikAdminSession.clientLogState.screen || '',
|
||||
feature: window.taxbaikAdminSession.clientLogState.feature || '',
|
||||
action: window.taxbaikAdminSession.clientLogState.action || '',
|
||||
step: window.taxbaikAdminSession.clientLogState.step || '',
|
||||
entity: window.taxbaikAdminSession.clientLogState.entity || '',
|
||||
entityId: window.taxbaikAdminSession.clientLogState.entityId || '',
|
||||
dataKey: window.taxbaikAdminSession.clientLogState.dataKey || '',
|
||||
buildVersion: window.taxbaikAdminBuildVersion || '',
|
||||
component: window.taxbaikAdminComponent || '',
|
||||
viewportWidth: window.taxbaikAdminSession.getViewportWidth(),
|
||||
userAgent: navigator.userAgent || '',
|
||||
stack: ''
|
||||
};
|
||||
|
||||
const state = window.taxbaikAdminSession.clientLogState;
|
||||
const key = `${payload.source}|${payload.route}|${payload.message}`.slice(0, 256);
|
||||
state.eventCounts[key] = (state.eventCounts[key] || 0) + 1;
|
||||
if (state.eventCounts[key] > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.taxbaikAdminSession.postClientLog(payload);
|
||||
} catch {
|
||||
// diagnostics must never break UI.
|
||||
}
|
||||
},
|
||||
|
||||
postClientLog: function () {
|
||||
// Replaced during initialization.
|
||||
},
|
||||
|
||||
syncRouteClass: function () {
|
||||
document.documentElement.classList.toggle(
|
||||
'admin-login-route',
|
||||
window.location.pathname.toLowerCase().endsWith('/admin/login'));
|
||||
},
|
||||
|
||||
getViewportWidth: function () {
|
||||
return window.innerWidth || document.documentElement.clientWidth || 0;
|
||||
},
|
||||
|
||||
clearAuthToken: function () {
|
||||
try {
|
||||
localStorage.removeItem('accessToken');
|
||||
localStorage.removeItem('refreshToken');
|
||||
localStorage.removeItem('tokenExpiry');
|
||||
localStorage.removeItem('auth_token');
|
||||
} catch {
|
||||
// Ignore storage errors; redirect still recovers the session.
|
||||
}
|
||||
},
|
||||
|
||||
showLoading: function () {
|
||||
// Route transitions are handled by Blazor; avoid full-screen overlays
|
||||
// that block drawer interaction and make the app feel frozen.
|
||||
window.taxbaikAdminSession.traceUiState('admin-loading', 'showLoading requested');
|
||||
window.taxbaikAdminSession.hideLoading();
|
||||
},
|
||||
|
||||
hideLoading: function () {
|
||||
const overlay = document.getElementById('blazor-loading');
|
||||
if (overlay) {
|
||||
overlay.classList.remove('show');
|
||||
}
|
||||
|
||||
if (window._taxbaikLoadingTimeout) {
|
||||
clearTimeout(window._taxbaikLoadingTimeout);
|
||||
window._taxbaikLoadingTimeout = null;
|
||||
}
|
||||
|
||||
if (window._taxbaikLoadingObserver) {
|
||||
window._taxbaikLoadingObserver.disconnect();
|
||||
window._taxbaikLoadingObserver = null;
|
||||
}
|
||||
|
||||
window.taxbaikAdminSession.traceUiState('admin-loading', 'hideLoading completed');
|
||||
},
|
||||
|
||||
watchReconnect: function () {
|
||||
window.taxbaikAdminSession.syncRouteClass();
|
||||
window.addEventListener('popstate', window.taxbaikAdminSession.syncRouteClass);
|
||||
window.addEventListener('hashchange', window.taxbaikAdminSession.syncRouteClass);
|
||||
|
||||
if (document.documentElement.classList.contains('admin-login-route')) {
|
||||
// Login prerenders immediately; no boot splash needed.
|
||||
window.taxbaikAdminSession.hideLoading();
|
||||
}
|
||||
// Non-login routes: leave the overlay showing until AdminShell's
|
||||
// OnAfterRenderAsync(firstRender) calls hideLoading once WASM has
|
||||
// actually rendered the authenticated shell.
|
||||
|
||||
const modal = document.getElementById('components-reconnect-modal');
|
||||
if (!modal) return;
|
||||
|
||||
const reloadOnRejectedCircuit = function () {
|
||||
const className = modal.className || '';
|
||||
if (className.includes('components-reconnect-failed') ||
|
||||
className.includes('components-reconnect-rejected')) {
|
||||
window.setTimeout(function () { window.location.reload(); }, 1500);
|
||||
}
|
||||
};
|
||||
|
||||
new MutationObserver(reloadOnRejectedCircuit)
|
||||
.observe(modal, { attributes: true, attributeFilter: ['class'] });
|
||||
},
|
||||
|
||||
bindLoginForm: function () {
|
||||
const form = document.getElementById('admin-login-form');
|
||||
if (!form) return;
|
||||
|
||||
// 업데이트 스플래시: 매번(재호출되어도) 무조건 다시 적용한다. Blazor가 WASM
|
||||
// 하이드레이션 시점에 이 prerender된 서브트리를 자신의 렌더 결과로 다시 그리면
|
||||
// 마크업에 정적으로 박혀 있던 disabled가 되살아날 수 있으므로, "한 번만 실행"
|
||||
// 가드에 걸어두면 두 번째 호출(OnAfterRenderAsync 경유)이 조용히 무시되어
|
||||
// 버튼이 영원히 비활성 상태로 남는다. 그래서 이 부분은 가드 밖에 둔다.
|
||||
const readyButton = form.querySelector('#admin-login-submit');
|
||||
if (readyButton) {
|
||||
readyButton.disabled = false;
|
||||
const label = readyButton.querySelector('span');
|
||||
if (label) label.textContent = '로그인';
|
||||
}
|
||||
|
||||
if (form.dataset.bound === '1') return;
|
||||
form.dataset.bound = '1';
|
||||
window.taxbaikAdminSession.traceUiState('admin-login', 'bindLoginForm attached');
|
||||
|
||||
form.addEventListener('submit', async function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
const username = form.querySelector('input[placeholder="사용자명"]')?.value?.trim() || '';
|
||||
const password = form.querySelector('input[placeholder="비밀번호"]')?.value || '';
|
||||
const rememberMe = form.querySelector('input[type="checkbox"]')?.checked || false;
|
||||
const existing = form.parentElement.querySelector('.login-error-message');
|
||||
const submitButton = form.querySelector('button[type="submit"]');
|
||||
|
||||
if (existing) existing.remove();
|
||||
if (submitButton) submitButton.disabled = true;
|
||||
|
||||
try {
|
||||
if (!username || !password) {
|
||||
throw new Error('username/password missing');
|
||||
}
|
||||
|
||||
window.taxbaikAdminSession.traceUiState('admin-login', 'submit started');
|
||||
const response = await fetch('/taxbaik/api/auth/login', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ username, password })
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('login failed');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
if (!data?.accessToken || !data?.refreshToken) {
|
||||
throw new Error('invalid response');
|
||||
}
|
||||
|
||||
window.taxbaikAdminSession.traceUiState('admin-login', 'submit success');
|
||||
const expiryTicks = 621355968000000000 + ((Date.now() + (data.expiresIn || 3600) * 1000) * 10000);
|
||||
localStorage.setItem('accessToken', data.accessToken);
|
||||
localStorage.setItem('refreshToken', data.refreshToken);
|
||||
localStorage.setItem('tokenExpiry', String(expiryTicks));
|
||||
|
||||
if (rememberMe) {
|
||||
localStorage.setItem('admin-remembered-username', username);
|
||||
} else {
|
||||
localStorage.removeItem('admin-remembered-username');
|
||||
}
|
||||
|
||||
window.location.href = '/taxbaik/admin/dashboard';
|
||||
} catch (error) {
|
||||
window.taxbaikAdminSession.traceUiState('admin-login', `submit failed: ${error?.message || 'login failed'}`);
|
||||
postLog({
|
||||
level: 'error',
|
||||
source: 'admin-login-form',
|
||||
message: error?.message || 'login failed',
|
||||
url: window.location.href,
|
||||
route: window.location.pathname + window.location.search,
|
||||
buildVersion: window.taxbaikAdminBuildVersion || '',
|
||||
component: 'AdminLoginForm',
|
||||
viewportWidth: window.taxbaikAdminSession.getViewportWidth(),
|
||||
userAgent: navigator.userAgent || '',
|
||||
stack: error?.stack || ''
|
||||
});
|
||||
const errorMessage = document.createElement('div');
|
||||
errorMessage.className = 'mud-alert mud-alert-filled-error login-error-message mb-4';
|
||||
errorMessage.textContent = '로그인 중 오류가 발생했습니다.';
|
||||
form.parentElement.insertBefore(errorMessage, form);
|
||||
} finally {
|
||||
if (submitButton) submitButton.disabled = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 더존 ERP 스타일 엔터 키 포커스 이동 및 단축키 바인딩
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Enter') {
|
||||
const active = document.activeElement;
|
||||
if (!active) return;
|
||||
|
||||
// 특정 영역(편집 폼 또는 다이얼로그) 내의 입력 필드만 포커스 이동 처리
|
||||
const container = active.closest('.admin-editor-panel, .mud-form, .mud-dialog');
|
||||
if (!container) return;
|
||||
|
||||
// textarea나 button, submit 타입 등은 기본 동작(줄바꿈/제출) 유지
|
||||
if (active.tagName === 'TEXTAREA' ||
|
||||
active.tagName === 'BUTTON' ||
|
||||
active.getAttribute('type') === 'submit' ||
|
||||
active.classList.contains('mud-button-root')) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
// 포커스 이동 가능한 모든 입력 요소 수집
|
||||
const focusables = Array.from(container.querySelectorAll('input, select, textarea, button'))
|
||||
.filter(el => {
|
||||
const style = window.getComputedStyle(el);
|
||||
return el.tabIndex >= 0 &&
|
||||
!el.disabled &&
|
||||
el.getAttribute('aria-disabled') !== 'true' &&
|
||||
style.display !== 'none' &&
|
||||
style.visibility !== 'hidden';
|
||||
});
|
||||
|
||||
const index = focusables.indexOf(active);
|
||||
if (index > -1 && index < focusables.length - 1) {
|
||||
const nextEl = focusables[index + 1];
|
||||
nextEl.focus();
|
||||
if (typeof nextEl.select === 'function') {
|
||||
nextEl.select();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user