differentiate between db logs and not
This commit is contained in:
parent
83508f165d
commit
1f232d96d8
@ -1206,6 +1206,7 @@ export async function getBuildIdLogs(request: FastifyRequest<GetBuildIdLogs>) {
|
|||||||
log.time = Number(log.time)
|
log.time = Number(log.time)
|
||||||
return log
|
return log
|
||||||
}),
|
}),
|
||||||
|
fromDb: true,
|
||||||
took: day().diff(createdAt) / 1000,
|
took: day().diff(createdAt) / 1000,
|
||||||
status: data?.status || 'queued'
|
status: data?.status || 'queued'
|
||||||
}
|
}
|
||||||
@ -1221,6 +1222,7 @@ export async function getBuildIdLogs(request: FastifyRequest<GetBuildIdLogs>) {
|
|||||||
}).filter(log => log.time > sequence)
|
}).filter(log => log.time > sequence)
|
||||||
return {
|
return {
|
||||||
logs,
|
logs,
|
||||||
|
fromDb: false,
|
||||||
took: day().diff(createdAt) / 1000,
|
took: day().diff(createdAt) / 1000,
|
||||||
status: data?.status || 'queued'
|
status: data?.status || 'queued'
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
let followingBuild: any;
|
let followingBuild: any;
|
||||||
let followingInterval: any;
|
let followingInterval: any;
|
||||||
let logsEl: any;
|
let logsEl: any;
|
||||||
|
let fromDb = false;
|
||||||
let cancelInprogress = false;
|
let cancelInprogress = false;
|
||||||
|
|
||||||
const { id } = $page.params;
|
const { id } = $page.params;
|
||||||
@ -38,13 +38,16 @@
|
|||||||
}
|
}
|
||||||
async function streamLogs(sequence = 0) {
|
async function streamLogs(sequence = 0) {
|
||||||
try {
|
try {
|
||||||
let { logs: responseLogs, status } = await get(
|
let {
|
||||||
`/applications/${id}/logs/build/${buildId}?sequence=${sequence}`
|
logs: responseLogs,
|
||||||
);
|
status,
|
||||||
|
fromDb: from
|
||||||
|
} = await get(`/applications/${id}/logs/build/${buildId}?sequence=${sequence}`);
|
||||||
currentStatus = status;
|
currentStatus = status;
|
||||||
logs = logs.concat(
|
logs = logs.concat(
|
||||||
responseLogs.map((log: any) => ({ ...log, line: cleanAnsiCodes(log.line) }))
|
responseLogs.map((log: any) => ({ ...log, line: cleanAnsiCodes(log.line) }))
|
||||||
);
|
);
|
||||||
|
fromDb = from;
|
||||||
streamInterval = setInterval(async () => {
|
streamInterval = setInterval(async () => {
|
||||||
if (status !== 'running' && status !== 'queued') {
|
if (status !== 'running' && status !== 'queued') {
|
||||||
clearInterval(streamInterval);
|
clearInterval(streamInterval);
|
||||||
@ -159,7 +162,11 @@
|
|||||||
bind:this={logsEl}
|
bind:this={logsEl}
|
||||||
>
|
>
|
||||||
{#each logs as log}
|
{#each logs as log}
|
||||||
<div>[{day.unix(log.time).format('HH:mm:ss.SSS')}] {log.line + '\n'}</div>
|
{#if fromDb}
|
||||||
|
<div>[{day.unix(log.time).format('HH:mm:ss.SSS')}] {log.line + '\n'}</div>
|
||||||
|
{:else}
|
||||||
|
<div>{log.line + '\n'}</div>
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user