Ignore Enter presses during Pre/Mid/Post Clone
This commit is contained in:
parent
61e539e071
commit
87ec05126b
6 changed files with 10 additions and 20 deletions
|
|
@ -46,14 +46,12 @@
|
|||
"<Ctrl-z>": "Suspend" // Suspend the application
|
||||
},
|
||||
"PreClone": {
|
||||
"<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
|
||||
},
|
||||
"Clone": {
|
||||
"<Enter>": "Process",
|
||||
"<q>": "Quit", // Quit the application
|
||||
"<Ctrl-d>": "Quit", // Another way to quit
|
||||
"<Ctrl-c>": "Quit", // Yet another way to quit
|
||||
|
|
@ -70,7 +68,6 @@
|
|||
"<Ctrl-z>": "Suspend" // Suspend the application
|
||||
},
|
||||
"PostClone": {
|
||||
"<Enter>": "Process",
|
||||
"<q>": "Quit", // Quit the application
|
||||
"<Ctrl-d>": "Quit", // Another way to quit
|
||||
"<Ctrl-c>": "Quit", // Yet another way to quit
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ impl Tasks {
|
|||
pub fn poll(&mut self) -> Result<()> {
|
||||
debug!("Polling tasks {:?} // {:?}", &self.handle, &self.task_list);
|
||||
|
||||
// Forward any errors (actions) to main app
|
||||
// Forward any actions to main app
|
||||
if let Ok(action) = self.task_rx.try_recv() {
|
||||
let result = self.action_tx.send(action.clone());
|
||||
if result.is_err() {
|
||||
|
|
|
|||
|
|
@ -57,12 +57,10 @@ impl Component for Footer {
|
|||
}
|
||||
Action::SetMode(new_mode) => {
|
||||
self.footer_text = match new_mode {
|
||||
Mode::ScanDisks => String::from("(q) to quit"),
|
||||
Mode::PreClone
|
||||
| Mode::Clone
|
||||
| Mode::UpdateDestDisk
|
||||
| Mode::SelectParts
|
||||
| Mode::PostClone => {
|
||||
Mode::ScanDisks | Mode::PreClone | Mode::Clone | Mode::PostClone => {
|
||||
String::from("(q) to quit")
|
||||
}
|
||||
Mode::UpdateDestDisk | Mode::SelectParts => {
|
||||
String::from("(Enter) to select / (s) to start over / (q) to quit")
|
||||
}
|
||||
Mode::SelectDisks => String::from(
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use color_eyre::Result;
|
|||
use crossterm::event::KeyEvent;
|
||||
use ratatui::{prelude::*, widgets::*};
|
||||
use tokio::sync::mpsc::UnboundedSender;
|
||||
use tracing::info;
|
||||
|
||||
use super::{popup, state::StatefulList, Component};
|
||||
use crate::{
|
||||
|
|
@ -94,8 +95,7 @@ impl Component for Left {
|
|||
},
|
||||
Action::Process => match self.mode {
|
||||
// NOTE: Remove all variants except Mode::Confirm?
|
||||
// Mode::Confirm => {
|
||||
Mode::Confirm | Mode::PreClone | Mode::Clone | Mode::PostClone => {
|
||||
Mode::Confirm => {
|
||||
if let Some(command_tx) = self.command_tx.clone() {
|
||||
command_tx.send(Action::NextScreen)?;
|
||||
}
|
||||
|
|
@ -227,6 +227,7 @@ impl Component for Left {
|
|||
}
|
||||
}
|
||||
Action::UpdateDiskList(disks) => {
|
||||
info!("Updating disk list");
|
||||
self.list_disks.set_items(disks);
|
||||
if self.mode == Mode::SelectParts {
|
||||
if let Some(index) = self.disk_id_dest {
|
||||
|
|
|
|||
|
|
@ -72,14 +72,6 @@ impl Component for Popup {
|
|||
self.popup_type = new_type;
|
||||
self.popup_text = String::from(new_text);
|
||||
}
|
||||
Action::Process => {
|
||||
if !self.popup_text.is_empty() && self.mode == Mode::InstallDrivers {
|
||||
self.popup_text = String::from("");
|
||||
if let Some(command_tx) = self.command_tx.clone() {
|
||||
command_tx.send(Action::NextScreen)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Action::SetMode(mode) => {
|
||||
if mode == Mode::ScanDisks {
|
||||
self.popup_text = String::from("Scanning Disks...");
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use color_eyre::Result;
|
|||
use crossterm::event::KeyEvent;
|
||||
use ratatui::{prelude::*, widgets::*};
|
||||
use tokio::sync::mpsc::UnboundedSender;
|
||||
use tracing::info;
|
||||
|
||||
use super::{state::StatefulList, Component};
|
||||
use crate::{
|
||||
|
|
@ -119,6 +120,7 @@ impl Component for Right {
|
|||
}
|
||||
}
|
||||
Action::UpdateDiskList(disks) => {
|
||||
info!("Updating disk list");
|
||||
self.list_disks.set_items(disks);
|
||||
if self.cur_mode == Mode::SelectParts {
|
||||
if let Some(index) = self.selected_disks[1] {
|
||||
|
|
|
|||
Loading…
Reference in a new issue