fix(logs): add immediate loading state clearing and append timestamps to database log tails

This commit is contained in:
2026-06-14 15:03:20 -07:00
parent 26b4c53633
commit 7f170c8079
2 changed files with 3 additions and 1 deletions

View File

@@ -81,6 +81,7 @@ export default function LogsPage() {
name: string; name: string;
}) => { }) => {
setLogsLoading(true); setLogsLoading(true);
setLogs(null); // Clear previous logs immediately so user sees it loading
try { try {
let action = "apps.logs"; let action = "apps.logs";
let payloadParams: Record<string, any> = { uuid: item.id, lines: 100 }; let payloadParams: Record<string, any> = { uuid: item.id, lines: 100 };

View File

@@ -5294,7 +5294,8 @@ async function toolDatabasesLogs(
const lines = Number.isFinite(linesRaw) ? linesRaw : 200; const lines = Number.isFinite(linesRaw) ? linesRaw : 200;
try { try {
const cmd = `cid=$(docker ps -a --filter name=${uuid} --format '{{.Names}}' | head -1); if [ -z "$cid" ]; then echo "NO_CONTAINER"; exit 0; fi; docker logs --tail ${lines} "$cid" 2>&1`; // We add --timestamps (or -t) to get timestamps at the start of each row
const cmd = `cid=$(docker ps -a --filter name=${uuid} --format '{{.Names}}' | head -1); if [ -z "$cid" ]; then echo "NO_CONTAINER"; exit 0; fi; docker logs --timestamps --tail ${lines} "$cid" 2>&1`;
const res = await runOnCoolifyHost(cmd, { timeoutMs: 15_000 }); const res = await runOnCoolifyHost(cmd, { timeoutMs: 15_000 });
if (res.code !== 0) { if (res.code !== 0) {