[pve-devel] [PATCH installer 1/2] tui: wrap multi-disk selection in scrollable view

Christoph Heiss c.heiss at proxmox.com
Thu Jun 22 11:56:16 CEST 2023


If lots of disks are present and the available screen size is rather
small, it might be impossible for users to properly set all disks as
they want.

Fix it by making the view scrollable.

Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
 proxmox-tui-installer/src/views/bootdisk.rs | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/proxmox-tui-installer/src/views/bootdisk.rs b/proxmox-tui-installer/src/views/bootdisk.rs
index 09e6803..775ffa4 100644
--- a/proxmox-tui-installer/src/views/bootdisk.rs
+++ b/proxmox-tui-installer/src/views/bootdisk.rs
@@ -2,7 +2,9 @@ use std::{cell::RefCell, marker::PhantomData, rc::Rc};
 
 use cursive::{
     view::{Nameable, Resizable, ViewWrapper},
-    views::{Button, Dialog, DummyView, LinearLayout, NamedView, Panel, SelectView, TextView},
+    views::{
+        Button, Dialog, DummyView, LinearLayout, NamedView, Panel, ScrollView, SelectView, TextView,
+    },
     Cursive, View,
 };
 
@@ -268,7 +270,7 @@ impl<T: View> MultiDiskOptionsView<T> {
         let disk_select_view = LinearLayout::vertical()
             .child(TextView::new("Disk setup").center())
             .child(DummyView)
-            .child(disk_form);
+            .child(ScrollView::new(disk_form));
 
         let options_view = LinearLayout::vertical()
             .child(TextView::new("Advanced options").center())
@@ -306,7 +308,8 @@ impl<T: View> MultiDiskOptionsView<T> {
             .get_child(0)?
             .downcast_ref::<LinearLayout>()?
             .get_child(2)?
-            .downcast_ref::<FormView>()?;
+            .downcast_ref::<ScrollView<FormView>>()?
+            .get_inner();
 
         for i in 0..disk_form.len() {
             let disk = disk_form.get_value::<SelectView<Option<Disk>>, _>(i)?;
-- 
2.40.1






More information about the pve-devel mailing list