From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 70FA81FF398 for ; Mon, 13 May 2024 14:14:36 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B1EF414FF8; Mon, 13 May 2024 14:14:39 +0200 (CEST) From: Christoph Heiss To: pve-devel@lists.proxmox.com Date: Mon, 13 May 2024 14:13:53 +0200 Message-ID: <20240513121357.1270503-5-c.heiss@proxmox.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240513121357.1270503-1-c.heiss@proxmox.com> References: <20240513121357.1270503-1-c.heiss@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.005 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH installer 4/6] fix #5250: tui: expose new btrfs `compress` option X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Signed-off-by: Christoph Heiss --- proxmox-tui-installer/src/views/bootdisk.rs | 34 +++++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/proxmox-tui-installer/src/views/bootdisk.rs b/proxmox-tui-installer/src/views/bootdisk.rs index 107fc9c..7a34d63 100644 --- a/proxmox-tui-installer/src/views/bootdisk.rs +++ b/proxmox-tui-installer/src/views/bootdisk.rs @@ -19,8 +19,9 @@ use proxmox_installer_common::{ check_zfs_raid_config, }, options::{ - AdvancedBootdiskOptions, BootdiskOptions, BtrfsBootdiskOptions, BtrfsCompressOption, Disk, - FsType, LvmBootdiskOptions, ZfsBootdiskOptions, ZFS_CHECKSUM_OPTIONS, ZFS_COMPRESS_OPTIONS, + AdvancedBootdiskOptions, BootdiskOptions, BtrfsBootdiskOptions, Disk, FsType, + LvmBootdiskOptions, ZfsBootdiskOptions, BTRFS_COMPRESS_OPTIONS, ZFS_CHECKSUM_OPTIONS, + ZFS_COMPRESS_OPTIONS, }, setup::{BootType, ProductConfig, ProxmoxProduct, RuntimeInfo}, }; @@ -521,12 +522,23 @@ struct BtrfsBootdiskOptionsView { impl BtrfsBootdiskOptionsView { fn new(disks: &[Disk], options: &BtrfsBootdiskOptions) -> Self { - let view = MultiDiskOptionsView::new( - disks, - &options.selected_disks, - FormView::new().child("hdsize", DiskSizeEditView::new().content(options.disk_size)), - ) - .top_panel(TextView::new("Btrfs integration is a technology preview!").center()); + let inner = FormView::new() + .child( + "compress", + SelectView::new() + .popup() + .with_all(BTRFS_COMPRESS_OPTIONS.iter().map(|o| (o.to_string(), *o))) + .selected( + BTRFS_COMPRESS_OPTIONS + .iter() + .position(|o| *o == options.compress) + .unwrap_or_default(), + ), + ) + .child("hdsize", DiskSizeEditView::new().content(options.disk_size)); + + let view = MultiDiskOptionsView::new(disks, &options.selected_disks, inner) + .top_panel(TextView::new("Btrfs integration is a technology preview!").center()); Self { view } } @@ -537,14 +549,16 @@ impl BtrfsBootdiskOptionsView { fn get_values(&mut self) -> Option<(Vec, BtrfsBootdiskOptions)> { let (disks, selected_disks) = self.view.get_disks_and_selection()?; - let disk_size = self.view.inner_mut()?.get_value::(0)?; + let view = self.view.inner_mut()?; + let disk_size = view.get_value::(1)?; + let compress = view.get_value::, _>(0)?; Some(( disks, BtrfsBootdiskOptions { disk_size, selected_disks, - compress: BtrfsCompressOption::default(), + compress, }, )) } -- 2.44.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel