Skip to content

Commit

Permalink
actually set the active container on click
Browse files Browse the repository at this point in the history
  • Loading branch information
fredclausen committed Aug 13, 2023
1 parent 89d0c31 commit 35f303b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,19 @@ $((): void => {
});

socket.on("new_log", (data: any) => {
// console.log("New Log Message: ", data);
// add the log message to the container
if (!containers[data.name]) {
console.error("Container not found: ", data.name);
return;
}
containers[data.name].logs.push(data.log);

while (containers[data.name].logs.length > 100) {
containers[data.name].logs.shift();
}

// if the container is active, add the log to the page

if (active_container == data.name) {
$("#container-logs").append(generate_log_element(data.log));
}
Expand All @@ -83,7 +87,7 @@ function show_logs(name: any) {
$(this).removeClass("selected");
}
});

active_container = name;
let logs = containers[name].logs;

// add the logs to the page
Expand Down

0 comments on commit 35f303b

Please sign in to comment.