From 8e9b7682b61c7bbfa9f3166559020900b9ce74ad Mon Sep 17 00:00:00 2001 From: Hamcha Date: Sun, 19 Nov 2023 15:33:09 +0100 Subject: [PATCH] fullwidth --- src/route/container.rs | 2 ++ templates/base.html | 19 +++++++++++++++---- templates/container/get-one.html | 16 ++++++++++++---- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/route/container.rs b/src/route/container.rs index 6662922..ddf1bfe 100644 --- a/src/route/container.rs +++ b/src/route/container.rs @@ -68,6 +68,7 @@ async fn get_log_string(container_name: String, state: AppState) -> impl IntoRes follow: false, stdout: true, stderr: true, + timestamps: true, ..Default::default() }), ) @@ -89,6 +90,7 @@ async fn get_log_stream(container_name: String, state: AppState) -> impl IntoRes follow: true, stdout: true, stderr: true, + timestamps: true, ..Default::default() }), ) diff --git a/templates/base.html b/templates/base.html index ba7ae68..0c47de8 100644 --- a/templates/base.html +++ b/templates/base.html @@ -7,6 +7,7 @@ {% block title %}{{ title }} - staxman{% endblock %} + diff --git a/templates/container/get-one.html b/templates/container/get-one.html index 132ccfb..508581a 100644 --- a/templates/container/get-one.html +++ b/templates/container/get-one.html @@ -39,8 +39,8 @@ display: flex; display: block; - height: 500px; - max-height: 50vh; + height: 800px; + max-height: 80vh; overflow-y: auto; & .error { @@ -52,9 +52,10 @@ & p { padding: 4px 8px; margin: 0; + background-color: #1a1c38; &:nth-child(odd) { - background-color: #202248; + background-color: #212345; } } @@ -99,12 +100,19 @@ if ("lines" in data) { data.lines.split("\n").map(line => convert.toHtml(line)).filter(line => line).forEach(line => { const lineEl = document.createElement("p"); - lineEl.innerHTML = line; + lineEl.innerHTML = line.trim(); logEl.appendChild(lineEl); lineEl.scrollIntoView(); }); } }); + + // Fix copying from log (remove double newlines) + logEl.addEventListener("copy", (event) => { + const selection = document.getSelection(); + event.clipboardData.setData("text/plain", selection.toString().replace(/\n\n/g, '\n')); + event.preventDefault(); + }); {% endblock %} \ No newline at end of file