verstak/cmd/verstak-gui/bindings_browser.go

42 lines
1.3 KiB
Go

package main
import (
"log"
"verstak/internal/core/browser"
)
// ListBrowserEvents returns staged browser events, optionally filtered by status.
func (a *App) ListBrowserEvents(status string, limit, offset int) ([]browser.Event, error) {
if status == "" || status == "all" {
return a.browser.ListAll(limit, offset)
}
if status == "pending" {
return a.browser.ListPending(limit, offset)
}
return a.browser.ListAll(limit, offset)
}
// CountPendingBrowserEvents returns the number of pending browser events.
func (a *App) CountPendingBrowserEvents() (int, error) {
return a.browser.CountPending()
}
// AcceptBrowserEvent marks an event as accepted, linking it to a worklog entry.
func (a *App) AcceptBrowserEvent(eventID, worklogID string) error {
log.Printf("[browser] accept event %s -> worklog %s", eventID, worklogID)
return a.browser.Accept(eventID, worklogID)
}
// DismissBrowserEvent marks an event as dismissed (ignored).
func (a *App) DismissBrowserEvent(eventID string) error {
log.Printf("[browser] dismiss event %s", eventID)
return a.browser.Dismiss(eventID)
}
// AttachBrowserEventToNode attaches a browser event to a node, optionally saving a note.
func (a *App) AttachBrowserEventToNode(eventID, nodeID string) error {
log.Printf("[browser] attach event %s -> node %s", eventID, nodeID)
return a.browser.Attach(eventID, nodeID)
}