[pve-devel] [RFC installer] fix weird behavior with hdsel screen

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Jan 25 15:50:09 CET 2019


On 1/24/19 2:31 PM, Oguz Bektas wrote:
> * we don't want the hd select combobox to show up when user goes back
> after choosing raid during initial setup
> 
> * fix the problem where the chosen disk is not displayed correctly in
> the acknowledgement screen

as discussed offline, once you start making bullet points for what you do
in a commit you really should think about splitting it up. IMO even the
typo fix should be on it's own.

But works, and looks OK.

> 
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
>  proxinstall | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/proxinstall b/proxinstall
> index 3c37239..000be0d 100755
> --- a/proxinstall
> +++ b/proxinstall
> @@ -2555,7 +2555,7 @@ sub create_country_view {
>  my $target_hd_combo;
>  my $target_hd_label;
>  
> -my $hdopion_first_setup = 1;
> +my $hdoption_first_setup = 1;
>  
>  my $create_basic_grid = sub {
>      my $grid =  Gtk3::Grid->new();
> @@ -2611,7 +2611,7 @@ my $create_raid_disk_grid = sub {
>  	    });
>  	}
>  
> -	if ($hdopion_first_setup) {
> +	if ($hdoption_first_setup) {
>  	    $disk_selector->set_active ($i+1) if $hds->[$i];
>  	} else {
>  	    my $hdind = 0;
> @@ -2834,7 +2834,7 @@ sub create_hdoption_view {
>      $grid->attach($options_stack, 0, $row, 2, 1);
>      $row++;
>  
> -    $hdopion_first_setup = 0;
> +    $hdoption_first_setup = 0;
>  
>      my $switch_view = sub {
>  	my $raid = $config_options->{filesys} =~ m/zfs|btrfs/;
> @@ -3043,7 +3043,7 @@ sub create_hdsel_view {
>      $vbox->pack_start($hbox, 0, 0, 10);
>  
>      my ($disk, $devname, $size, $model) = @{@$hds[0]};
> -    $target_hd = $devname;
> +    $target_hd = $devname if !defined($target_hd);

Just FYI, you could also do:

$target_hd //= $devname;

but I'm happy with both.

>  
>      $target_hd_label = Gtk3::Label->new("Target Harddisk: ");
>      $hbox->pack_start($target_hd_label, 0, 0, 0);
> @@ -3055,9 +3055,16 @@ sub create_hdsel_view {
>  	$target_hd_combo->append_text (get_device_desc($devname, $size, $model));
>      }
>  
> -    $target_hd_combo->set_active(0);
> +    my $raid = $config_options->{filesys} =~ m/zfs|btrfs/;
> +    if ($raid) {
> +	$target_hd_label->set_text("Target: $config_options->{filesys} ");
> +	$target_hd_combo->set_visible(0);
> +	$target_hd_combo->set_no_show_all(1);
> +    }
> +    $target_hd_combo->set_active($config_options->{chosen_hd} // 0);
>      $target_hd_combo->signal_connect(changed => sub {
>  	$a = shift->get_active;
> +	$config_options->{chosen_hd} = $a;
>  	my ($disk, $devname) = @{@$hds[$a]};
>  	$target_hd = $devname;
>      });
> 





More information about the pve-devel mailing list