Show disk details in DiagMenu
This commit is contained in:
parent
e55a254be9
commit
710b9d7c16
1 changed files with 38 additions and 30 deletions
|
|
@ -921,36 +921,10 @@ fn build_right_items(app: &App) -> Action {
|
|||
let mut start_index = 0;
|
||||
match app.cur_mode {
|
||||
Mode::DiagMenu => {
|
||||
let mut header_lines: Vec<DVLine> = Vec::new();
|
||||
if let Some(index) = app.clone.disk_index_dest {
|
||||
let disk_list = app.clone.disk_list.lock().unwrap();
|
||||
if let Some(disk) = disk_list.get(index) {
|
||||
let mut parts: Vec<usize> = Vec::new();
|
||||
if let Some(index) = app.clone.part_index_boot {
|
||||
parts.push(index);
|
||||
}
|
||||
if let Some(index) = app.clone.part_index_os {
|
||||
parts.push(index);
|
||||
}
|
||||
// Disk Details
|
||||
header_lines.append(&mut vec![
|
||||
DVLine {
|
||||
line_parts: vec![String::from("Disk")],
|
||||
line_colors: vec![Color::Cyan],
|
||||
},
|
||||
DVLine {
|
||||
line_parts: vec![String::new()],
|
||||
line_colors: vec![Color::Reset],
|
||||
},
|
||||
]);
|
||||
header_lines.append(&mut get_disk_description_right(disk, &Some(parts)));
|
||||
|
||||
// Add header
|
||||
if !header_lines.is_empty() {
|
||||
items.push(header_lines);
|
||||
start_index += 1;
|
||||
}
|
||||
}
|
||||
let header_lines = get_disk_header(app);
|
||||
if !header_lines.is_empty() {
|
||||
items.push(header_lines);
|
||||
start_index += 1;
|
||||
}
|
||||
app.list.items.iter().for_each(|mode| {
|
||||
let (name, description) = get_mode_strings(*mode);
|
||||
|
|
@ -971,6 +945,11 @@ fn build_right_items(app: &App) -> Action {
|
|||
});
|
||||
}
|
||||
Mode::BootDiags => {
|
||||
let header_lines = get_disk_header(app);
|
||||
if !header_lines.is_empty() {
|
||||
items.push(header_lines);
|
||||
start_index += 1;
|
||||
}
|
||||
if let Ok(diag_groups) = app.diag_groups.lock() {
|
||||
let mut summary: Vec<DVLine> = Vec::new();
|
||||
diag_groups
|
||||
|
|
@ -1045,6 +1024,35 @@ fn build_right_items(app: &App) -> Action {
|
|||
Action::UpdateRight(labels, start_index, items)
|
||||
}
|
||||
|
||||
fn get_disk_header(app: &App) -> Vec<DVLine> {
|
||||
let mut header_lines: Vec<DVLine> = Vec::new();
|
||||
if let Some(index) = app.clone.disk_index_dest {
|
||||
let disk_list = app.clone.disk_list.lock().unwrap();
|
||||
if let Some(disk) = disk_list.get(index) {
|
||||
let mut parts: Vec<usize> = Vec::new();
|
||||
if let Some(index) = app.clone.part_index_boot {
|
||||
parts.push(index);
|
||||
}
|
||||
if let Some(index) = app.clone.part_index_os {
|
||||
parts.push(index);
|
||||
}
|
||||
// Disk Details
|
||||
header_lines.append(&mut vec![
|
||||
DVLine {
|
||||
line_parts: vec![String::from("Disk")],
|
||||
line_colors: vec![Color::Cyan],
|
||||
},
|
||||
DVLine {
|
||||
line_parts: vec![String::new()],
|
||||
line_colors: vec![Color::Reset],
|
||||
},
|
||||
]);
|
||||
header_lines.append(&mut get_disk_description_right(disk, &Some(parts)));
|
||||
}
|
||||
}
|
||||
header_lines
|
||||
}
|
||||
|
||||
fn get_mode_strings(mode: Mode) -> (String, String) {
|
||||
match mode {
|
||||
Mode::BootScan | Mode::BootDiags | Mode::LogView => (
|
||||
|
|
|
|||
Loading…
Reference in a new issue