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