v2.5.0: guard web admin log loading race

This commit is contained in:
Виталий Литвинов
2026-04-24 22:44:47 +03:00
parent 3ab0f9d5c7
commit 9c74a0d00f
2 changed files with 10 additions and 3 deletions

View File

@@ -658,11 +658,18 @@ async function createBackup() {
async function loadLogs() { async function loadLogs() {
const service = $("#logService").value; const service = $("#logService").value;
const btn = $("#loadLogsBtn");
btn.disabled = true;
$("#logsBox").textContent = t("loading"); $("#logsBox").textContent = t("loading");
try { try {
$("#logsBox").textContent = await api(`/api/logs?service=${encodeURIComponent(service)}`); const logs = await api(`/api/logs?service=${encodeURIComponent(service)}`);
if ($("#logService").value === service) {
$("#logsBox").textContent = logs;
}
} catch (err) { } catch (err) {
$("#logsBox").textContent = err.message; $("#logsBox").textContent = err.message;
} finally {
btn.disabled = false;
} }
} }

View File

@@ -11,7 +11,7 @@
document.documentElement.dataset.theme = theme; document.documentElement.dataset.theme = theme;
}()); }());
</script> </script>
<link rel="stylesheet" href="/styles.css?v=2.5.0-admin2"> <link rel="stylesheet" href="/styles.css?v=2.5.0-admin3">
</head> </head>
<body> <body>
<div class="app-shell"> <div class="app-shell">
@@ -264,6 +264,6 @@
</div> </div>
<div id="toast" class="toast"></div> <div id="toast" class="toast"></div>
<script src="/app.js?v=2.5.0-admin2" type="module"></script> <script src="/app.js?v=2.5.0-admin3" type="module"></script>
</body> </body>
</html> </html>