From 29cb5564c2044bb7f82868db4fe0feec88ffb7a1 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 29 Feb 2024 17:36:45 -0600 Subject: [PATCH] tinkering Signed-off-by: Jeff Carr --- droplet.go | 28 +++++++++++++++++++++++++++- structs.go | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 structs.go diff --git a/droplet.go b/droplet.go index 878a64f..243e241 100644 --- a/droplet.go +++ b/droplet.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "io" "go.wit.com/gui" ) @@ -12,8 +13,23 @@ type Size interface { Disk() float64 } +type SquareBox struct { + Width float64 + Height float64 +} + +type MenuNode struct { + Name string + Box *gui.Node +} + +func (s MenuNode) Area() float64 { + return 20 +} + type Menu interface { Widget() *gui.Node + SetMenu(*gui.Node) } type Draw interface { @@ -22,9 +38,19 @@ type Draw interface { } type Droplet interface { + Box() *DropletBox Draw - Menu + SetMenu(*DropletBox) Size + PowerOn() error + PowerOff() (bool, error) + Connect() // Location fmt.Stringer + io.Writer +} + +func addMenu(d Droplet) { + d.Show() + // d.Menu.Widget() = gui.RawBox() } diff --git a/structs.go b/structs.go new file mode 100644 index 0000000..ddf931b --- /dev/null +++ b/structs.go @@ -0,0 +1,38 @@ +/* + The DropletBox Struct +*/ + +package main + +import ( + "github.com/digitalocean/godo" + + "go.wit.com/gui" +) + +type DropletBox struct { + ID int + image string + memory int + disk int + + ready bool + hidden bool + err error + + poll *godo.Droplet // store what the digital ocean API returned + + nameN *gui.Node + sizeSlugN *gui.Node + statusN *gui.Node + imageN *gui.Node + + destroy *gui.Node + connect *gui.Node + poweron *gui.Node + poweroff *gui.Node + edit *gui.Node + + ipv4 *gui.Node + ipv6 *gui.Node +}