diff options
| author | Jeff Carr <[email protected]> | 2024-01-05 09:38:20 -0600 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-05 09:38:20 -0600 | 
| commit | 14419ebfd7361969b1cdc5a732d6d4699727a104 (patch) | |
| tree | 0ba9a302408901009ec6d37a83ea6f4e0b26b714 | |
| parent | c68e530e768855efc74e556e3799e005a1306861 (diff) | |
use gadgets.BasicWindow()
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | loadZoneWindow.go | 6 | ||||
| -rw-r--r-- | mainWindow.go | 21 | ||||
| -rw-r--r-- | rr.go | 10 | ||||
| -rw-r--r-- | structs.go | 5 | 
4 files changed, 16 insertions, 26 deletions
diff --git a/loadZoneWindow.go b/loadZoneWindow.go index 56f65d8..8f4f721 100644 --- a/loadZoneWindow.go +++ b/loadZoneWindow.go @@ -6,6 +6,7 @@ import 	(  	"strconv"  	"go.wit.com/gui/gui" +	"go.wit.com/gui/gadgets"  )  func LoadZoneWindow(n *gui.Node, c *ConfigT) { @@ -13,9 +14,8 @@ func LoadZoneWindow(n *gui.Node, c *ConfigT) {  	zoneID := c.ZoneID  	log.Println("adding DNS record", hostname) -	newt := n.NewTab(hostname) -	vb := newt.NewBox("vBox", false) -	newg := vb.NewGroup("more zoneID = " + zoneID) +	newW := gadgets.NewBasicWindow(n, hostname) +	newg := newW.Box().NewGroup("more zoneID = " + zoneID)  	// make a grid 6 things wide  	grid := newg.NewGrid("gridnuts", 6, 1) diff --git a/mainWindow.go b/mainWindow.go index 5903d4c..7d19e1c 100644 --- a/mainWindow.go +++ b/mainWindow.go @@ -10,20 +10,18 @@ import 	(  )  // This creates a window -func MakeCloudflareWindow(n *gui.Node) *gui.Node { +func MakeCloudflareWindow(n *gui.Node) *gadgets.BasicWindow {  	CFdialog.rootGui = n -	var t *gui.Node  	log.Println("buttonWindow() START") -	CFdialog.mainWindow = n.NewWindow("Cloudflare Config") +	CFdialog.mainWindow = gadgets.NewBasicWindow(n,"Cloudflare Config")  	// this tab has the master cloudflare API credentials -	makeConfigWindow(CFdialog.mainWindow) +	makeConfigWindow(CFdialog.mainWindow.Box()) -	t = CFdialog.mainWindow.NewTab("Zones") -	vb := t.NewBox("vBox", false) -	g1 := vb.NewGroup("zones") +	win := gadgets.NewBasicWindow(n,"Zones") +	g1 := win.Box().NewGroup("zones")  	// make dropdown list of zones  	CFdialog.zonedrop = g1.NewDropdown("zone") @@ -54,13 +52,10 @@ func MakeCloudflareWindow(n *gui.Node) *gui.Node {  	more := g1.NewGroup("data")  	showCloudflareCredentials(more) -	// makeDebugWindow(CFdialog.mainWindow)  	return CFdialog.mainWindow  } -func makeConfigWindow(n *gui.Node) { -	t := n.NewTab("Get Zones") -	vb := t.NewBox("vBox", false) +func makeConfigWindow(vb *gui.Node) {  	g1 := vb.NewGroup("Cloudflare API Config")  	g1.NewLabel("If you have an API key with access to list all of /n your zone files, enter it here. \n \n Alternatively, you can set the enviroment variables: \n env $CF_API_KEY \n env $CF_API_EMAIL\n") @@ -106,8 +101,6 @@ func makeConfigWindow(n *gui.Node) {  		CreateRR(CFdialog.rootGui, "wit.com", "3777302ac4a78cd7fa4f6d3f72086d06")  	}) -	t.Pad() -	t.Margin()  	vb.Pad()  	vb.Margin()  	g1.Pad() @@ -142,6 +135,6 @@ func showCloudflareCredentials(box *gui.Node) {  		domain.ZoneID = CFdialog.zoneWidget.S  		domain.Auth = CFdialog.authWidget.S  		domain.Email = CFdialog.emailWidget.S -		LoadZoneWindow(CFdialog.mainWindow, &domain) +		LoadZoneWindow(CFdialog.mainWindow.Box(), &domain)  	})  } @@ -11,6 +11,7 @@ import 	(  	"os"  	"go.wit.com/gui/gui" +	"go.wit.com/gui/gadgets"  )  func init() { @@ -24,14 +25,9 @@ func CreateRR(myGui *gui.Node, zone string, zoneID string) {  		CFdialog.cloudflareB.Disable()  		return  	} -	CFdialog.cloudflareW = myGui.NewWindow("cloudflare " + zone + " API") -	CFdialog.cloudflareW.Custom = func () { -		log.Println("createRR() don't really exit here") -		CFdialog.cloudflareW = nil -		CFdialog.cloudflareB.Enable() -	} +	CFdialog.cloudflareW = gadgets.NewBasicWindow(myGui, "cloudflare " + zone + " API") -	group := CFdialog.cloudflareW.NewGroup("Create a new DNS Resource Record (rr)") +	group := CFdialog.cloudflareW.Box().NewGroup("Create a new DNS Resource Record (rr)")  	// make a grid 2 things wide  	grid := group.NewGrid("gridnuts", 2, 3) @@ -3,6 +3,7 @@ package cloudflare  import 	(  	"go.wit.com/gui/gui" +	"go.wit.com/gui/gadgets"  )  var cloudflareURL string = "https://api.cloudflare.com/client/v4/zones/" @@ -27,7 +28,7 @@ var CFdialog dialogT  type dialogT struct {  	rootGui *gui.Node	// the root node -	mainWindow *gui.Node	// the window node +	mainWindow *gadgets.BasicWindow	// the window node  	zonedrop *gui.Node	// the drop down menu of zones  	domainWidget *gui.Node @@ -38,7 +39,7 @@ type dialogT struct {  	loadButton *gui.Node  	saveButton *gui.Node -	cloudflareW *gui.Node	// the window node +	cloudflareW *gadgets.BasicWindow	// the window node  	cloudflareB *gui.Node	// the cloudflare button  	TypeNode *gui.Node	// CNAME, A, AAAA, ...  | 
