diff --git a/gui.go b/gui.go index 6c6e7b1..63a9406 100644 --- a/gui.go +++ b/gui.go @@ -1,10 +1,7 @@ package main import "log" -import "io/ioutil" import "fmt" -import "github.com/mitchellh/go-homedir" -import "strings" import "github.com/gookit/config" import "github.com/andlabs/ui" @@ -28,34 +25,10 @@ func hostnameButton(hostname string) ui.Control { tmpButton := ui.NewButton(hostname) tmpbox.Append(tmpButton, false) tmpButton.OnClicked(buttonClick) -/* - tmpButton.OnClicked(func(*ui.Button) { - log.Println("hostname =", config.String("hostname"), tmpButton) - }) -*/ + return tmpbox } -func getPhysicalMachines(machineType string) []string { - var machines []string - home, _ := homedir.Dir() - files, err := ioutil.ReadDir(home+"/wit/ansible/inventory-usw2/host_vars/") - if err != nil { - log.Println(err) - return machines - } - - for _, f := range files { - s := strings.Split(f.Name(), ".") - if strings.HasPrefix(s[1], machineType) { - fmt.Println(f.Name(), s) - machines = append(machines, f.Name()) - } - } - return machines -} - - func makeButtonsPage(names []string) ui.Control { vbox := ui.NewVerticalBox() vbox.SetPadded(true) @@ -264,6 +237,10 @@ func setupUI() { tabcount += 1 maintab.SetMargined(tabcount, true) + maintab.Append("Group examples", makeGroupEntries()) + tabcount += 1 + maintab.SetMargined(tabcount, true) + mainwin.Show() }