parent
8de0a3092e
commit
868968db32
56
create.go
56
create.go
|
@ -131,7 +131,7 @@ func InitCreateWindow() *windowCreate {
|
|||
myCreate.group = myCreate.window.NewGroup("droplets:").Pad()
|
||||
myCreate.grid = myCreate.group.NewGrid("grid", 2, 1).Pad()
|
||||
|
||||
myCreate.name = gadgets.NewBasicEntry(myCreate.grid, "Name").Set("test.wit.com")
|
||||
myCreate.name = gadgets.NewBasicEntry(myCreate.grid, "Name").SetText("test.wit.com")
|
||||
|
||||
myCreate.region = gadgets.NewBasicDropdown(myCreate.grid, "Region")
|
||||
|
||||
|
@ -149,12 +149,12 @@ func InitCreateWindow() *windowCreate {
|
|||
if myCreate.regionSlug == "" {
|
||||
myCreate.regionSlug = region.Slug
|
||||
}
|
||||
myCreate.region.Add(s)
|
||||
myCreate.region.AddText(s)
|
||||
}
|
||||
}
|
||||
|
||||
myCreate.region.Custom = func() {
|
||||
s := myCreate.region.Get()
|
||||
s := myCreate.region.String()
|
||||
log.Info("create droplet region changed to:", s)
|
||||
for _, region := range regions {
|
||||
if s == region.Name {
|
||||
|
@ -169,27 +169,27 @@ func InitCreateWindow() *windowCreate {
|
|||
}
|
||||
|
||||
myCreate.size = gadgets.NewBasicCombobox(myCreate.grid, "Size")
|
||||
myCreate.size.Add("s-1vcpu-1gb")
|
||||
myCreate.size.Add("s-1vcpu-1gb-amd")
|
||||
myCreate.size.Add("s-1vcpu-1gb-intel")
|
||||
myCreate.size.Add("s-2vcpu-4gb-120gb-intel")
|
||||
myCreate.size.Set("s-2vcpu-4gb-120gb-intel")
|
||||
myCreate.size.AddText("s-1vcpu-1gb")
|
||||
myCreate.size.AddText("s-1vcpu-1gb-amd")
|
||||
myCreate.size.AddText("s-1vcpu-1gb-intel")
|
||||
myCreate.size.AddText("s-2vcpu-4gb-120gb-intel")
|
||||
myCreate.size.SetText("s-2vcpu-4gb-120gb-intel")
|
||||
myCreate.size.Custom = func() {
|
||||
size := myCreate.size.Get()
|
||||
size := myCreate.size.String()
|
||||
log.Info("Create() need to verify size exists in region. Digital Ocean size.Slug =", size)
|
||||
}
|
||||
|
||||
myCreate.memory = gadgets.NewBasicDropdown(myCreate.grid, "Memory")
|
||||
myCreate.memory.Add("1 GB")
|
||||
myCreate.memory.Add("2 GB")
|
||||
myCreate.memory.Add("4 GB")
|
||||
myCreate.memory.Add("8 GB")
|
||||
myCreate.memory.Add("16 GB")
|
||||
myCreate.memory.Add("32 GB")
|
||||
myCreate.memory.Add("64 GB")
|
||||
myCreate.memory.Add("96 GB")
|
||||
myCreate.memory.Add("128 GB")
|
||||
myCreate.memory.Add("256 GB")
|
||||
myCreate.memory.AddText("1 GB")
|
||||
myCreate.memory.AddText("2 GB")
|
||||
myCreate.memory.AddText("4 GB")
|
||||
myCreate.memory.AddText("8 GB")
|
||||
myCreate.memory.AddText("16 GB")
|
||||
myCreate.memory.AddText("32 GB")
|
||||
myCreate.memory.AddText("64 GB")
|
||||
myCreate.memory.AddText("96 GB")
|
||||
myCreate.memory.AddText("128 GB")
|
||||
myCreate.memory.AddText("256 GB")
|
||||
myCreate.memory.Custom = func() {
|
||||
for _, size := range myCreate.regionSelected.Sizes {
|
||||
log.Info("Size: ", size)
|
||||
|
@ -198,9 +198,9 @@ func InitCreateWindow() *windowCreate {
|
|||
}
|
||||
|
||||
myCreate.image = gadgets.NewBasicCombobox(myCreate.grid, "Image")
|
||||
myCreate.image.Add("debian-12-x64")
|
||||
myCreate.image.Add("ubuntu-20-04-x64")
|
||||
myCreate.image.Set("debian-12-x64")
|
||||
myCreate.image.AddText("debian-12-x64")
|
||||
myCreate.image.AddText("ubuntu-20-04-x64")
|
||||
myCreate.image.SetText("debian-12-x64")
|
||||
|
||||
// myCreate.nvme = gadgets.NewBasicCheckbox(myCreate.grid, "NVMe")
|
||||
|
||||
|
@ -212,10 +212,10 @@ func InitCreateWindow() *windowCreate {
|
|||
myCreate.Hide()
|
||||
})
|
||||
box.NewButton("Create", func() {
|
||||
name := myCreate.name.Get()
|
||||
size := myCreate.size.Get()
|
||||
name := myCreate.name.String()
|
||||
size := myCreate.size.String()
|
||||
region := myCreate.regionSlug
|
||||
image := myCreate.image.Get()
|
||||
image := myCreate.image.String()
|
||||
if region == "" {
|
||||
log.Info("Create() droplet name =", name, "region =", region, "size =", size, "image", image)
|
||||
log.Info("Create() region lookup failed")
|
||||
|
@ -238,7 +238,7 @@ func (d *windowCreate) UpdateSize() {
|
|||
}
|
||||
log.Info("Now find the size. sizes count =", len(myCreate.regionSelected.Sizes))
|
||||
var s string
|
||||
m := myCreate.memory.Get()
|
||||
m := myCreate.memory.String()
|
||||
switch m {
|
||||
case "1 GB":
|
||||
s = "cpu-1gb-"
|
||||
|
@ -266,11 +266,11 @@ func (d *windowCreate) UpdateSize() {
|
|||
for _, size := range myCreate.regionSelected.Sizes {
|
||||
if strings.Contains(size, s) {
|
||||
log.Info("Found Size! size.Slug =", size, "contains", s)
|
||||
myCreate.size.Set(size)
|
||||
myCreate.size.SetText(size)
|
||||
return
|
||||
}
|
||||
}
|
||||
log.Info("memory =", myCreate.memory.Get())
|
||||
log.Info("memory =", myCreate.memory.String())
|
||||
}
|
||||
|
||||
// Returns true if the status is valid
|
||||
|
|
24
droplet.go
24
droplet.go
|
@ -87,8 +87,8 @@ func (d *Droplet) Active() bool {
|
|||
if !d.Ready() {
|
||||
return false
|
||||
}
|
||||
log.Log(POLL, "droplet.Active() status: ", d.poll.Status, "d.statusN.GetText() =", d.statusN.GetText())
|
||||
if d.statusN.GetText() == "active" {
|
||||
log.Log(POLL, "droplet.Active() status: ", d.poll.Status, "d.statusN.String() =", d.statusN.String())
|
||||
if d.statusN.String() == "active" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
@ -114,7 +114,7 @@ func (d *Droplet) HasIPv4() bool {
|
|||
if !d.Ready() {
|
||||
return false
|
||||
}
|
||||
if d.ipv4.GetText() == "" {
|
||||
if d.ipv4.String() == "" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -123,7 +123,7 @@ func (d *Droplet) HasIPv6() bool {
|
|||
if !d.Ready() {
|
||||
return false
|
||||
}
|
||||
if d.ipv6.GetText() == "" {
|
||||
if d.ipv6.String() == "" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -133,15 +133,15 @@ func (d *Droplet) GetIPv4() string {
|
|||
if !d.Ready() {
|
||||
return ""
|
||||
}
|
||||
return d.ipv4.GetText()
|
||||
return d.ipv4.String()
|
||||
}
|
||||
|
||||
func (d *Droplet) GetIPv6() string {
|
||||
if !d.Ready() {
|
||||
return ""
|
||||
}
|
||||
log.Info("droplet GetIPv6 has: n.GetText()", d.ipv6.GetText())
|
||||
return d.ipv6.GetText()
|
||||
log.Info("droplet GetIPv6 has: n.String()", d.ipv6.String())
|
||||
return d.ipv6.String()
|
||||
}
|
||||
|
||||
func (d *Droplet) Connect() {
|
||||
|
@ -204,7 +204,7 @@ func (d *Droplet) Destroy() {
|
|||
if !d.Exists() {
|
||||
return
|
||||
}
|
||||
log.Info("droplet.Destroy() ID =", d.ID, "Name =", d.nameN.GetText())
|
||||
log.Info("droplet.Destroy() ID =", d.ID, "Name =", d.nameN.String())
|
||||
myDo.deleteDroplet(d)
|
||||
}
|
||||
|
||||
|
@ -276,14 +276,14 @@ func (d *Droplet) GetName() string {
|
|||
if !d.Ready() {
|
||||
return ""
|
||||
}
|
||||
return d.nameN.GetText()
|
||||
return d.nameN.String()
|
||||
}
|
||||
|
||||
func (d *Droplet) GetSize() string {
|
||||
if !d.Ready() {
|
||||
return ""
|
||||
}
|
||||
return d.sizeSlugN.GetText()
|
||||
return d.sizeSlugN.String()
|
||||
}
|
||||
|
||||
func (d *Droplet) GetMemory() string {
|
||||
|
@ -304,12 +304,12 @@ func (d *Droplet) GetImage() string {
|
|||
if !d.Ready() {
|
||||
return ""
|
||||
}
|
||||
return d.imageN.GetText()
|
||||
return d.imageN.String()
|
||||
}
|
||||
|
||||
func (d *Droplet) GetStatus() string {
|
||||
if !d.Ready() {
|
||||
return ""
|
||||
}
|
||||
return d.statusN.GetText()
|
||||
return d.statusN.String()
|
||||
}
|
||||
|
|
8
go.mod
8
go.mod
|
@ -5,9 +5,9 @@ go 1.21.4
|
|||
require (
|
||||
github.com/digitalocean/godo v1.108.0
|
||||
go.wit.com/dev/alexflint/arg v1.4.5
|
||||
go.wit.com/gui v0.13.11
|
||||
go.wit.com/lib/gadgets v0.13.0
|
||||
go.wit.com/log v0.5.6
|
||||
go.wit.com/gui v0.13.18
|
||||
go.wit.com/lib/gadgets v0.13.18
|
||||
go.wit.com/log v0.13.18
|
||||
golang.org/x/oauth2 v0.16.0
|
||||
)
|
||||
|
||||
|
@ -18,7 +18,7 @@ require (
|
|||
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
|
||||
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
|
||||
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
|
||||
go.wit.com/widget v1.1.6 // indirect
|
||||
go.wit.com/widget v1.1.9 // indirect
|
||||
golang.org/x/net v0.20.0 // indirect
|
||||
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
|
|
16
go.sum
16
go.sum
|
@ -29,14 +29,14 @@ go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26
|
|||
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
|
||||
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
|
||||
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
|
||||
go.wit.com/gui v0.13.11 h1:d74Ko/XFZYR25P/AZfCQaVO2CuGh1BSjdUp1wjktdDg=
|
||||
go.wit.com/gui v0.13.11/go.mod h1:v2VgnOL3dlZ13KclYeedZ1cd20nQdvwjyJTNKvFX3DA=
|
||||
go.wit.com/lib/gadgets v0.13.0 h1:jtsEnf4DHqAxBxuYsaDlHti73rgaxYf/ffAXNB1PJAk=
|
||||
go.wit.com/lib/gadgets v0.13.0/go.mod h1:xidaHAL6Nk9+M9FkySVU1AG5i39v7T3PuFphUos6LxE=
|
||||
go.wit.com/log v0.5.6 h1:rDC3ju95zfEads4f1Zm+QMkqjZ39CsYAT/UmQQs7VP4=
|
||||
go.wit.com/log v0.5.6/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
|
||||
go.wit.com/widget v1.1.6 h1:av2miF5vlohMfARA/QGPTPfgW/ADup1c+oeAOKgroPY=
|
||||
go.wit.com/widget v1.1.6/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=
|
||||
go.wit.com/gui v0.13.18 h1:r4z1FNg6AxGWfq13+na4Xu/uA8PTTtDGka0ajo29omk=
|
||||
go.wit.com/gui v0.13.18/go.mod h1:SRcfZKSbBWUxyyDiqlISWEYySoeATnijVxhzRIF0xiE=
|
||||
go.wit.com/lib/gadgets v0.13.18 h1:Z35WCI6BtRamRkLTWaUP5/9+BnOGGbRdnD95SnnM6Tw=
|
||||
go.wit.com/lib/gadgets v0.13.18/go.mod h1:hU0cXWfyvBrxmKD37MLyjOfJRK4+cU1aJ6lLx1CM0Qo=
|
||||
go.wit.com/log v0.13.18 h1:XJNaQWX+8m12p3mH+kYih3zNjb0kScZDFpJa4c2TvKE=
|
||||
go.wit.com/log v0.13.18/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
|
||||
go.wit.com/widget v1.1.9 h1:iltjAL8UZu0YPfia8/qyfDx04BDxhj8rURcx0OHVBEc=
|
||||
go.wit.com/widget v1.1.9/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
|
||||
|
|
Loading…
Reference in New Issue