diff options
Diffstat (limited to 'windowEvents.go')
| -rw-r--r-- | windowEvents.go | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/windowEvents.go b/windowEvents.go index 6a93188..e13df5b 100644 --- a/windowEvents.go +++ b/windowEvents.go @@ -4,6 +4,8 @@ package main import ( + "strings" + "go.wit.com/gui" "go.wit.com/lib/gadgets" "go.wit.com/log" @@ -48,6 +50,19 @@ func makeEventsWin() { doEventsTable(found) }) + grid.NewButton("abnormal", func() { + found := NewEvents() + all := me.events.All() + for all.Scan() { + e := all.Next() + if strings.HasPrefix(e.Address, "192.168") { + continue + } + found.Append(e) + } + doEventsTable(found) + }) + grid.NewButton("Save Current", func() { log.Info("event log is len =", me.events.Len()) me.events.Save() @@ -81,14 +96,27 @@ func AddEventsPB(tbox *gui.Node, pb *Events) *EventsTable { t.NewUuid() t.SetParent(tbox) - enabledf := func(p *Event) string { - return "todo" + ctimef := func(e *Event) string { + ctime := e.Ctime.AsTime() + return ctime.Format("2006/01/02 15:04") + } + t.AddStringFunc("ctime", ctimef) + + etimef := func(e *Event) string { + etime := e.Etime.AsTime() + s := etime.Format("2006/01/02 15:04") + if strings.HasPrefix(s, "1970/") { + // just show a blank if it's not set + return "" + } + return s } - t.AddStringFunc("enabled", enabledf) + t.AddStringFunc("etime", etimef) t.AddHostname() t.AddAddress() t.AddWhere() + t.AddLocalPort() t.ShowTable() return t } |
