fix log whitespace non preservation issue

This commit is contained in:
beckerinj
2023-05-13 02:14:14 -04:00
parent c889c2cc03
commit 9acd45aa93
3 changed files with 7 additions and 4 deletions

View File

@@ -57,15 +57,18 @@ const Log: Component<{
}, 1500);
}
});
/// the return of this closure is used as the innerHTML of the <pre /> element
/// need to make sure this can't be used to inject some script into the page
const log = () => {
if (deployment()?.state === DockerContainerState.NotDeployed) {
return "not deployed";
} else {
const log = p.error ? p.log?.stderr : p.log?.stdout;
// const sanitized = log ?
// const sanitized = log && santize(log);
return log ? convert.toHtml(log) : `no${p.error ? " error" : ""} log`;
}
};
createEffect(() => console.log(log()));
const buffer = useBuffer(scrolled, 250);
const [poll, togglePoll] = useLocalStorageToggle(
"deployment-log-polling",

View File

@@ -10,9 +10,6 @@
}
.Log {
white-space: pre-line;
overflow-wrap: anywhere;
tab-size: 2;
padding: 1rem;
margin-bottom: 40vh;
}

View File

@@ -26,6 +26,9 @@ code {
pre {
margin: 0;
white-space: pre-wrap;
overflow-wrap: anywhere;
tab-size: 2;
}
h1 {