Compare commits
4 commits
e0823293e2
...
88f1234dd0
| Author | SHA1 | Date | |
|---|---|---|---|
| 88f1234dd0 | |||
| 718e4061f8 | |||
| dfc861cc09 | |||
| 52ccc154cc |
5 changed files with 31 additions and 9 deletions
|
|
@ -529,6 +529,10 @@ impl App {
|
|||
}
|
||||
|
||||
fn queue_boot_scan_tasks(&mut self) -> Result<()> {
|
||||
self.diag_groups.reset();
|
||||
if let Ok(mut results) = self.results.lock() {
|
||||
results.clear();
|
||||
}
|
||||
let disk_list = self.clone.disk_list.lock().unwrap();
|
||||
if let Some(disk_index) = self.clone.disk_index_dest {
|
||||
if let Some(disk) = disk_list.get(disk_index) {
|
||||
|
|
@ -747,10 +751,10 @@ fn get_chunks(r: Rect) -> Vec<Rect> {
|
|||
chunks.push(centered_rect(60, 25, r));
|
||||
|
||||
// Progress
|
||||
chunks.push(centered_rect(60, 80, chunks[1]));
|
||||
chunks.push(centered_rect(60, 70, r));
|
||||
|
||||
// Results
|
||||
chunks.push(centered_rect(60, 80, chunks[1]));
|
||||
chunks.push(centered_rect(60, 70, r));
|
||||
|
||||
// Done
|
||||
chunks
|
||||
|
|
@ -758,14 +762,13 @@ fn get_chunks(r: Rect) -> Vec<Rect> {
|
|||
|
||||
fn build_footer_string(cur_mode: Mode) -> String {
|
||||
match cur_mode {
|
||||
Mode::BootDiags => String::from("(r) to refresh / (q) to quit"),
|
||||
Mode::BootScan | Mode::BootSetup | Mode::Home | Mode::ScanDisks => {
|
||||
String::from("(q) to quit")
|
||||
}
|
||||
Mode::InstallDrivers | Mode::InjectDrivers | Mode::SetBootMode => {
|
||||
String::from("(Enter) to select / (q) to quit")
|
||||
}
|
||||
Mode::DiagMenu | Mode::SelectParts => {
|
||||
Mode::BootDiags | Mode::DiagMenu | Mode::SelectParts => {
|
||||
String::from("(Enter) to select / (s) to start over / (q) to quit")
|
||||
}
|
||||
Mode::Done => String::from("(Enter) to continue / (q) to quit"),
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
use color_eyre::Result;
|
||||
use ratatui::{
|
||||
Frame,
|
||||
layout::Rect,
|
||||
layout::{Alignment, Rect},
|
||||
style::{Color, Style, Stylize},
|
||||
text::{Line, Span},
|
||||
widgets::{Block, Borders, Clear, Paragraph},
|
||||
|
|
@ -96,7 +96,10 @@ impl Component for Progress {
|
|||
line.running = false;
|
||||
}
|
||||
}
|
||||
Action::SetMode(mode) => self.mode = mode,
|
||||
Action::SetMode(mode) => {
|
||||
self.mode = mode;
|
||||
self.lines.clear();
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
Ok(None)
|
||||
|
|
@ -136,12 +139,19 @@ impl Component for Progress {
|
|||
});
|
||||
|
||||
// Build block
|
||||
let block = Block::default()
|
||||
let outer_block = Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.style(Style::default().bold());
|
||||
let body = Paragraph::new(body_text).block(block);
|
||||
let inner_block = Block::default()
|
||||
.borders(Borders::NONE)
|
||||
.style(Style::default().bold())
|
||||
.title("Progress")
|
||||
.title_alignment(Alignment::Center);
|
||||
let inner = outer_block.inner(area);
|
||||
let body = Paragraph::new(body_text).block(inner_block);
|
||||
frame.render_widget(Clear, area);
|
||||
frame.render_widget(body, area);
|
||||
frame.render_widget(outer_block, area);
|
||||
frame.render_widget(body, inner);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ impl Component for Results {
|
|||
}
|
||||
Action::SetMode(mode) => {
|
||||
self.show = mode == Mode::BootDiags;
|
||||
self.key_index = 0;
|
||||
self.line_index = 0;
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
|
|
@ -91,6 +93,7 @@ impl Component for Results {
|
|||
}
|
||||
|
||||
fn draw(&mut self, frame: &mut Frame, rect: Rect) -> Result<()> {
|
||||
return Ok(());
|
||||
if !self.show {
|
||||
return Ok(());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@ impl Groups {
|
|||
lines
|
||||
}
|
||||
|
||||
pub fn reset(&mut self) {
|
||||
self.items.clear();
|
||||
self.order.clear();
|
||||
}
|
||||
|
||||
pub fn start(&mut self, title: String) {
|
||||
self.order.push(title.clone());
|
||||
self.items.insert(
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@
|
|||
"<Left>": "KeyLeft",
|
||||
"<Right>": "KeyRight",
|
||||
"<r>": "BootScan",
|
||||
"<s>": "ScanDisks",
|
||||
"<q>": "Quit",
|
||||
"<Ctrl-d>": "Quit",
|
||||
"<Ctrl-c>": "Quit",
|
||||
|
|
|
|||
Loading…
Reference in a new issue