ui

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseFormWidget added in v0.2.0

type DatabaseFormWidget struct {
	*tview.Flex
	*tview.Form
	*Widget
}

DatabaseFormWidget is a MongoDB connection data form modal. It contains individual fields, a mongodb:// connection URI field to enter connection data, a checkbox for storing the connection data locally and a dropbox to select a former stored connection.

func CreateDatabaseFormWidget added in v0.2.0

func CreateDatabaseFormWidget(app *tview.Application, pages *tview.Pages, use func(name string)) *DatabaseFormWidget

CreateDatabaseFormWidget creates a new DatabaseFormWidget.

func (*DatabaseFormWidget) SetFocus added in v0.2.0

func (d *DatabaseFormWidget) SetFocus(app *tview.Application)

SetFocus implements the FocusSetter interface to set the focus tview.Form when called.

type DatabaseTreeWidget

type DatabaseTreeWidget struct {
	*tview.TreeView
	*EventWidget
	// contains filtered or unexported fields
}

DatabaseTreeWidget displays the current MongoDB connections, including the databases and their collections in a tree view.

func CreateDatabaseTreeWidget

func CreateDatabaseTreeWidget(app *tview.Application,
	pages *tview.Pages,
	loadCollections func(connectionURI string, database string) []string,
	setCollection func(name string)) *DatabaseTreeWidget

CreateDatabaseTreeWidget creates a new DatabaseTreeWidget.

func (*DatabaseTreeWidget) AddDatabase added in v0.2.0

func (d *DatabaseTreeWidget) AddDatabase(name string)

AddDatabase adds a new database to the tree view

func (*DatabaseTreeWidget) AddDatabases

func (d *DatabaseTreeWidget) AddDatabases(host string, connectionURI string, databases []string)

AddDatabases adds the databases of the instance of the passed connectionURI to the connection tree.

func (*DatabaseTreeWidget) GetSelectedConnection added in v0.2.0

func (d *DatabaseTreeWidget) GetSelectedConnection() string

GetSelectedConnection returns the currently selected connection of the tree view.

func (*DatabaseTreeWidget) HandleDiconnectionEvent added in v0.1.2

func (d *DatabaseTreeWidget) HandleDiconnectionEvent(event *tcell.EventKey, disconnect func(clientKey string) error) error

HandleDiconnectionEvent disconnects from the selected instance if a client node is selected.

func (*DatabaseTreeWidget) HandleEvent added in v0.1.2

func (d *DatabaseTreeWidget) HandleEvent(event *tcell.EventKey)

HandleEvent handles the event key of the DatabaseTreeWidget.

func (*DatabaseTreeWidget) RemoveSelectedDatabase added in v0.2.0

func (d *DatabaseTreeWidget) RemoveSelectedDatabase()

RemoveSelectedDatabase removes the database node from the tree view.

func (*DatabaseTreeWidget) SetFocus

func (d *DatabaseTreeWidget) SetFocus(app *tview.Application)

SetFocus implements the FocusSetter interface to set the focus to the tview.TreeView.

func (*DatabaseTreeWidget) UpdateCollections

func (d *DatabaseTreeWidget) UpdateCollections()

UpdateCollections removes and re-adds the collections of the selected database.

type DropDatabaseModalWidget added in v0.2.0

type DropDatabaseModalWidget struct {
	*tview.Modal
	*EventWidget
	// contains filtered or unexported fields
}

DropDatabaseModalWidget is the modal to drop a database.

func CreateDropDatabaseModalWidget added in v0.2.0

func CreateDropDatabaseModalWidget(app *tview.Application, pages *tview.Pages,
	getCurrentDatabase func() string, drop func()) *DropDatabaseModalWidget

CreateDropDatabaseModalWidget creates a new DropDatabaseModalWidget.

func (*DropDatabaseModalWidget) HandleEvent added in v0.2.0

func (m *DropDatabaseModalWidget) HandleEvent(event *tcell.EventKey)

HandleEvent handles the event key of the DropDatabaseModalWidget.

func (*DropDatabaseModalWidget) SetFocus added in v0.2.0

func (m *DropDatabaseModalWidget) SetFocus(app *tview.Application)

SetFocus implements the FocusSetter interface to set the focus to the OK button.

type EventWidget

type EventWidget struct {
	*Widget
	Key tcell.Key
}

EventWidget extends ui.Widget with the tcell.Key which fires the event to show the widget.

type FocusSetter

type FocusSetter interface {
	SetFocus(app *tview.Application)
}

