Send TasksComplete instead of NextScreen
Should allow for better per-app workflow
This commit is contained in:
parent
2829fbcac1
commit
121beeaa78
4 changed files with 12 additions and 5 deletions
|
|
@ -296,14 +296,12 @@ impl App {
|
|||
// Check background task(s)
|
||||
match self.cur_mode {
|
||||
Mode::BootDiags => {
|
||||
// Check result of background task (if finished)
|
||||
if let Some(task) = self.tasks.poll()? {
|
||||
// TODO: Impl logic
|
||||
}
|
||||
}
|
||||
Mode::ScanDisks => {
|
||||
// Check background task (Once all are complete Action::NextScreen is sent)
|
||||
self.tasks.poll()?;
|
||||
let _ = self.tasks.poll()?;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
@ -385,6 +383,13 @@ impl App {
|
|||
self.action_tx.send(build_right_items(self))?;
|
||||
self.action_tx.send(Action::Select(None, None))?;
|
||||
}
|
||||
Action::TasksComplete => {
|
||||
if self.cur_mode == Mode::BootDiags {
|
||||
self.action_tx.send(Action::DismissPopup)?;
|
||||
} else {
|
||||
self.action_tx.send(Action::NextScreen)?;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
for component in &mut self.components {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ pub enum Action {
|
|||
ScanDisks,
|
||||
Select(Option<usize>, Option<usize>), // indicies for (source, dest) etc
|
||||
SelectRight(Option<usize>, Option<usize>), // indicies for right info pane
|
||||
TasksComplete,
|
||||
UpdateDiskList(Vec<Disk>),
|
||||
UpdateFooter(String),
|
||||
UpdateLeft(String, Vec<String>, Vec<String>, usize), // (title, labels, items, select_num)
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ impl Tasks {
|
|||
}
|
||||
|
||||
// Check status of current task (if one is running).
|
||||
// NOTE: Action::NextScreen is sent once all tasks are complete
|
||||
// NOTE: Action::TasksComplete is sent once all tasks are complete
|
||||
if let Some(task_handle) = self.cur_handle.take() {
|
||||
if task_handle.is_finished() {
|
||||
// Need to return task with handle
|
||||
|
|
@ -124,7 +124,7 @@ impl Tasks {
|
|||
}
|
||||
if self.task_list.is_empty() {
|
||||
// No tasks remain
|
||||
self.action_tx.send(Action::NextScreen)?;
|
||||
self.action_tx.send(Action::TasksComplete)?;
|
||||
} else {
|
||||
// Start next task
|
||||
self.start()?;
|
||||
|
|
|
|||
|
|
@ -530,6 +530,7 @@ impl App {
|
|||
_ => {}
|
||||
};
|
||||
}
|
||||
Action::TasksComplete => self.action_tx.send(Action::NextScreen)?,
|
||||
_ => {}
|
||||
}
|
||||
for component in &mut self.components {
|
||||
|
|
|
|||
Loading…
Reference in a new issue