diff options
| author | Jeff Carr <[email protected]> | 2025-03-10 07:08:28 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-10 07:59:25 -0500 | 
| commit | 18c1221efc1a4e6b97afb5547d44055a29150dff (patch) | |
| tree | 0b449cd41ec8044e90a0286ab76437a73088e40d | |
| parent | 22d07987494113dc85542b753c3ecc7e9db37511 (diff) | |
show last 20 events works
| -rw-r--r-- | doGui.go | 7 | ||||
| -rw-r--r-- | windowEvents.go | 43 | 
2 files changed, 36 insertions, 14 deletions
@@ -51,12 +51,7 @@ func doGui() {  		makePortmapWin()  	}) -	grid.NewButton("Save Events", func() { -		log.Info("event log is len =", me.events.Len()) -		me.events.Save() -	}) - -	grid.NewButton("Show Last 20 Events", func() { +	grid.NewButton("Show Events", func() {  		// if the window exists, just toggle it open or closed  		if me.eventswin != nil {  			me.eventswin.Toggle() diff --git a/windowEvents.go b/windowEvents.go index 20a102d..6a93188 100644 --- a/windowEvents.go +++ b/windowEvents.go @@ -11,24 +11,51 @@ import (  func makeEventsWin() {  	me.eventswin = new(stdEventTableWin) -	me.eventswin.win = gadgets.NewGenericWindow("zood daemon versions", "todo: add global controls here") +	me.eventswin.win = gadgets.NewGenericWindow("Gus current event log", "who is squirreling around?")  	me.eventswin.win.Custom = func() {  		log.Info("test delete window here")  	}  	grid := me.eventswin.win.Group.RawGrid() -	grid.NewButton("ConfigSave() ", func() { -		saveMachineState() + +	grid.NewButton("first 20", func() { +		var count int +		found := NewEvents() +		all := me.events.All() +		for all.Scan() { +			e := all.Next() +			count += 1 +			found.Append(e) +			if count > 20 { +				break +			} +		} +		doEventsTable(found)  	}) -	grid.NewButton("Add() ", func() { + +	grid.NewButton("last 20", func() { +		var count int +		total := me.events.Len() +		found := NewEvents() +		all := me.events.All() +		for all.Scan() { +			e := all.Next() +			count += 1 +			if count < total-20 { +				continue +			} +			found.Append(e) +		} +		doEventsTable(found)  	}) -	grid.NewCheckbox("hide active") -	grid.NewButton("update", func() { -		doMachinesUpgradeTable() + +	grid.NewButton("Save Current", func() { +		log.Info("event log is len =", me.events.Len()) +		me.events.Save()  	})  	// 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) +	// doEventsTable(me.events)  }  func doEventsTable(currentEvents *Events) {  | 
