added build tag for gui

This commit is contained in:
0xdcarns
2022-05-05 11:11:37 -04:00
parent 7a1b719a91
commit 81ab4f76bb
5 changed files with 36 additions and 22 deletions

View File

@@ -1,7 +1,11 @@
//go:build gui
// +build gui
package gui
import (
"embed"
"fmt"
"image/color"
"fyne.io/fyne/v2"
@@ -10,6 +14,7 @@ import (
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"github.com/gravitl/netmaker/logger"
"github.com/gravitl/netmaker/netclient/config"
"github.com/gravitl/netmaker/netclient/functions"
"github.com/gravitl/netmaker/netclient/gui/components"
"github.com/gravitl/netmaker/netclient/gui/components/views"
@@ -19,6 +24,20 @@ import (
//go:embed nm-logo-sm.png
var logoContent embed.FS
func init() {
fmt.Println("got in here")
config.GuiActive = true
config.GuiRun = func() {
networks, err := ncutils.GetSystemNetworks()
if err != nil {
networks = []string{}
}
Run(networks)
}
}
// Run - run's the netclient GUI
func Run(networks []string) error {
a := app.New()
window := a.NewWindow("Netclient")
@@ -69,9 +88,6 @@ func Run(networks []string) error {
})
views.RefreshComponent(views.Confirm, confirmView)
views.ShowView(views.Confirm)
// TODO:
// - call uninstall
// - Refresh networks view when finished
}, components.Red_color),
))