sync with server

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-27 21:29:17 -07:00
parent ef198702d0
commit da7445fd2b
2 changed files with 35 additions and 1 deletions

17
cast.go Normal file
View File

@ -0,0 +1,17 @@
package main
import "fmt"
import "strconv"
import "reflect"
func pint64(a string) int64 {
i, err := strconv.ParseInt(a, 10, 64) // use base 10 for sanity
if err != nil {
fmt.Println(err)
return 0
}
fmt.Printf("The type of sixtyFour is %v \n", reflect.TypeOf(i))
return i
}

19
main.go
View File

@ -213,8 +213,25 @@ func mainMouseClick(b *gui.ButtonMap) {
log.Println("\tTRY TO ADD A NEW VIRTUAL MACHINE")
log.Println("\tTRIGGER CREATE VM")
gui.Data.State = "CREATE"
log.Println("\tTRIGGERING CREATE")
event := pb.MakeAddVmEvent()
for key, entry := range gui.Data.AllEntries {
log.Println("\tdefaultEntryChange() Data.AllEntries =", key, entry)
log.Println("\tdefaultEntryChange() Data.AllEntries[key].Action =", entry.Action)
if (entry.Action == "Hostname") {
event.Vms[0].Hostname = entry.E.Text()
}
if (entry.Action == "Memory") {
event.Vms[0].Memory = pint64(entry.E.Text())
}
log.Println("\tdefaultEntryChange() Data.AllEntries[key].E =", entry.E.Text())
log.Println("\tdefaultEntryChange() Data.AllEntries[key].B =", entry.B)
if entry.B == b {
log.Println("defaultEntryChange() FOUND. Entry assigned to Button", b)
}
}
event.Account = b.Account
log.Println("\tTRIGGERING CREATE event=", event)
log.Println("\tTRIGGERING CREATE event.Account=", event.Account)
prepareAndSend(event)
} else if (b.Action == "CONFIG") {
loadDefaultConfig()