uiutil

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IsFloatingBoxActive bool
)

Functions

func CloseConfirmModal

func CloseConfirmModal(app *tview.Application, pages *tview.Pages, modalName string, mainView tview.Primitive)

gracefully closes the Confirmation Prompt Modal window

func CloseInputModal

func CloseInputModal(app *tview.Application, pages *tview.Pages, modalName string, mainView tview.Primitive)

gracefully closes the Input Prompt Modal window

func CloseModalNotification

func CloseModalNotification(app *tview.Application, pages *tview.Pages, modalName string, mainView tview.Primitive)

gracefully closes the notification modal window

func GetFloatingBoxActive

func GetFloatingBoxActive() bool

retrieves the flag safely

func InitializeModalManager

func InitializeModalManager(app *tview.Application, pages *tview.Pages, mainView tview.Primitive)

initializes the ModalManager singleton

func PromptConfirmation

func PromptConfirmation(app *tview.Application, pages *tview.Pages, modalName, title, message string, callback func(bool, error), mainView tview.Primitive)

displays a confirmation modal to the user

func PromptInput

func PromptInput(app *tview.Application, pages *tview.Pages, modalName, title, label string, mainView tview.Primitive, callback func(string, error), prefill ...string)

displays a modal to get input from the user

func PromptInputWithCancelAll

func PromptInputWithCancelAll(app *tview.Application, pages *tview.Pages, modalName, title, label string, mainView tview.Primitive, callback func(string, error), cancelAllCallback func(), prefill ...string)

displays a modal to get input from the user with an option to cancel all

func SetFloatingBoxActive

func SetFloatingBoxActive(active bool)

safely set the flag

func ShowAnalysisResults

func ShowAnalysisResults(app *tview.Application, pages *tview.Pages, modalName string, results []pkg.AnalysisResult, mainView tview.Primitive)

displays the analysis results in a modal with structured columns and merged headers

func ShowConfirm

func ShowConfirm(app *tview.Application, pages *tview.Pages, modalName, message string, callback func(bool), mainView tview.Primitive)

displays a confirmation modal with Yes/No options

func ShowError

func ShowError(app *tview.Application, pages *tview.Pages, modalName, message string, mainView tview.Primitive, callback func())

displays an error modal with an optional callback

func ShowList

func ShowList(app *tview.Application, pages *tview.Pages, modalName, title string, items []string, selectedFunc func(int), mainView tview.Primitive)

displays a selectable list modal

func ShowMessage

func ShowMessage(app *tview.Application, pages *tview.Pages, modalName, message string, mainView tview.Primitive)

displays a simple message modal

func ShowMultiSelect

func ShowMultiSelect(app *tview.Application, pages *tview.Pages,
	modalID, title string, items []string,
	onConfirm func([]string), mainView tview.Primitive)

ShowMultiSelect displays a list with multiple selection capability

Types

type ModalFunc

type ModalFunc func(done func())

defines the signature for modal functions

type ModalManager

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

manages the display of modals in a queued manner

func GetModalManager

func GetModalManager() *ModalManager

Getter for ModalManager

func NewModalManager

func NewModalManager(app *tview.Application, pages *tview.Pages, mainView tview.Primitive) *ModalManager

initializes and returns a new ModalManager

func (*ModalManager) Enqueue

func (m *ModalManager) Enqueue(modal ModalFunc)

Enqueue adds a new modal function to the queue

type OutputModal

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

OutputModal represents the structure for the output modal

func ShowOutputModal

func ShowOutputModal(app *tview.Application, pages *tview.Pages, modalName, title string, onCancel func(), mainView tview.Primitive) *OutputModal

ShowOutputModal enqueues and displays the output modal with adjusted size. It uses ModalManager to manage the modal display. Returns a pointer to the OutputModal for appending text.

func (*OutputModal) AppendText

func (o *OutputModal) AppendText(text string)

AppendText safely appends text to the OutputModal's TextView.

func (*OutputModal) CloseModal

func (o *OutputModal) CloseModal()

CloseModal gracefully closes the output modal and restores previous state

func (*OutputModal) CloseOutputModal

func (o *OutputModal) CloseOutputModal(completionMessage string)

CloseOutputModal gracefully closes the output modal with a completion message.

func (*OutputModal) IsScanning

func (o *OutputModal) IsScanning() bool

IsScanning returns the current scanning state

func (*OutputModal) SetScanning

func (o *OutputModal) SetScanning(scanning bool)

SetScanning sets the scanning state of the OutputModal

Jump to

Keyboard shortcuts

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