From 8feccfeb234b69b1069d6b972f13b77ee2c0459f Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sat, 15 Oct 2022 20:23:20 +0200 Subject: show player logs on view match page --- web/pw-server/src/lib/components/PlayerLog.svelte | 152 ++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 web/pw-server/src/lib/components/PlayerLog.svelte (limited to 'web/pw-server/src/lib/components/PlayerLog.svelte') diff --git a/web/pw-server/src/lib/components/PlayerLog.svelte b/web/pw-server/src/lib/components/PlayerLog.svelte new file mode 100644 index 0000000..52cae8e --- /dev/null +++ b/web/pw-server/src/lib/components/PlayerLog.svelte @@ -0,0 +1,152 @@ + + +
+ {#if showRawStderr} +
+ {playerLog.flatMap((turn) => turn.stderr).join("\n")} +
+ {:else} +
+ {#each playerLog as logTurn, i} +
+
+ Turn {i} + {#if logTurn.action?.type === "dispatches"} + {pluralize(logTurn.action.dispatches.length, "dispatch")} + {:else if logTurn.action?.type === "timeout"} + timeout + {:else if logTurn.action?.type === "bad_command"} + invalid command + {/if} +
+ {#if logTurn.action?.type === "dispatches"} +
+ {#each logTurn.action.dispatches as dispatch} +
+
+ {pluralize(dispatch.ship_count, "ship")} from {dispatch.origin} to {dispatch.destination} +
+ {#if dispatch.error} + {dispatch.error} + {/if} +
+ {/each} +
+ {:else if logTurn.action?.type === "bad_command"} +
+
{logTurn.action.command}
+
Parse error: {logTurn.action.error}
+
+ {/if} + {#if logTurn.stderr.length > 0} +
stderr
+
+ {#each logTurn.stderr as stdErrMsg} +
{stdErrMsg}
+ {/each} +
+ {/if} +
+ {/each} +
+ {/if} +
+ + -- cgit v1.2.3