From: Dominik Csapak <d.csapak@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [RFC PATCH yew-comp 3/3] log-view: improve display of lines with '\r'
Date: Mon, 30 Mar 2026 14:53:08 +0200 [thread overview]
Message-ID: <20260330125320.507302-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260330125320.507302-1-d.csapak@proxmox.com>
Some tools, like 'dd', will output '\r' as line delimiter, so it
overwrites the last line in the cli output.
Since the browser typically ignores '\r' in the DOM, this kind of output
leads to very long and unreadable lines.
In ExtJS, the problem is circumvented somewhat: it uses '.innerHTML'
which leads to the browser parsing and normalizing line endings.
This "works", in the sense that the lines will displayed separately,
but interferes with the paging algorithm that depends on the backend
line count (which counts "\n" only currently).
We can improve this in the frontend only, by only displaying the 'last
line' (everything after the last '\r') by default, and adding a hint
icon that shows the full output in a tooltip.
This fixes the issue with readability, does not interfere with the
paging algorithm, and sill provides the full output (on demand).
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
this is a pattern we don't have yet, showing inline icons in task log
I did not want to do the same thing extjs does, since it can break the
virtual scrolling.
the long-term fix is to fix the command invokations to replace \r to \n
but this does not fix already existing task logs and older PVE/PBS
servers, so having a workaround/solution in the gui is still useful
IMHO.
src/log_view.rs | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/log_view.rs b/src/log_view.rs
index fdfce4c..90000d4 100644
--- a/src/log_view.rs
+++ b/src/log_view.rs
@@ -9,13 +9,14 @@ use serde_json::json;
use yew::html::{IntoEventCallback, IntoPropValue};
use yew::virtual_dom::{Key, VComp, VNode};
+use pwt::css;
use pwt::dom::DomSizeObserver;
use pwt::prelude::*;
use pwt::props::{
AsClassesMut, AsCssStylesMut, ContainerBuilder, CssMarginBuilder, CssPaddingBuilder, CssStyles,
WidgetBuilder, WidgetStyleBuilder,
};
-use pwt::widget::Container;
+use pwt::widget::{Container, Fa, Tooltip};
use pwt::AsyncPool;
use pwt_macros::builder;
@@ -478,7 +479,27 @@ impl Component for PwtLogView {
let page_ref = page_ref.take().unwrap_or_default();
for item in page.lines.iter() {
- tag.add_child(format!("{}\n", item.t));
+ if let Some(idx) = item.t.rfind('\r') {
+ tag.add_child(&item.t[idx + 1..]);
+ tag.add_child(
+ Tooltip::new(
+ Fa::new("info-circle").class(css::FontColor::Warning),
+ )
+ .rich_tip(
+ Container::new()
+ .class(css::WhiteSpace::Pre)
+ .with_child(tr!("Full Output:"))
+ .with_child(
+ item.t.replace("\r\n", "\n").replace("\r", "\n"),
+ ),
+ )
+ .padding_start(1)
+ .class(css::Display::Inline),
+ );
+ } else {
+ tag.add_child(&item.t);
+ }
+ tag.add_child("\n");
}
let html: Html = tag.into_html_with_ref(page_ref);
--
2.47.3
prev parent reply other threads:[~2026-03-30 12:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 12:53 [PATCH yew-comp 0/3] improve task/log viewer Dominik Csapak
2026-03-30 12:53 ` [PATCH yew-comp 1/3] task (viewer): add task download button Dominik Csapak
2026-03-30 13:36 ` Shannon Sterz
2026-03-30 13:48 ` Dominik Csapak
[not found] ` <DHG6K6Z0MPF2.1RFDEDL4NQM3M@proxmox.com>
[not found] ` <059e96c0-1b42-4c94-979a-6dfcf6ff5860@proxmox.com>
[not found] ` <DHG71AI5H1Z9.1E3IKBB4GT12K@proxmox.com>
[not found] ` <6e6fa075-2b27-4635-8fcf-ebdcdfdad3d8@proxmox.com>
2026-03-31 7:39 ` Shannon Sterz
2026-03-31 11:14 ` Maximiliano Sandoval
2026-03-31 12:05 ` Dominik Csapak
2026-03-31 12:14 ` Dominik Csapak
2026-03-31 12:55 ` Shannon Sterz
2026-03-30 12:53 ` [PATCH yew-comp 2/3] log-view: reorganize imports Dominik Csapak
2026-03-30 12:53 ` Dominik Csapak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260330125320.507302-4-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=yew-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.