FocusSetter provides an interface for widgets so the focus can set individally, e. g. to a containing primitve.

type FormWidget

type FormWidget struct {
	*tview.Flex
	*tview.Form
	*tview.DropDown
	*EventWidget
	// contains filtered or unexported fields
}

FormWidget is a MongoDB connection data form modal. It contains individual fields, a mongodb:// connection URI field to enter connection data, a checkbox for storing the connection data locally and a dropbox to select a former stored connection.

func CreateConnectionFormWidget

func CreateConnectionFormWidget(app *tview.Application, pages *tview.Pages, connect func(connection *models.Connection), canStoreConnection bool, getSavedConnections func() ([]string, error), loadSavedConnection func(string) (string, error)) *FormWidget

CreateConnectionFormWidget creates a new FormWidget.

func (*FormWidget) HandleEvent added in v0.1.2

func (f *FormWidget) HandleEvent(event *tcell.EventKey)

HandleEvent handles the event key of the FormWidget.

func (*FormWidget) SetFocus

func (f *FormWidget) SetFocus(app *tview.Application)

SetFocus implements the FocusSetter interface to set the focus tview.Form when called.

type MessageModalWidget

type MessageModalWidget struct {
	*tview.Modal
	*Widget
	MessageType MessageType
	Message     string
}

MessageModalWidget is a simple message dialog, which displays the message type, a text message and an Ok button.

func CreateMessageModalWidget

func CreateMessageModalWidget(app *tview.Application, pages *tview.Pages, messageType MessageType, message string) (*MessageModalWidget, error)

CreateMessageModalWidget creates a new MessageModalWidget.

type MessageType

type MessageType int

MessageType indicates the type of a message.

const (
	TypeInfo  MessageType = 0
	TypeError MessageType = 1
)

Currently supported message types.

type QuitModalWidget

type QuitModalWidget struct {
	*tview.Modal
	*EventWidget
}

QuitModalWidget is the modal to quit the application. It displays the question whether the user really wants to quit and an Ok and a Cancel button.

func CreateQuitModalWidget

func CreateQuitModalWidget(app *tview.Application, pages *tview.Pages) *QuitModalWidget

CreateQuitModalWidget creates a new QuitModalWidget.

func (*QuitModalWidget) HandleEvent added in v0.1.2

func (m *QuitModalWidget) HandleEvent(event *tcell.EventKey)

HandleEvent handles the event key of the QuitModalWidget.

func (*QuitModalWidget) SetFocus

func (m *QuitModalWidget) SetFocus(app *tview.Application)

SetFocus implements the FocusSetter interface to set the focus to the OK button.

type ResultTreeWidget

type ResultTreeWidget struct {
	*tview.TreeView
	*EventWidget
}

ResultTreeWidget is the tree view to display the MondoDB command results.

func CreateResultTreeWidget

func CreateResultTreeWidget(app *tview.Application,
	pages *tview.Pages) *ResultTreeWidget

CreateResultTreeWidget creates a new ResultTreeWidget.

func (*ResultTreeWidget) HandleEvent added in v0.1.2

func (r *ResultTreeWidget) HandleEvent(event *tcell.EventKey)

HandleEvent handles the event key of the ResultTreeWidget.

func (*ResultTreeWidget) SetFocus added in v0.1.1

func (r *ResultTreeWidget) SetFocus(app *tview.Application)

SetFocus implements the FocusSetter interface to set the focus to the tview.TreeView.

func (*ResultTreeWidget) SetResult

func (r *ResultTreeWidget) SetResult(result []map[string]interface{})

SetResult sets the result returned by the executed MongoDB command to the tcell.TreeView.

type WaitModalWidget added in v0.2.1

type WaitModalWidget struct {
	*tview.Flex
	*tview.TextView
	*Widget
}

WaitModalWidget is a modal with a text message, a rotating spinner and a cancel button to interrupt the invoking action and close the modal.

func CreateWaitModalWidget added in v0.2.1

func CreateWaitModalWidget(ctx context.Context, app *tview.Application, pages *tview.Pages, message string, cancel func()) *WaitModalWidget

CreateWaitModalWidget creates a new WaitModalWidget.

type Widget

type Widget struct {
	Primitive tview.Primitive
	Name      string
	App       *tview.Application
	Pages     *tview.Pages
}

Widget is the standard widget extending tview.Primitive containing its name, the current tview.Application and the tview.Pages which contains it.

Jump to

Keyboard shortcuts

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