관리자 설정 로딩과 부트 진단 복구

This commit is contained in:
Yun Chan 2026-09-22 23:06:54 +09:00
parent d58eb67764
commit fb640a75ac
7 changed files with 767 additions and 100 deletions

View file

@ -127,6 +127,13 @@
);
return nodes.filter(isVisiblyRendered).length;
}
function hasVisibleBootLoading(root) {
if (!root) return false;
var nodes = Array.prototype.slice.call(
root.querySelectorAll("[data-vignette-boot-loading]"),
);
return nodes.some(isVisiblyRendered);
}
function appHealth() {
var root = document.getElementById("root");
var path = window.location.pathname;
@ -138,7 +145,13 @@
"[data-vignette-admin-root],[data-vignette-admin-diagnostic],[data-testid='admin-ai-page']",
)
: null;
var hasAdminContent = !isAdmin || isVisiblyRendered(adminContent);
var adminRecovery = root
? root.querySelector(
".vg-route-error[data-testid='auth-restore-retrying'],.vg-route-error[data-testid='auth-restore-failed']",
)
: null;
var hasAdminContent =
!isAdmin || isVisiblyRendered(adminContent) || isVisiblyRendered(adminRecovery);
return {
healthy: Boolean(
root &&
@ -148,13 +161,26 @@
hasAdminContent,
),
visible: visible,
bootLoading: hasVisibleBootLoading(root),
};
}
function dismissDiagnosticIfHealthy() {
if (!appHealth().healthy) return false;
var panel = document.getElementById("vignette-boot-diagnostic");
if (panel) panel.remove();
return true;
var health = appHealth();
if (health.healthy) {
if (panel) panel.remove();
return true;
}
if (
panel &&
panel.getAttribute("data-vignette-boot-reason") === "watchdog" &&
health.bootLoading &&
Date.now() - loadedAt < 20000
) {
panel.remove();
return true;
}
return false;
}
function scheduleHealthyCheck() {
if (healthyCheckTimer !== null) window.clearTimeout(healthyCheckTimer);
@ -241,6 +267,13 @@
var path = window.location.pathname;
var text = (document.body && document.body.innerText ? document.body.innerText : "").trim();
var health = appHealth();
if (
reason === "watchdog" &&
health.bootLoading &&
Date.now() - loadedAt < 20000
) {
return;
}
if (health.healthy && reason !== "manual") {
if (reason !== "watchdog") {
sendDiagnostic(reason, text.length, health.visible);
@ -265,12 +298,22 @@
"position:fixed;z-index:2147483647;inset:24px auto auto 24px;max-width:min(760px,calc(100vw - 48px));padding:18px;border:1px solid #d59b47;border-radius:8px;background:#fffaf0;color:#21312e;box-shadow:0 18px 48px rgba(10,20,18,.18);font:13px/1.5 system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;white-space:normal;";
document.body.appendChild(panel);
}
var currentReason = panel.getAttribute("data-vignette-boot-reason");
var effectiveReason = reason;
if (
reason !== "watchdog" ||
(currentReason !== "runtime-error" && currentReason !== "manual")
) {
panel.setAttribute("data-vignette-boot-reason", reason);
} else {
effectiveReason = currentReason;
}
var lines = [
"<b style=\"display:block;font-size:18px;margin-bottom:6px\">Vignette 화면 진단</b>",
"<div>React 화면이 정상 콘텐츠를 표시하지 못해서 HTML 부트스트랩 진단을 띄웠습니다.</div>",
"<dl style=\"display:grid;grid-template-columns:132px minmax(0,1fr);gap:0;margin:12px 0 0;border:1px solid rgba(0,0,0,.12);border-radius:8px;overflow:hidden\">",
"<dt style=\"padding:7px 9px;background:rgba(0,0,0,.04);font-weight:700\">reason</dt><dd style=\"margin:0;padding:7px 9px;overflow-wrap:anywhere\">" +
reason +
effectiveReason +
"</dd>",
"<dt style=\"padding:7px 9px;background:rgba(0,0,0,.04);font-weight:700\">path</dt><dd style=\"margin:0;padding:7px 9px;overflow-wrap:anywhere\">" +
path +
@ -320,6 +363,9 @@
window.setTimeout(function () {
render("watchdog");
}, 8000);
window.setTimeout(function () {
render("watchdog");
}, 20000);
})();
</script>
</head>