Compare commits

...

3 commits

Author SHA1 Message Date
561d57d9a2
Allow returning to menu from BootSetup 2025-06-04 22:08:36 -07:00
fe12b3c4e2
Add logic to return to DiagMenu 2025-06-04 21:58:01 -07:00
710b9d7c16
Show disk details in DiagMenu 2025-06-04 21:52:40 -07:00
3 changed files with 43 additions and 32 deletions

View file

@ -338,6 +338,7 @@ impl App {
self.action_tx.send(Action::SetMode(Mode::Failed))?; self.action_tx.send(Action::SetMode(Mode::Failed))?;
} }
Action::BootScan => self.action_tx.send(Action::SetMode(Mode::BootScan))?, Action::BootScan => self.action_tx.send(Action::SetMode(Mode::BootScan))?,
Action::DiagMainMenu => self.action_tx.send(Action::SetMode(Mode::DiagMenu))?,
Action::InstallDriver => { Action::InstallDriver => {
self.action_tx.send(Action::SetMode(Mode::InstallDrivers))?; self.action_tx.send(Action::SetMode(Mode::InstallDrivers))?;
} }
@ -361,8 +362,8 @@ impl App {
self.action_tx.send(Action::NextScreen)?; self.action_tx.send(Action::NextScreen)?;
} }
Mode::BootSetup => { Mode::BootSetup => {
//let new_mode = self.next_mode(); let new_mode = self.next_mode();
//self.action_tx.send(Action::SetMode(new_mode))?; self.action_tx.send(Action::SetMode(new_mode))?;
} }
_ => {} _ => {}
}, },
@ -921,36 +922,10 @@ fn build_right_items(app: &App) -> Action {
let mut start_index = 0; let mut start_index = 0;
match app.cur_mode { match app.cur_mode {
Mode::DiagMenu => { Mode::DiagMenu => {
let mut header_lines: Vec<DVLine> = Vec::new(); let header_lines = get_disk_header(app);
if let Some(index) = app.clone.disk_index_dest { if !header_lines.is_empty() {
let disk_list = app.clone.disk_list.lock().unwrap(); items.push(header_lines);
if let Some(disk) = disk_list.get(index) { start_index += 1;
let mut parts: Vec<usize> = Vec::new();
if let Some(index) = app.clone.part_index_boot {
parts.push(index);
}
if let Some(index) = app.clone.part_index_os {
parts.push(index);
}
// Disk Details
header_lines.append(&mut vec![
DVLine {
line_parts: vec![String::from("Disk")],
line_colors: vec![Color::Cyan],
},
DVLine {
line_parts: vec![String::new()],
line_colors: vec![Color::Reset],
},
]);
header_lines.append(&mut get_disk_description_right(disk, &Some(parts)));
// Add header
if !header_lines.is_empty() {
items.push(header_lines);
start_index += 1;
}
}
} }
app.list.items.iter().for_each(|mode| { app.list.items.iter().for_each(|mode| {
let (name, description) = get_mode_strings(*mode); let (name, description) = get_mode_strings(*mode);
@ -971,6 +946,11 @@ fn build_right_items(app: &App) -> Action {
}); });
} }
Mode::BootDiags => { Mode::BootDiags => {
let header_lines = get_disk_header(app);
if !header_lines.is_empty() {
items.push(header_lines);
start_index += 1;
}
if let Ok(diag_groups) = app.diag_groups.lock() { if let Ok(diag_groups) = app.diag_groups.lock() {
let mut summary: Vec<DVLine> = Vec::new(); let mut summary: Vec<DVLine> = Vec::new();
diag_groups diag_groups
@ -1045,6 +1025,35 @@ fn build_right_items(app: &App) -> Action {
Action::UpdateRight(labels, start_index, items) Action::UpdateRight(labels, start_index, items)
} }
fn get_disk_header(app: &App) -> Vec<DVLine> {
let mut header_lines: Vec<DVLine> = Vec::new();
if let Some(index) = app.clone.disk_index_dest {
let disk_list = app.clone.disk_list.lock().unwrap();
if let Some(disk) = disk_list.get(index) {
let mut parts: Vec<usize> = Vec::new();
if let Some(index) = app.clone.part_index_boot {
parts.push(index);
}
if let Some(index) = app.clone.part_index_os {
parts.push(index);
}
// Disk Details
header_lines.append(&mut vec![
DVLine {
line_parts: vec![String::from("Disk")],
line_colors: vec![Color::Cyan],
},
DVLine {
line_parts: vec![String::new()],
line_colors: vec![Color::Reset],
},
]);
header_lines.append(&mut get_disk_description_right(disk, &Some(parts)));
}
}
header_lines
}
fn get_mode_strings(mode: Mode) -> (String, String) { fn get_mode_strings(mode: Mode) -> (String, String) {
match mode { match mode {
Mode::BootScan | Mode::BootDiags | Mode::LogView => ( Mode::BootScan | Mode::BootDiags | Mode::LogView => (

View file

@ -109,6 +109,7 @@
"<Enter>": "Process", "<Enter>": "Process",
"<Up>": "KeyUp", "<Up>": "KeyUp",
"<Down>": "KeyDown", "<Down>": "KeyDown",
"<m>": "DiagMainMenu",
"<r>": "BootScan", "<r>": "BootScan",
"<s>": "ScanDisks", "<s>": "ScanDisks",
"<q>": "Quit", "<q>": "Quit",

View file

@ -37,6 +37,7 @@ pub enum Action {
DiagLineStart { text: String }, DiagLineStart { text: String },
DiagLineUpdate { result: DiagResult, text: String }, DiagLineUpdate { result: DiagResult, text: String },
DiagLineEnd { text: String }, DiagLineEnd { text: String },
DiagMainMenu,
// App (Clone) // App (Clone)
Highlight(usize), Highlight(usize),
InstallDriver, InstallDriver,