From 87ec05126b4d4b4f3e4e747ac3355261cf5b8556 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sat, 16 Nov 2024 04:59:22 -0800 Subject: [PATCH] Ignore Enter presses during Pre/Mid/Post Clone --- config/config.json5 | 3 --- src/app.rs | 2 +- src/components/footer.rs | 10 ++++------ src/components/left.rs | 5 +++-- src/components/popup.rs | 8 -------- src/components/right.rs | 2 ++ 6 files changed, 10 insertions(+), 20 deletions(-) diff --git a/config/config.json5 b/config/config.json5 index 064e12a..bb9e684 100644 --- a/config/config.json5 +++ b/config/config.json5 @@ -46,14 +46,12 @@ "": "Suspend" // Suspend the application }, "PreClone": { - "": "Process", "": "Quit", // Quit the application "": "Quit", // Another way to quit "": "Quit", // Yet another way to quit "": "Suspend" // Suspend the application }, "Clone": { - "": "Process", "": "Quit", // Quit the application "": "Quit", // Another way to quit "": "Quit", // Yet another way to quit @@ -70,7 +68,6 @@ "": "Suspend" // Suspend the application }, "PostClone": { - "": "Process", "": "Quit", // Quit the application "": "Quit", // Another way to quit "": "Quit", // Yet another way to quit diff --git a/src/app.rs b/src/app.rs index 512dc7b..e8638ff 100644 --- a/src/app.rs +++ b/src/app.rs @@ -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() { diff --git a/src/components/footer.rs b/src/components/footer.rs index 0bfd5fa..dab12f3 100644 --- a/src/components/footer.rs +++ b/src/components/footer.rs @@ -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( diff --git a/src/components/left.rs b/src/components/left.rs index 5b26a0a..3772576 100644 --- a/src/components/left.rs +++ b/src/components/left.rs @@ -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 { diff --git a/src/components/popup.rs b/src/components/popup.rs index f783dfc..df81bc3 100644 --- a/src/components/popup.rs +++ b/src/components/popup.rs @@ -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..."); diff --git a/src/components/right.rs b/src/components/right.rs index 4081d58..f0a7e6b 100644 --- a/src/components/right.rs +++ b/src/components/right.rs @@ -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] {