diff options
| author | Jeff Carr <[email protected]> | 2024-01-08 22:34:08 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-08 22:34:08 -0600 |
| commit | ba020cdb3765a9ce734a8fea4ba484258dbb6f8b (patch) | |
| tree | d1e8273bb5d125271c446a31d6b7f9de8b6913a0 /errorBox.go | |
| parent | 9b4bf224dcf4a7d29433be25e73d33b45b670d0b (diff) | |
go.wit.com/log NewFlag()
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'errorBox.go')
| -rw-r--r-- | errorBox.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/errorBox.go b/errorBox.go index 72a7940..1c8c835 100644 --- a/errorBox.go +++ b/errorBox.go @@ -32,9 +32,12 @@ type anError struct { status string kindLabel *gui.Node + actionLabel *gui.Node ipLabel *gui.Node statusLabel *gui.Node button *gui.Node + + problem *Problem } func NewErrorBox(p *gui.Node, name string, ip string) *errorBox { @@ -42,9 +45,10 @@ func NewErrorBox(p *gui.Node, name string, ip string) *errorBox { eb = new(errorBox) eb.parent = p eb.group = p.NewGroup(name) - eb.grid = eb.group.NewGrid("stuff", 4, 1) + eb.grid = eb.group.NewGrid("stuff", 5, 1) eb.grid.NewLabel("Type") + eb.grid.NewLabel("Action") eb.grid.NewLabel("IP") eb.grid.NewLabel("Status") eb.grid.NewLabel("") @@ -80,25 +84,28 @@ func (eb *errorBox) Ready() bool { return eb.ready } -func (eb *errorBox) add(kind string, ip string) bool { +func (eb *errorBox) addIPerror(kind ProblemType, action ActionType, ip string) bool { if ! eb.Ready() {return false} - tmp := kind + " " + ip + tmp := kind.String() + " " + ip if eb.fixes[tmp] != nil { log.Log(WARN, "Error is already here", kind, ip) return false } anErr := new(anError) - anErr.kind = kind anErr.aaaa = ip - anErr.kindLabel = eb.grid.NewLabel(kind) + anErr.kindLabel = eb.grid.NewLabel(kind.String()) + anErr.actionLabel = eb.grid.NewLabel(action.String()) anErr.ipLabel = eb.grid.NewLabel(ip) anErr.statusLabel = eb.grid.NewLabel("") - anErr.button = eb.grid.NewButton("Fix", func() { + anErr.button = eb.grid.NewButton("Try to Fix", func() { log.Log(WARN, "got", kind, "here. IP =", ip) eb.fix(tmp) }) + anErr.problem = new(Problem) + anErr.problem.kind = kind + anErr.problem.aaaa = ip eb.fixes[tmp] = anErr return false } |
