blob: 20a102dce63e5ac43fa23626f4db8ceead82d917 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0
package main
import (
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/log"
)
func makeEventsWin() {
me.eventswin = new(stdEventTableWin)
me.eventswin.win = gadgets.NewGenericWindow("zood daemon versions", "todo: add global controls here")
me.eventswin.win.Custom = func() {
log.Info("test delete window here")
}
grid := me.eventswin.win.Group.RawGrid()
grid.NewButton("ConfigSave() ", func() {
saveMachineState()
})
grid.NewButton("Add() ", func() {
})
grid.NewCheckbox("hide active")
grid.NewButton("update", func() {
doMachinesUpgradeTable()
})
// make a box at the bottom of the window for the protobuf table
me.eventswin.box = me.eventswin.win.Bottom.Box().SetProgName("TBOX")
doEventsTable(me.events)
}
func doEventsTable(currentEvents *Events) {
me.eventswin.Lock()
defer me.eventswin.Unlock()
if me.eventswin.TB != nil {
me.eventswin.TB.Delete()
me.eventswin.TB = nil
}
// display the protobuf
me.eventswin.TB = AddEventsPB(me.eventswin.box, currentEvents)
f := func(e *Event) {
log.Info("Triggered. do something here", e.Hostname)
// m.Enabled = true
}
me.eventswin.TB.Custom(f)
// log.Info("table has uuid", me.eventswin.TB.GetUuid())
}
func AddEventsPB(tbox *gui.Node, pb *Events) *EventsTable {
t := pb.NewTable("EventsPB")
t.NewUuid()
t.SetParent(tbox)
enabledf := func(p *Event) string {
return "todo"
}
t.AddStringFunc("enabled", enabledf)
t.AddHostname()
t.AddAddress()
t.AddWhere()
t.ShowTable()
return t
}
|