diff --git a/crates/alkane-gui/src/ui.rs b/crates/alkane-gui/src/ui.rs index ff386df9..aed1f2e5 100644 --- a/crates/alkane-gui/src/ui.rs +++ b/crates/alkane-gui/src/ui.rs @@ -559,41 +559,6 @@ fn ascii_bar(pct: u8) -> String { format!("[{}{}]", "#".repeat(filled), "-".repeat(width - filled)) } -/// A read-only flash-plan summary for a local `.afw`: its tier and which regions -/// it overwrites (U-Boot / Kernel / Userspace), from the bundle's own manifest. -/// Shown in the install dialog when a file is picked so the operator sees exactly -/// what the flash touches before starting. -fn afw_plan_text(path: &str, expect_board: &str) -> String { - use alkane_artifacts::afw::{verify_afw, VerifyOptions}; - // Verify against the install target's board (review #6): a file for another - // board then surfaces as an error here instead of showing a plausible plan - // that start_install would later reject. - let opts = VerifyOptions { - allow_unsigned: true, - expect_board: Some(expect_board.to_string()), - }; - match verify_afw(std::path::Path::new(path), &opts) { - Ok(v) => { - let p = v.manifest.flash_plan(); - let mark = |b: bool| if b { "[x]" } else { "[ ]" }; - format!( - "Flash plan: tier {} (board {}). Overwrites:\n {} U-Boot{}\n {} Kernel\n {} Userspace (rootfs)", - p.tier, - v.manifest.board, - mark(p.writes_uboot), - if p.writes_uboot { - "" - } else { - " -- preserved" - }, - mark(p.writes_kernel), - mark(p.writes_userspace), - ) - } - Err(e) => format!("Could not read flash plan from this file: {e}"), - } -} - /// The colour a component-health state renders in (round 13 #3): grey = /// unreachable, red = detected but down, yellow = sub-optimal, green = healthy. fn health_color(pal: &Palette, h: crate::model::CompHealth) -> (u8, u8, u8) { @@ -1030,7 +995,6 @@ pub struct App { install_local_label: Widget, // A read-only flash-plan checklist (tier + which regions are overwritten), // filled from a picked local .afw's manifest. - install_plan_label: Widget, // The release repo (owner/repo) the picker scans; defaults to // blueflare/alkane-os, editable + reloadable to any compatible repo. install_repo_input: Widget, @@ -1473,7 +1437,6 @@ pub fn build(frame: Widget) -> App { install_is_update: false, install_local_path: None, install_local_label: frame, - install_plan_label: frame, install_repo_input: frame, media_dialog: frame, media_kind_choice: frame, @@ -2941,15 +2904,9 @@ impl App { Widget::static_text( dlg, &if update { - format!( - "Update alkane OS on {n} board(s) already running it (updated in place; BOOT.bin is never written):\n{}", - ips.join(", ") - ) + format!("Update {n} board(s):\n{}", ips.join(", ")) } else { - format!( - "Install alkane OS onto {n} board(s) currently on stock:\n{}", - ips.join(", ") - ) + format!("Install onto {n} board(s):\n{}", ips.join(", ")) }, ), 0, @@ -2986,14 +2943,7 @@ impl App { self.install_board = id.to_string(); } root.add( - Widget::static_text( - dlg, - if update { - "Release to update to (newest first):" - } else { - "Release to install (newest first):" - }, - ), + Widget::static_text(dlg, "Release"), 0, sf::BORDER_LEFT | sf::BORDER_RIGHT | sf::BORDER_TOP, 12, @@ -3011,7 +2961,7 @@ impl App { // format; defaults to blueflare/alkane-os. Reload re-scans it and keeps // only the releases compatible with this board. root.add( - Widget::static_text(dlg, "Release repo URL (Gitea or GitHub), then Reload:"), + Widget::static_text(dlg, "Release repo"), 0, sf::BORDER_LEFT | sf::BORDER_RIGHT | sf::BORDER_TOP, 12, @@ -3019,6 +2969,7 @@ impl App { let repo_row = Widget::box_sizer(false); let repo_input = Widget::text_ctrl(dlg, false); repo_input.set_value("https://gitea.bluefla.re/blueflare/alkane-os"); + repo_input.set_tool_tip("A Gitea or GitHub repo URL, or owner/repo. Reload to re-scan."); repo_row.add( repo_input, 1, @@ -3040,19 +2991,16 @@ impl App { // install, now in the GUI). When a file is chosen it takes precedence // over the release selected above; the label shows the current choice. root.add( - Widget::static_text(dlg, "Or install from a local .afw file:"), + Widget::static_text(dlg, "Local .afw"), 0, sf::BORDER_LEFT | sf::BORDER_RIGHT | sf::BORDER_TOP, 12, ); let browse_row = Widget::box_sizer(false); - browse_row.add( - Widget::button(dlg, "Browse local .afw...", ID_INSTALL_BROWSE), - 0, - sf::BORDER_RIGHT, - 6, - ); - let local_label = Widget::static_text(dlg, "(none; using the selected release above)"); + let browse_btn = Widget::button(dlg, "Browse...", ID_INSTALL_BROWSE); + browse_btn.set_tool_tip("Install a local .afw instead of the selected release."); + browse_row.add(browse_btn, 0, sf::BORDER_RIGHT, 6); + let local_label = Widget::static_text(dlg, "(using selected release)"); browse_row.add(local_label, 1, sf::ALIGN_CENTRE_VERTICAL, 0); self.install_local_label = local_label; root.add_sizer( @@ -3062,36 +3010,17 @@ impl App { 12, ); - // Flash-plan checklist: detects the tier and which regions a picked local - // .afw overwrites (U-Boot / Kernel / Userspace). - let plan = Widget::static_text( - dlg, - "Flash plan: pick a local .afw above to see its tier and what it overwrites.", - ); - root.add(plan, 0, sf::BORDER_ALL, 12); - self.install_plan_label = plan; - // No password field (issue #46): the board login comes from Settings (or // the firmware's shipped default when unset). // Current bench .afw files are unsigned (SHA-256 integrity, no Ed25519). let unsigned = Widget::check_box(dlg, "Allow unsigned .afw (bench only)"); unsigned.set_checked(true); + unsigned + .set_tool_tip("Bench images are unsigned: SHA-256 proves integrity, not authenticity."); root.add(unsigned, 0, sf::BORDER_ALL, 12); self.install_unsigned_check = unsigned; - // No typed-FLASH step (issue #41): the dialog, the board list and the - // Install button are the confirmation. The warning stays visible. - root.add( - Widget::static_text( - dlg, - "This reflashes the control board. Click Install to start.", - ), - 0, - sf::BORDER_ALL, - 12, - ); - let btns = Widget::box_sizer(false); btns.add_stretch(1); btns.add( @@ -3138,20 +3067,14 @@ impl App { let dlg = Widget::dialog(frame, "Installation Media"); let root = Widget::box_sizer(true); root.add( - Widget::static_text( - dlg, - &format!( - "Build a bootable SD installation card for the {board} control board.\nInsert a card, choose what to build, then Create." - ), - ), + Widget::static_text(dlg, &format!("Control board: {board}")), 0, sf::BORDER_ALL, 12, ); - // What to build. root.add( - Widget::static_text(dlg, "What to build:"), + Widget::static_text(dlg, "Media type"), 0, sf::BORDER_LEFT | sf::BORDER_RIGHT | sf::BORDER_TOP, 12, @@ -3168,23 +3091,18 @@ impl App { root.add(kind, 0, sf::EXPAND | sf::BORDER_LEFT | sf::BORDER_RIGHT, 12); self.media_kind_choice = kind; - // Image source. root.add( - Widget::static_text( - dlg, - "Image source -- an .afw for alkane, or a genuine vendor package (.zip or folder) for stock recovery:", - ), + Widget::static_text(dlg, "Source"), 0, sf::BORDER_LEFT | sf::BORDER_RIGHT | sf::BORDER_TOP, 12, ); let browse_row = Widget::box_sizer(false); - browse_row.add( - Widget::button(dlg, "Browse...", ID_MEDIA_BROWSE), - 0, - sf::BORDER_RIGHT, - 6, + let src_browse = Widget::button(dlg, "Browse...", ID_MEDIA_BROWSE); + src_browse.set_tool_tip( + "An .afw for alkane media, or a genuine vendor package (.zip) for stock recovery.", ); + browse_row.add(src_browse, 0, sf::BORDER_RIGHT, 6); let src_label = Widget::static_text(dlg, "(none selected)"); browse_row.add(src_label, 1, sf::ALIGN_CENTRE_VERTICAL, 0); self.media_source_label = src_label; @@ -3197,12 +3115,15 @@ impl App { let unsigned = Widget::check_box(dlg, "Allow unsigned .afw (bench only)"); unsigned.set_checked(true); + unsigned + .set_tool_tip("Bench images are unsigned: SHA-256 proves integrity, not authenticity."); root.add(unsigned, 0, sf::BORDER_ALL, 12); self.media_unsigned_check = unsigned; - // Target device. + let target = Widget::static_text(dlg, "Target card"); + target.set_tool_tip("Writing a card erases it entirely. Confirm the device first."); root.add( - Widget::static_text(dlg, "Target SD card (writing ERASES the whole card):"), + target, 0, sf::BORDER_LEFT | sf::BORDER_RIGHT | sf::BORDER_TOP, 12, @@ -3220,16 +3141,6 @@ impl App { ); self.populate_media_devices(); - root.add( - Widget::static_text( - dlg, - "The card is built as an image first, then written. Double-check the target card before Create.", - ), - 0, - sf::BORDER_ALL, - 12, - ); - let btns = Widget::box_sizer(false); btns.add_stretch(1); btns.add( @@ -6632,19 +6543,12 @@ impl App { .file_name() .map(|n| n.to_string_lossy().into_owned()) .unwrap_or_else(|| path.clone()); - self.install_local_label - .set_label(&format!("Using local file: {name}")); - let board = self.install_board.clone(); - self.install_plan_label - .set_label(&afw_plan_text(&path, &board)); + self.install_local_label.set_label(&name); self.install_local_path = Some(path); self.install_dialog.layout(); } else { self.install_local_label - .set_label("(none; using the selected release above)"); - self.install_plan_label.set_label( - "Flash plan: pick a local .afw above to see its tier and what it overwrites.", - ); + .set_label("(using selected release)"); self.install_local_path = None; } }