ui

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UIActionEvent

type UIActionEvent struct {
	Action      string
	ComponentID string
	Data        map[string]interface{}
	Timestamp   time.Time
}

UIActionEvent represents a single UI action event

type UIActionResponse

type UIActionResponse struct {
	RequestID     string
	Action        string
	ComponentID   string
	Data          map[string]interface{}
	Error         error
	Timestamp     time.Time
	RelatedEvents []UIActionEvent // Additional events related to this response
}

UIActionResponse represents the response from a UI action

type UIDefinition

type UIDefinition struct {
	Components []map[string]interface{} `yaml:"components"`
	RequestID  string                   `yaml:"requestID,omitempty"`
}

UIDefinition represents a UI page definition

type UIHandler

type UIHandler struct {
	// contains filtered or unexported fields
}

UIHandler manages all UI-related functionality

func NewUIHandler

func NewUIHandler(events events.EventManager, sseHandler *sse.SSEHandler, logger *zerolog.Logger) *UIHandler

NewUIHandler creates a new UI handler with the given dependencies

func (*UIHandler) RegisterHandlers

func (h *UIHandler) RegisterHandlers(mux *http.ServeMux)

RegisterHandlers registers all UI-related HTTP handlers with the given mux

func (*UIHandler) SetClickSubmitDelay

func (h *UIHandler) SetClickSubmitDelay(delay time.Duration, enabled bool)

SetClickSubmitDelay configures the delay time to wait after a click event for a potential form submission before responding

type WaitRegistry

type WaitRegistry struct {
	// contains filtered or unexported fields
}

WaitRegistry tracks pending UI update requests waiting for user actions

func NewWaitRegistry

func NewWaitRegistry(timeout time.Duration) *WaitRegistry

NewWaitRegistry creates a new registry with the specified timeout

func (*WaitRegistry) Cleanup

func (wr *WaitRegistry) Cleanup(requestID string)

Cleanup removes a request from the registry

func (*WaitRegistry) CleanupStale

func (wr *WaitRegistry) CleanupStale() int

CleanupStale removes requests that have been in the registry longer than the timeout This is a placeholder implementation that would need to be enhanced with timestamp tracking

func (*WaitRegistry) Register

func (wr *WaitRegistry) Register(requestID string) chan UIActionResponse

Register adds a new request to the registry and returns a channel for the response

func (*WaitRegistry) Resolve

func (wr *WaitRegistry) Resolve(requestID string, response UIActionResponse) bool

Resolve completes a pending request with the given action response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL