Add more framework for workflow
This commit is contained in:
parent
cf87ac32af
commit
f51a4e85c4
5 changed files with 45 additions and 5 deletions
|
|
@ -188,5 +188,20 @@
|
|||
"<Ctrl-c>": "Quit",
|
||||
"<Ctrl-z>": "Suspend"
|
||||
},
|
||||
"ScanWinImages": {
|
||||
"<Enter>": "Process",
|
||||
"<n>": "FindWimNetwork",
|
||||
"<q>": "Quit",
|
||||
"<Ctrl-d>": "Quit",
|
||||
"<Ctrl-c>": "Quit",
|
||||
"<Ctrl-z>": "Suspend"
|
||||
},
|
||||
"SetUserName": {
|
||||
"<Enter>": "Process",
|
||||
"<Esc>": "Process",
|
||||
"<Ctrl-d>": "Quit",
|
||||
"<Ctrl-c>": "Quit",
|
||||
"<Ctrl-z>": "Suspend"
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ pub enum Action {
|
|||
OpenTerminal,
|
||||
Restart,
|
||||
Shutdown,
|
||||
// App (Win-Installer)
|
||||
FindWimNetwork,
|
||||
// Screens
|
||||
DismissPopup,
|
||||
DisplayPopup(PopupType, String),
|
||||
|
|
|
|||
|
|
@ -245,10 +245,23 @@ impl App<'_> {
|
|||
// }
|
||||
Action::Resize(w, h) => self.handle_resize(tui, w, h)?,
|
||||
Action::Render => self.render(tui)?,
|
||||
Action::FindWimNetwork => {
|
||||
self.state.reset_network();
|
||||
// TODO: Actually scan network!
|
||||
}
|
||||
Action::SetMode(mode) => {
|
||||
self.mode = mode;
|
||||
if self.mode == Mode::ScanDisks {
|
||||
self.state.reset();
|
||||
match mode {
|
||||
Mode::Done => {
|
||||
self.action_tx.send(Action::DisplayPopup(
|
||||
popup::Type::Success,
|
||||
popup::fortune(),
|
||||
))?;
|
||||
}
|
||||
Mode::ScanDisks => {
|
||||
self.state.reset_all();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
self.action_tx.send(Action::UpdateFooter(String::from(
|
||||
"(Enter) to select / (t) for terminal / (p) to power off / (r) to restart",
|
||||
|
|
|
|||
|
|
@ -40,13 +40,19 @@ impl State<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn reset(&mut self) {
|
||||
pub fn reset_all(&mut self) {
|
||||
self.disk_index_dest = None;
|
||||
self.part_index_boot = None;
|
||||
self.wim_file_index = None;
|
||||
self.wim_image_index = None;
|
||||
if let Ok(mut sources) = self.wim_sources.lock() {
|
||||
sources.reset();
|
||||
sources.reset_all();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reset_network(&mut self) {
|
||||
if let Ok(mut sources) = self.wim_sources.lock() {
|
||||
sources.reset_network();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,10 +99,14 @@ impl WimSources<'_> {
|
|||
Default::default()
|
||||
}
|
||||
|
||||
pub fn reset(&mut self) {
|
||||
pub fn reset_all(&mut self) {
|
||||
self.local.clear();
|
||||
self.network.clear();
|
||||
}
|
||||
|
||||
pub fn reset_network(&mut self) {
|
||||
self.network.clear();
|
||||
}
|
||||
}
|
||||
|
||||
fn get_wim_xml(wim_file: &str) -> std::io::Result<File> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue