From d812099df3d060ae74cd3d28405ddacbdd72ab15 Mon Sep 17 00:00:00 2001 From: Artem Chernyshev Date: Wed, 31 Mar 2021 01:01:43 +0300 Subject: [PATCH] fix: address several issues in TUI installer - Table row selection was 1 element off, so disk selector wasn't quite working. - Reduce amount of interfaces on the last screen: show only ones that have physical addresses (changing some settings for lo0 for example was making TUI generate incorrect configs) Signed-off-by: Artem Chernyshev --- internal/pkg/tui/components/form.go | 2 +- internal/pkg/tui/installer/state.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/pkg/tui/components/form.go b/internal/pkg/tui/components/form.go index 54b9fb3d6c..3135ad9233 100644 --- a/internal/pkg/tui/components/form.go +++ b/internal/pkg/tui/components/form.go @@ -138,7 +138,7 @@ func (item *Item) createFormItems() ([]tview.Primitive, error) { formItem = table table.SetRowSelectedFunc(func(row int) { - v.Set(reflect.ValueOf(table.GetValue(row, 0))) // always pick the first column + v.Set(reflect.ValueOf(table.GetValue(row-1, 0))) // always pick the second column }) } else { dropdown := tview.NewDropDown() diff --git a/internal/pkg/tui/installer/state.go b/internal/pkg/tui/installer/state.go index c486f11acb..fe99cc0b3c 100644 --- a/internal/pkg/tui/installer/state.go +++ b/internal/pkg/tui/installer/state.go @@ -125,6 +125,10 @@ func NewState(ctx context.Context, installer *Installer, conn *Connection) (*Sta for _, iface := range interfaces.Messages[0].Interfaces { status := "" + if (net.Flags(iface.Flags)&net.FlagLoopback) != 0 || iface.Hardwareaddr == "" { + continue + } + if (net.Flags(iface.Flags) & net.FlagUp) != 0 { status = " (UP)" } @@ -305,6 +309,10 @@ func configureAdapter(installer *Installer, opts *machineapi.GenerateConfigurati adapterConfiguration.AddMenuButton("Apply", false).SetSelectedFunc(func() { goBack() + if adapterSettings.Dhcp { + adapterSettings.Cidr = "" + } + if deviceIndex == -1 { opts.MachineConfig.NetworkConfig.Interfaces = append( opts.MachineConfig.NetworkConfig.Interfaces,