components

package
v0.0.0-...-91fa891 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

This is copy paste of jesseduffield lazydocker filteredlist

This is copy paste of jesseduffield lazydocker side_list_panel - Side doesnt have much meaning in the context of this project

This is copy paste of jesseduffield lazydocker list_panel

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp(x, min, max int) int

Get this from lazycore Clamp returns a value x restricted between min and max

Types

type FilteredList

type FilteredList[T comparable] struct {
	// contains filtered or unexported fields
}

FilteredList is a wrapper aound an array for Setting/Filtering/Retrieving Items

func NewFilteredList

func NewFilteredList[T comparable]() *FilteredList[T]

func (*FilteredList[T]) Filter

func (self *FilteredList[T]) Filter(filter func(T, int) bool)

func (*FilteredList[T]) Get

func (self *FilteredList[T]) Get(index int) T

func (*FilteredList[T]) GetAllItems

func (self *FilteredList[T]) GetAllItems() []T

func (*FilteredList[T]) GetIndex

func (self *FilteredList[T]) GetIndex(item T) int

func (*FilteredList[T]) GetItems

func (self *FilteredList[T]) GetItems() []T

func (*FilteredList[T]) Len

func (self *FilteredList[T]) Len() int

returns the length of the filtered list

func (*FilteredList[T]) SetItems

func (self *FilteredList[T]) SetItems(items []T)

func (*FilteredList[T]) Sort

func (self *FilteredList[T]) Sort(less func(T, T) bool)

func (*FilteredList[T]) TryGet

func (self *FilteredList[T]) TryGet(index int) (T, bool)

type IGui

type IGui interface {
	IsCurrentView(*gocui.View) bool
	GetUrlView() *gocui.View
	GetRequestInfoView() *gocui.View
	GetResponseInfoView() *gocui.View
	FocusY(selectedLine int, itemCount int, view *gocui.View)
	Update(func() error)
}

type ISideListPanel

type ISideListPanel interface {
	HandleSelect() error
	GetView() *gocui.View
	Refocus()
	RerenderList() error
	HandleNextLine() error
	HandlePrevLine() error
}

type ListComponent

type ListComponent[T comparable] struct {
	Log  *logrus.Entry
	View *gocui.View

	RequestContext *RequestContext[*commands.Request]
	ListPanel[T]

	Gui IGui

	// returns the cells that we render to the view in a table format. The cells will
	// be rendered with padding.
	GetTableCells func(T) []string
}

func (*ListComponent[T]) GetView

func (self *ListComponent[T]) GetView() *gocui.View

func (*ListComponent[T]) HandleNextLine

func (self *ListComponent[T]) HandleNextLine() error

func (*ListComponent[T]) HandleNextReqTab

func (self *ListComponent[T]) HandleNextReqTab() error

func (*ListComponent[T]) HandleNextResTab

func (self *ListComponent[T]) HandleNextResTab() error

func (*ListComponent[T]) HandlePrevLine

func (self *ListComponent[T]) HandlePrevLine() error

func (*ListComponent[T]) HandlePrevReqTab

func (self *ListComponent[T]) HandlePrevReqTab() error

func (*ListComponent[T]) HandlePrevResTab

func (self *ListComponent[T]) HandlePrevResTab() error

func (*ListComponent[T]) HandleSelect

func (self *ListComponent[T]) HandleSelect() error

func (*ListComponent[T]) Refocus

func (self *ListComponent[T]) Refocus()

Keybinding related

func (*ListComponent[T]) RerenderList

func (self *ListComponent[T]) RerenderList() error

func (*ListComponent[T]) SelectNextLine

func (self *ListComponent[T]) SelectNextLine()

func (*ListComponent[T]) SelectPrevLine

func (self *ListComponent[T]) SelectPrevLine()

func (*ListComponent[T]) SetSelectedLineIdx

func (self *ListComponent[T]) SetSelectedLineIdx(value int)

type ListPanel

type ListPanel[T comparable] struct {
	SelectedIdx    int
	List           *FilteredList[T]
	View           *gocui.View
	NoItemsMessage string
}

List Panel Extends FilteredList to include a View and Current Index. Has methods for moving the SelectedIndex. The View is not directly accessed here. Consider moving up a level

func (*ListPanel[T]) GetItems

func (self *ListPanel[T]) GetItems() []T

func (*ListPanel[T]) GetSelectedItem

func (self *ListPanel[T]) GetSelectedItem() (T, error)

func (*ListPanel[T]) RemoveSelectedItem

func (self *ListPanel[T]) RemoveSelectedItem() (T, error)

func (*ListPanel[T]) SelectNextLine

func (self *ListPanel[T]) SelectNextLine()

func (*ListPanel[T]) SelectPrevLine

func (self *ListPanel[T]) SelectPrevLine()

func (*ListPanel[T]) SetItems

func (self *ListPanel[T]) SetItems(items []T)

func (*ListPanel[T]) SetSelectedLineIdx

func (self *ListPanel[T]) SetSelectedLineIdx(value int)

type RequestContext

type RequestContext[T any] struct {

	// this function returns the tabs that we can display for an item (the tabs
	// are shown on the request and response views)
	GetUrlTab           func() Tab[T]
	GetRequestInfoTabs  func() []Tab[T]
	GetResponseInfoTabs func() []Tab[T]
	// contains filtered or unexported fields
}

the active request determines the entire state of the application. Will be used to render request parameters/ body/ headers and response

func (*RequestContext[T]) GetCurrentRequestInfoTab

func (rc *RequestContext[T]) GetCurrentRequestInfoTab() Tab[T]

func (*RequestContext[T]) GetCurrentResponseInfoTab

func (rc *RequestContext[T]) GetCurrentResponseInfoTab() Tab[T]

func (*RequestContext[T]) GetRequestInfoTabTitles

func (rc *RequestContext[T]) GetRequestInfoTabTitles() []string

// Request Tab

func (*RequestContext[T]) GetResponseInfoTabTitles

func (rc *RequestContext[T]) GetResponseInfoTabTitles() []string

// Response Tab

func (*RequestContext[T]) HandleNextReqTab

func (rp *RequestContext[T]) HandleNextReqTab()

func (*RequestContext[T]) HandleNextResTab

func (rp *RequestContext[T]) HandleNextResTab()

func (*RequestContext[T]) HandlePrevReqTab

func (rp *RequestContext[T]) HandlePrevReqTab()

func (*RequestContext[T]) HandlePrevResTab

func (rp *RequestContext[T]) HandlePrevResTab()

func (*RequestContext[T]) RenderUrl

func (rc *RequestContext[T]) RenderUrl()

type Tab

type Tab[T any] struct {
	// key used as part of the context cache key
	Key string
	// title of the tab, rendered in the respective view
	Title string
	// function to render the content of the tab
	Render func() error // tasks.TaskFunc
}

Jump to

Keyboard shortcuts

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