Skip to content

Commit

Permalink
fix: address several issues in TUI installer
Browse files Browse the repository at this point in the history
- 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 <artem.0xD2@gmail.com>
  • Loading branch information
Unix4ever authored and talos-bot committed Mar 31, 2021
1 parent 269c9ad commit d812099
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/pkg/tui/components/form.go
Expand Up @@ -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()
Expand Down
8 changes: 8 additions & 0 deletions internal/pkg/tui/installer/state.go
Expand Up @@ -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)"
}
Expand Down Expand 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,
Expand Down

0 comments on commit d812099

Please sign in to comment.