mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-18 20:59:24 +00:00
fix: application logs duplicate
This commit is contained in:
@@ -51,16 +51,22 @@
|
|||||||
async function loadLogs() {
|
async function loadLogs() {
|
||||||
if (logsLoading) return;
|
if (logsLoading) return;
|
||||||
try {
|
try {
|
||||||
const newLogs: any = await get(
|
const since = lastLog?.split(' ')[0] || 0;
|
||||||
`/applications/${id}/logs/${selectedService}?since=${lastLog?.split(' ')[0] || 0}`
|
const newLogs: any = await get(`/applications/${id}/logs/${selectedService}?since=${since}`);
|
||||||
);
|
|
||||||
if (newLogs.noContainer) {
|
if (newLogs.noContainer) {
|
||||||
noContainer = true;
|
noContainer = true;
|
||||||
} else {
|
} else {
|
||||||
noContainer = false;
|
noContainer = false;
|
||||||
}
|
}
|
||||||
if (newLogs?.logs && newLogs.logs[newLogs.logs.length - 1] !== logs[logs.length - 1]) {
|
if (newLogs?.logs && newLogs.logs[newLogs.logs.length - 1] !== logs[logs.length - 1]) {
|
||||||
|
if (since === 0) {
|
||||||
logs = logs.concat(newLogs.logs);
|
logs = logs.concat(newLogs.logs);
|
||||||
|
} else {
|
||||||
|
const newParsedLogs = newLogs.logs.filter((log: any) => {
|
||||||
|
return log !== logs[logs.length - 1];
|
||||||
|
});
|
||||||
|
logs = logs.concat(newParsedLogs);
|
||||||
|
}
|
||||||
lastLog = newLogs.logs[newLogs.logs.length - 1];
|
lastLog = newLogs.logs[newLogs.logs.length - 1];
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -135,7 +141,7 @@
|
|||||||
{:else}
|
{:else}
|
||||||
<div class="relative w-full">
|
<div class="relative w-full">
|
||||||
<div class="flex justify-start sticky space-x-2 pb-2">
|
<div class="flex justify-start sticky space-x-2 pb-2">
|
||||||
<button on:click={followBuild} class="btn btn-sm " class:bg-coollabs={followingLogs}>
|
<button on:click={followBuild} class="btn btn-sm" class:bg-coollabs={followingLogs}>
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
class="w-6 h-6 mr-2"
|
class="w-6 h-6 mr-2"
|
||||||
|
|||||||
Reference in New Issue
Block a user