Remove terminal log replay
This commit is contained in:
@@ -74,16 +74,16 @@ describe("ServerManagementTerminalDrawer", () => {
|
||||
|
||||
await emitSession("session-a");
|
||||
await emitStream(logStream("stdout-a", "session-a", "process.stdout"));
|
||||
await emitLog("stdout-a", "session-a", "process.stdout", logEntry(1, "generation A current replay"));
|
||||
await emitLog("stdout-a", "session-a", "process.stdout", logEntry(1, "generation A live output"));
|
||||
await emitReady();
|
||||
|
||||
expect(container?.textContent).toContain("generation A current replay");
|
||||
expect(container?.textContent).toContain("generation A live output");
|
||||
expect(container?.textContent).toContain("当前受管进程会话 · SSE 实时推送");
|
||||
|
||||
await emitSession("session-a");
|
||||
await emitLog("stdout-a", "session-a", "process.stdout", logEntry(1, "generation A current replay"));
|
||||
expect(container?.textContent).toContain("generation A current replay");
|
||||
expect(Array.from(container?.querySelectorAll(".terminal-text") ?? []).filter((node) => node.textContent === "generation A current replay")).toHaveLength(1);
|
||||
await emitLog("stdout-a", "session-a", "process.stdout", logEntry(1, "generation A live output"));
|
||||
expect(container?.textContent).toContain("generation A live output");
|
||||
expect(Array.from(container?.querySelectorAll(".terminal-text") ?? []).filter((node) => node.textContent === "generation A live output")).toHaveLength(1);
|
||||
expect(apiMocks.openServerLogEvents).toHaveBeenCalledTimes(1);
|
||||
expect(apiMocks.listLogStreams).not.toHaveBeenCalled();
|
||||
expect(apiMocks.dispatchSourceRCONCommand).not.toHaveBeenCalled();
|
||||
@@ -211,7 +211,7 @@ async function renderDrawer() {
|
||||
await act(async () => {
|
||||
root?.render(<ServerManagementTerminalDrawer open serverId="server-1" serverName="SCUM Alpha" pluginId="game.scum" canManage onClose={() => undefined} />);
|
||||
});
|
||||
expect(apiMocks.openServerLogEvents).toHaveBeenCalledWith("server-1", { historyLimit: 0 });
|
||||
expect(apiMocks.openServerLogEvents).toHaveBeenCalledWith("server-1");
|
||||
}
|
||||
|
||||
async function emitSession(logSessionId?: string, serverTime = "2026-08-14T00:00:00Z") {
|
||||
|
||||
@@ -16,7 +16,6 @@ type TerminalQuickCommand = { label: string; command: string; hint: string };
|
||||
|
||||
const terminalJobResultPollMs = 1000;
|
||||
const terminalJobResultPollAttempts = 30;
|
||||
const terminalLiveReplayWindow = 0;
|
||||
const terminalHistoryWindow = 500;
|
||||
const maxTerminalLines = 10000;
|
||||
const terminalQuickCommandCatalog: Record<string, TerminalQuickCommand[]> = {
|
||||
@@ -158,7 +157,7 @@ export function ServerManagementTerminalDrawer({ open, serverId, serverName, plu
|
||||
useEffect(() => {
|
||||
if (!open) return undefined;
|
||||
let ready = false;
|
||||
const events = platformApiClient.openServerLogEvents(serverId, { historyLimit: terminalLiveReplayWindow });
|
||||
const events = platformApiClient.openServerLogEvents(serverId);
|
||||
events.addEventListener("session", (event) => {
|
||||
const session = parseLogSessionEvent(event);
|
||||
if (!session) return;
|
||||
|
||||
Reference in New Issue
Block a user