return *gui.BasicWindow

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-06 21:04:31 -06:00
parent 8f34aa62f2
commit 89e740330f
2 changed files with 8 additions and 6 deletions

View File

@ -29,17 +29,17 @@ func Create(zone string, hostname string, value string) bool {
GetZones(key, email)
var z *ConfigT
for d, v := range Config {
log.Info("cloudflare.Create() zone =", d, "value =", v)
log.Log(INFO, "cloudflare.Create() zone =", d, "value =", v)
if (zone == d) {
z = Config[zone]
log.Info("cloudflare.Create() FOUND ZONE", zone, "ID =", z.ZoneID)
log.Log(INFO, "cloudflare.Create() FOUND ZONE", zone, "ID =", z.ZoneID)
}
}
if (z == nil) {
log.Warn("cloudflare.Create() COULD NOT FIND ZONE", zone)
return false
}
log.Info("cloudflare.Create() FOUND ZONE", z)
log.Log(INFO, "cloudflare.Create() FOUND ZONE", z)
// make a json record to send on port 80 to cloudflare
var data string
@ -52,6 +52,6 @@ func Create(zone string, hostname string, value string) bool {
result := doCurlCreate(key, email, z.ZoneID, data)
pretty, _ := FormatJSON(result)
log.Info("cloudflare.Create() result =", pretty)
log.Spew("cloudflare.Create() result =", pretty)
return true
}

6
rr.go
View File

@ -18,12 +18,12 @@ func init() {
Config = make(map[string]*ConfigT)
}
func CreateRR(myGui *gui.Node, zone string, zoneID string) {
func CreateRR(myGui *gui.Node, zone string, zoneID string) *gadgets.BasicWindow {
if (CFdialog.cloudflareW != nil) {
// skip this if the window has already been created
log.Warn("createRR() the cloudflare window already exists")
CFdialog.cloudflareB.Disable()
return
return CFdialog.cloudflareW
}
CFdialog.cloudflareW = gadgets.NewBasicWindow(myGui, "cloudflare " + zone + " API")
@ -149,4 +149,6 @@ func CreateRR(myGui *gui.Node, zone string, zoneID string) {
group.Pad()
grid.Pad()
grid.Expand()
return CFdialog.cloudflareW
}