@@ -115,6 +115,14 @@ pub struct MountListRow {
115115 pub default_mount: String,
116116}
117117
118+#[derive(Debug, Clone)]
119+pub struct NetworkListRow {
120+ pub network_type: String,
121+ pub vm_ip: String,
122+ pub host_to_vm: String,
123+ pub vm_to_host: String,
124+}
125+
118126#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
119127struct PageLayout {
120128 header: Rect,
@@ -253,6 +261,65 @@ pub fn render_mounts_table(rows: &[MountListRow]) -> Result<()> {
253261 let mut buffer = Buffer::empty(Rect::new(0, 0, width, height));
254262 let area = Rect::new(0, 0, width, height);
255263
264+ render_mounts_table_into(rows, area, &mut buffer);
265+
266+ let mut stdout = io::stdout();
267+ execute!(stdout, Clear(ClearType::All), MoveTo(0, 0), Show)?;
268+ write_buffer_with_style(&buffer, &mut stdout)?;
269+ stdout.flush()?;
270+ Ok(())
271+}
272+
273+pub fn render_explain_tables(mounts: &[MountListRow], networks: &[NetworkListRow]) -> Result<()> {
274+ let (width, _) = crossterm::terminal::size()?;
275+ if width == 0 {
276+ return Ok(());
277+ }
278+
279+ let mounts_height = if mounts.is_empty() {
280+ 0
281+ } else {
282+ (mounts.len() as u16).saturating_add(3)
283+ };
284+ let networks_height = if networks.is_empty() {
285+ 0
286+ } else {
287+ (networks.len() as u16).saturating_add(3)
288+ };
289+ let gap = if mounts_height > 0 && networks_height > 0 {
290+ 1
291+ } else {
292+ 0
293+ };
294+ let total_height = mounts_height
295+ .saturating_add(gap)
296+ .saturating_add(networks_height);
297+ if total_height == 0 {
298+ return Ok(());
299+ }
300+
301+ let mut buffer = Buffer::empty(Rect::new(0, 0, width, total_height));
302+ let mut y = 0u16;
303+
304+ if mounts_height > 0 {
305+ let area = Rect::new(0, y, width, mounts_height);
306+ render_mounts_table_into(mounts, area, &mut buffer);
307+ y = y.saturating_add(mounts_height).saturating_add(gap);
308+ }
309+
310+ if networks_height > 0 {
311+ let area = Rect::new(0, y, width, networks_height);
312+ render_networks_table_into(networks, area, &mut buffer);
313+ }
314+
315+ let mut stdout = io::stdout();
316+ execute!(stdout, Clear(ClearType::All), MoveTo(0, 0), Show)?;
317+ write_buffer_with_style(&buffer, &mut stdout)?;
318+ stdout.flush()?;
319+ Ok(())
320+}
321+
322+fn render_mounts_table_into(rows: &[MountListRow], area: Rect, buffer: &mut Buffer) {
256323 let header = Row::new(vec![
257324 Cell::from("Host"),
258325 Cell::from("Guest"),
@@ -286,13 +353,41 @@ pub fn render_mounts_table(rows: &[MountListRow]) -> Result<()> {
286353 .block(Block::default().title("Mounts").borders(Borders::ALL))
287354 .column_spacing(1);
288355
289− table.render(area, &mut buffer);
356+ table.render(area, buffer);
357+}
290358
291− let mut stdout = io::stdout();
292− execute!(stdout, Clear(ClearType::All), MoveTo(0, 0), Show)?;
293− write_buffer_with_style(&buffer, &mut stdout)?;
294− stdout.flush()?;
295− Ok(())
359+fn render_networks_table_into(rows: &[NetworkListRow], area: Rect, buffer: &mut Buffer) {
360+ let header = Row::new(vec![
361+ Cell::from("Type"),
362+ Cell::from("VM IP"),
363+ Cell::from("Host \u{2192} VM"),
364+ Cell::from("VM \u{2192} Host"),
365+ ])
366+ .style(Style::default().fg(Color::Cyan));
367+
368+ let table_rows = rows.iter().map(|row| {
369+ Row::new(vec![
370+ Cell::from(row.network_type.clone()),
371+ Cell::from(row.vm_ip.clone()),
372+ Cell::from(row.host_to_vm.clone()),
373+ Cell::from(row.vm_to_host.clone()),
374+ ])
375+ });
376+
377+ let table = Table::new(
378+ table_rows,
379+ [
380+ Constraint::Length(8),
381+ Constraint::Length(16),
382+ Constraint::Min(24),
383+ Constraint::Min(20),
384+ ],
385+ )
386+ .header(header)
387+ .block(Block::default().title("Network").borders(Borders::ALL))
388+ .column_spacing(1);
389+
390+ table.render(area, buffer);
296391}
297392
298393pub fn passthrough_vm_io(