feat(gui): live activity-log view toggled from the toolbar
source / check (pull_request) Skipped
verify / verify (pull_request) Failing after 7m4s
verify / verify-windows (pull_request) Skipped

A "Log" toolbar button replaces the fleet table with a live view of the
toolkit activity log (what it is currently doing); the button flips to "Table"
to switch back. The view tails the log, appending new lines and staying
scrolled to the newest entry. Verified under a virtual display.

Placed in the toolbar (top-right) rather than the status bar: the native wx
status bar that holds the zoom slider cannot host a wx button, and the content
sizer has no insert, so a true bottom-right button needs extra plumbing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
This commit is contained in:
2026-11-13 11:06:56 -06:00
co-authored by Claude Opus 4.8
parent 7e0174fda1
commit 4f59233064
+72
View File
@@ -112,6 +112,8 @@ const ID_INSTALL_RELEASE_CHOICE: i32 = 1008;
const ID_INSTALL_BROWSE: i32 = 1011;
// Reload the release picker from the repo typed in the install dialog.
const ID_INSTALL_RELOAD: i32 = 1012;
// Toolbar toggle between the fleet table and the live activity-log view.
const ID_LOG_TOGGLE: i32 = 1013;
const ID_UNINSTALL_OK: i32 = 1009;
const ID_UNINSTALL_CANCEL: i32 = 1010;
// Pool-preset manager dialog (round 18 #8b): edit the whole saved list at once.
@@ -832,6 +834,12 @@ pub struct App {
// rather than render against stale columns (round 18 #12).
built_columns: Vec<crate::model::Column>,
table_parent: Widget,
// Live log view: a multiline control that fills the table area when toggled
// on, showing the toolkit activity log. The toggle button flips its label.
log_view: Widget,
log_toggle_btn: Widget,
showing_log: bool,
log_shown_len: usize,
root_sizer: Widget,
pub scan: Option<scan::ScanHandle>,
pub scanning: bool,
@@ -1231,6 +1239,8 @@ pub fn build(frame: Widget) -> App {
let _report_btn = tbtn("Bug report", ID_BUG_REPORT);
// The old Credentials button is now a Settings menu (round 15 #13).
let _creds_btn = tbtn("Settings", ID_SETTINGS);
// Toggle between the fleet table and the live activity log.
let log_toggle_btn = tbtn("Log", ID_LOG_TOGGLE);
root.add_sizer(ctl, 0, sf::EXPAND | sf::BORDER_LEFT | sf::BORDER_RIGHT, 4);
// Track the KPI captions for live re-localization (index 5, the hashrate
// caption, is dynamic per-algorithm so it is refreshed by refresh_kpis).
@@ -1264,6 +1274,13 @@ pub fn build(frame: Widget) -> App {
// The table is created in rebuild_table and added to `root` there.
let table_parent = panel;
// Live activity-log view: fills the table area when toggled on (hidden until
// then). Added before the table in the sizer; whichever is shown takes the
// space while the other is hidden to zero.
let log_view = Widget::text_ctrl(panel, true);
root.add(log_view, 1, sf::EXPAND | sf::BORDER_ALL, 4);
log_view.show(false);
root.set_sizer_on(panel);
// Collapse the two wide KPI cards when the window is too narrow to fit all
// seven (round 11 #2): listen for panel resizes.
@@ -1304,6 +1321,10 @@ pub fn build(frame: Widget) -> App {
rows_dirty: false,
built_columns: Vec::new(),
table_parent,
log_view,
log_toggle_btn,
showing_log: false,
log_shown_len: 0,
root_sizer: root,
scan: Some(scan::start_scan(ranges.clone(), scan::load_scan_timeout())),
scanning: true,
@@ -1549,6 +1570,11 @@ impl App {
// the KPI + controls rows) and re-run the panel's layout so it is
// positioned, not left floating at (0,0).
self.root_sizer.add(t, 1, sf::EXPAND | sf::BORDER_ALL, 4);
// Keep the table hidden if the log view is currently showing (a rebuild
// would otherwise re-reveal it).
if self.showing_log {
t.show(false);
}
self.table = Some(t);
self.table_parent.layout();
// Re-apply the table zoom so a non-100% zoom survives this rebuild
@@ -4545,8 +4571,53 @@ impl App {
/// Called every second by the scan timer: drain scan messages, then run the
/// scan-loop scheduler (countdown to the next automatic rescan, or idle).
/// Toggle the main window between the fleet table and the live activity log.
fn toggle_log_view(&mut self) {
self.showing_log = !self.showing_log;
if self.showing_log {
if let Some(t) = self.table {
t.show(false);
}
self.log_view.show(true);
self.log_view.set_value("");
self.log_shown_len = 0;
self.refresh_log_view();
self.log_toggle_btn.set_label("Table");
} else {
self.log_view.show(false);
if let Some(t) = self.table {
t.show(true);
}
self.log_toggle_btn.set_label("Log");
}
self.table_parent.layout();
}
/// Tail the activity log into the log view: append only the lines added since
/// last shown (so the view stays scrolled to the newest entry); on a shrink
/// (log cleared) reset. Cheap no-op when nothing changed.
fn refresh_log_view(&mut self) {
let text = crate::logs::dump();
let total = if text.is_empty() { 0 } else { text.lines().count() };
if total > self.log_shown_len {
let new: String = text
.lines()
.skip(self.log_shown_len)
.map(|l| format!("{l}\n"))
.collect();
self.log_view.write_text(&new);
self.log_shown_len = total;
} else if total < self.log_shown_len {
self.log_view.set_value(&text);
self.log_shown_len = total;
}
}
fn tick(&mut self) -> Option<Widget> {
self.drain_scan();
if self.showing_log {
self.refresh_log_view();
}
self.drain_action();
self.drain_refresh();
self.drain_access_probe();
@@ -6022,6 +6093,7 @@ impl App {
ID_EXPORT_ALL => self.export_check_all(true),
ID_EXPORT_NONE => self.export_check_all(false),
ID_SETTINGS => self.open_settings_menu(),
ID_LOG_TOGGLE => self.toggle_log_view(),
ID_BUG_REPORT => return Some(self.build_report_dialog()),
ID_REPORT_SEND => self.send_report(),
ID_REPORT_CLOSE => self.report_dialog.close(0),