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<()> {
|
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();
|
let disk_list = self.clone.disk_list.lock().unwrap();
|
||||||
if let Some(disk_index) = self.clone.disk_index_dest {
|
if let Some(disk_index) = self.clone.disk_index_dest {
|
||||||
if let Some(disk) = disk_list.get(disk_index) {
|
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));
|
chunks.push(centered_rect(60, 25, r));
|
||||||
|
|
||||||
// Progress
|
// Progress
|
||||||
chunks.push(centered_rect(60, 80, chunks[1]));
|
chunks.push(centered_rect(60, 70, r));
|
||||||
|
|
||||||
// Results
|
// Results
|
||||||
chunks.push(centered_rect(60, 80, chunks[1]));
|
chunks.push(centered_rect(60, 70, r));
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
chunks
|
chunks
|
||||||
|
|
@ -758,14 +762,13 @@ fn get_chunks(r: Rect) -> Vec<Rect> {
|
||||||
|
|
||||||
fn build_footer_string(cur_mode: Mode) -> String {
|
fn build_footer_string(cur_mode: Mode) -> String {
|
||||||
match cur_mode {
|
match cur_mode {
|
||||||
Mode::BootDiags => String::from("(r) to refresh / (q) to quit"),
|
|
||||||
Mode::BootScan | Mode::BootSetup | Mode::Home | Mode::ScanDisks => {
|
Mode::BootScan | Mode::BootSetup | Mode::Home | Mode::ScanDisks => {
|
||||||
String::from("(q) to quit")
|
String::from("(q) to quit")
|
||||||
}
|
}
|
||||||
Mode::InstallDrivers | Mode::InjectDrivers | Mode::SetBootMode => {
|
Mode::InstallDrivers | Mode::InjectDrivers | Mode::SetBootMode => {
|
||||||
String::from("(Enter) to select / (q) to quit")
|
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")
|
String::from("(Enter) to select / (s) to start over / (q) to quit")
|
||||||
}
|
}
|
||||||
Mode::Done => String::from("(Enter) to continue / (q) to quit"),
|
Mode::Done => String::from("(Enter) to continue / (q) to quit"),
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
use color_eyre::Result;
|
use color_eyre::Result;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
Frame,
|
Frame,
|
||||||
layout::Rect,
|
layout::{Alignment, Rect},
|
||||||
style::{Color, Style, Stylize},
|
style::{Color, Style, Stylize},
|
||||||
text::{Line, Span},
|
text::{Line, Span},
|
||||||
widgets::{Block, Borders, Clear, Paragraph},
|
widgets::{Block, Borders, Clear, Paragraph},
|
||||||
|
|
@ -96,7 +96,10 @@ impl Component for Progress {
|
||||||
line.running = false;
|
line.running = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Action::SetMode(mode) => self.mode = mode,
|
Action::SetMode(mode) => {
|
||||||
|
self.mode = mode;
|
||||||
|
self.lines.clear();
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
Ok(None)
|
Ok(None)
|
||||||
|
|
@ -136,12 +139,19 @@ impl Component for Progress {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Build block
|
// Build block
|
||||||
let block = Block::default()
|
let outer_block = Block::default()
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.style(Style::default().bold());
|
.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(Clear, area);
|
||||||
frame.render_widget(body, area);
|
frame.render_widget(outer_block, area);
|
||||||
|
frame.render_widget(body, inner);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,8 @@ impl Component for Results {
|
||||||
}
|
}
|
||||||
Action::SetMode(mode) => {
|
Action::SetMode(mode) => {
|
||||||
self.show = mode == Mode::BootDiags;
|
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<()> {
|
fn draw(&mut self, frame: &mut Frame, rect: Rect) -> Result<()> {
|
||||||
|
return Ok(());
|
||||||
if !self.show {
|
if !self.show {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,11 @@ impl Groups {
|
||||||
lines
|
lines
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn reset(&mut self) {
|
||||||
|
self.items.clear();
|
||||||
|
self.order.clear();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn start(&mut self, title: String) {
|
pub fn start(&mut self, title: String) {
|
||||||
self.order.push(title.clone());
|
self.order.push(title.clone());
|
||||||
self.items.insert(
|
self.items.insert(
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@
|
||||||
"<Left>": "KeyLeft",
|
"<Left>": "KeyLeft",
|
||||||
"<Right>": "KeyRight",
|
"<Right>": "KeyRight",
|
||||||
"<r>": "BootScan",
|
"<r>": "BootScan",
|
||||||
|
"<s>": "ScanDisks",
|
||||||
"<q>": "Quit",
|
"<q>": "Quit",
|
||||||
"<Ctrl-d>": "Quit",
|
"<Ctrl-d>": "Quit",
|
||||||
"<Ctrl-c>": "Quit",
|
"<Ctrl-c>": "Quit",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue