fix(logs): add immediate loading state clearing and append timestamps to database log tails
This commit is contained in:
@@ -81,6 +81,7 @@ export default function LogsPage() {
|
||||
name: string;
|
||||
}) => {
|
||||
setLogsLoading(true);
|
||||
setLogs(null); // Clear previous logs immediately so user sees it loading
|
||||
try {
|
||||
let action = "apps.logs";
|
||||
let payloadParams: Record<string, any> = { uuid: item.id, lines: 100 };
|
||||
|
||||
@@ -5294,7 +5294,8 @@ async function toolDatabasesLogs(
|
||||
const lines = Number.isFinite(linesRaw) ? linesRaw : 200;
|
||||
|
||||
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 });
|
||||
|
||||
if (res.code !== 0) {
|
||||
|
||||
Reference in New Issue
Block a user