Expand boot diagnostic sections

This commit is contained in:
2Shirt 2024-12-01 16:50:28 -08:00
parent 783e31a582
commit 3674fbdee7
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 34 additions and 29 deletions

View file

@ -89,30 +89,35 @@
},
// Diagnostic modes
"DiagMenu": {
"<Enter>": "Process",
"<q>": "Quit", // Quit the application
"<Ctrl-d>": "Quit", // Another way to quit
"<Ctrl-c>": "Quit", // Yet another way to quit
"<Ctrl-z>": "Suspend" // Suspend the application
},
"BootDiags": {
"<Enter>": "Process",
"<q>": "Quit", // Quit the application
"<Ctrl-d>": "Quit", // Another way to quit
"<Ctrl-c>": "Quit", // Yet another way to quit
"<Ctrl-z>": "Suspend" // Suspend the application
},
"BootSetup": {
"<Enter>": "Process",
"<q>": "Quit", // Quit the application
"<Ctrl-d>": "Quit", // Another way to quit
"<Ctrl-c>": "Quit", // Yet another way to quit
"<Ctrl-z>": "Suspend" // Suspend the application
},
"InjectDrivers": {
"<Enter>": "Process",
"<q>": "Quit", // Quit the application
"<Ctrl-d>": "Quit", // Another way to quit
"<Ctrl-c>": "Quit", // Yet another way to quit
"<Ctrl-z>": "Suspend" // Suspend the application
},
"ToggleSafeBoot": {
"<Enter>": "Process",
"<q>": "Quit", // Quit the application
"<Ctrl-d>": "Quit", // Another way to quit
"<Ctrl-c>": "Quit", // Yet another way to quit

View file

@ -105,7 +105,7 @@ impl App {
action_rx,
action_tx,
components: vec![
Box::new(Title::new()),
Box::new(Title::new(cli_cmd)),
Box::new(FpsCounter::new()),
Box::new(Left::new()),
Box::new(Right::new()),
@ -158,14 +158,11 @@ impl App {
(_, Mode::Failed) => Mode::Failed,
// Diagnostic states
(
_,
Mode::DiagMenu
| Mode::BootDiags
| Mode::BootSetup
| Mode::InjectDrivers
| Mode::ToggleSafeBoot,
) => Mode::DiagMenu,
(_, Mode::DiagMenu) => Mode::BootDiags,
(_, Mode::BootDiags) => Mode::BootSetup,
(_, Mode::BootSetup) => Mode::InjectDrivers,
(_, Mode::InjectDrivers) => Mode::ToggleSafeBoot,
(_, Mode::ToggleSafeBoot) => Mode::Done,
// Invalid states
(_, Mode::Confirm) => panic!("This shouldn't happen."),
@ -318,10 +315,7 @@ impl App {
action_tx.send(Action::SetMode(Mode::ScanDisks))?;
}
cli::Command::Diagnose => {
action_tx.send(Action::DisplayPopup(
popup::Type::Info,
String::from("Boot Diagnostics?"),
))?;
action_tx.send(Action::SetMode(Mode::DiagMenu))?;
}
}

View file

@ -163,6 +163,15 @@ impl Component for Left {
}
}
}
Mode::DiagMenu
| Mode::BootDiags
| Mode::BootSetup
| Mode::InjectDrivers
| Mode::ToggleSafeBoot => {
if let Some(command_tx) = self.command_tx.clone() {
command_tx.send(Action::NextScreen)?;
}
}
_ => {}
},
Action::Select(Some(index), None) => self.selections[0] = Some(index),
@ -219,14 +228,11 @@ impl Component for Left {
}
(_, Mode::Done | Mode::Failed) => self.title_text = String::from("Done"),
// Diagnostic states
(
_,
Mode::DiagMenu
| Mode::BootDiags
| Mode::BootSetup
| Mode::InjectDrivers
| Mode::ToggleSafeBoot,
) => self.title_text = String::from("Boot Diagnostics"),
(_, Mode::DiagMenu) => self.title_text = String::from("Main Menu"),
(_, Mode::BootDiags) => self.title_text = String::from("Boot Diagnostics"),
(_, Mode::BootSetup) => self.title_text = String::from("Boot Setup"),
(_, Mode::InjectDrivers) => self.title_text = String::from("Inject Drivers"),
(_, Mode::ToggleSafeBoot) => self.title_text = String::from("Toggle Safe Mode"),
// Invalid states
(_, Mode::Confirm) => panic!("This shouldn't happen."),
@ -280,10 +286,18 @@ impl Component for Left {
// Body
match self.mode {
// Clone modes
Mode::ScanDisks
| Mode::PreClone
| Mode::Clone
| Mode::PostClone
// Diagnostic modes
| Mode::DiagMenu
| Mode::BootDiags
| Mode::BootSetup
| Mode::InjectDrivers
| Mode::ToggleSafeBoot
// Done
| Mode::Done
| Mode::Failed => {
// Leave blank
@ -391,14 +405,6 @@ impl Component for Left {
_ => panic!("This shouldn't happen."),
}
}
Mode::DiagMenu
| Mode::BootDiags
| Mode::BootSetup
| Mode::InjectDrivers
| Mode::ToggleSafeBoot => {
// Diagnostic modes
return Ok(());
}
}
// Done