fix: logging

This commit is contained in:
Andras Bacsai
2022-09-15 14:27:55 +02:00
parent e9e6449edf
commit f75af035bb
7 changed files with 47 additions and 9 deletions

View File

@@ -11,7 +11,7 @@
import Tooltip from '$lib/components/Tooltip.svelte';
import { day } from '$lib/dayjs';
import { selectedBuildId } from '$lib/store';
let logs: any = [];
let currentStatus: any;
let streamInterval: any;
@@ -43,11 +43,13 @@
status,
fromDb: from
} = await get(`/applications/${id}/logs/build/${$selectedBuildId}?sequence=${sequence}`);
currentStatus = status;
logs = logs.concat(
responseLogs.map((log: any) => ({ ...log, line: cleanAnsiCodes(log.line) }))
);
fromDb = from;
streamInterval = setInterval(async () => {
if (status !== 'running' && status !== 'queued') {
clearInterval(streamInterval);
@@ -60,7 +62,8 @@
);
status = data.status;
currentStatus = status;
fromDb = data.fromDb;
logs = logs.concat(
data.logs.map((log: any) => ({ ...log, line: cleanAnsiCodes(log.line) }))
);