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)
|
// Check background task(s)
|
||||||
match self.cur_mode {
|
match self.cur_mode {
|
||||||
Mode::BootDiags => {
|
Mode::BootDiags => {
|
||||||
// Check result of background task (if finished)
|
|
||||||
if let Some(task) = self.tasks.poll()? {
|
if let Some(task) = self.tasks.poll()? {
|
||||||
// TODO: Impl logic
|
// TODO: Impl logic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Mode::ScanDisks => {
|
Mode::ScanDisks => {
|
||||||
// Check background task (Once all are complete Action::NextScreen is sent)
|
let _ = self.tasks.poll()?;
|
||||||
self.tasks.poll()?;
|
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
@ -385,6 +383,13 @@ impl App {
|
||||||
self.action_tx.send(build_right_items(self))?;
|
self.action_tx.send(build_right_items(self))?;
|
||||||
self.action_tx.send(Action::Select(None, None))?;
|
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 {
|
for component in &mut self.components {
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ pub enum Action {
|
||||||
ScanDisks,
|
ScanDisks,
|
||||||
Select(Option<usize>, Option<usize>), // indicies for (source, dest) etc
|
Select(Option<usize>, Option<usize>), // indicies for (source, dest) etc
|
||||||
SelectRight(Option<usize>, Option<usize>), // indicies for right info pane
|
SelectRight(Option<usize>, Option<usize>), // indicies for right info pane
|
||||||
|
TasksComplete,
|
||||||
UpdateDiskList(Vec<Disk>),
|
UpdateDiskList(Vec<Disk>),
|
||||||
UpdateFooter(String),
|
UpdateFooter(String),
|
||||||
UpdateLeft(String, Vec<String>, Vec<String>, usize), // (title, labels, items, select_num)
|
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).
|
// 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 let Some(task_handle) = self.cur_handle.take() {
|
||||||
if task_handle.is_finished() {
|
if task_handle.is_finished() {
|
||||||
// Need to return task with handle
|
// Need to return task with handle
|
||||||
|
|
@ -124,7 +124,7 @@ impl Tasks {
|
||||||
}
|
}
|
||||||
if self.task_list.is_empty() {
|
if self.task_list.is_empty() {
|
||||||
// No tasks remain
|
// No tasks remain
|
||||||
self.action_tx.send(Action::NextScreen)?;
|
self.action_tx.send(Action::TasksComplete)?;
|
||||||
} else {
|
} else {
|
||||||
// Start next task
|
// Start next task
|
||||||
self.start()?;
|
self.start()?;
|
||||||
|
|
|
||||||
|
|
@ -530,6 +530,7 @@ impl App {
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Action::TasksComplete => self.action_tx.send(Action::NextScreen)?,
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
for component in &mut self.components {
|
for component in &mut self.components {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue