Documentation ¶
Index ¶
- Constants
- Variables
- func AggregateColumnWidths() int
- func ConvertOrchestratorToEmoji(orchestrator bool) string
- func ConvertStateToEmoji(serviceState models.ServiceState) string
- func SetGlobalModel(m *DisplayModel)
- type DisplayColumn
- type DisplayModel
- func (m *DisplayModel) DeregisterGoroutine(id int64)
- func (m *DisplayModel) Init() tea.Cmd
- func (m *DisplayModel) ProcessUpdate(update UpdateAction)
- func (m *DisplayModel) QueueUpdate(update UpdateAction)
- func (m *DisplayModel) RegisterGoroutine(label string) int64
- func (m *DisplayModel) RenderFinalTable() string
- func (m *DisplayModel) StartUpdateProcessor(ctx context.Context)
- func (m *DisplayModel) StopUpdateProcessor()
- func (m *DisplayModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *DisplayModel) UpdateStatus(status *models.DisplayStatus)
- func (m *DisplayModel) View() string
- type GlobalProgammer
- type GlobalProgram
- type MockProgram
- type ResourceType
- type ServiceType
- type UpdateAction
- type UpdateData
- type UpdateType
Constants ¶
const ( UpdateQueueSize = 100 LogLines = 10 )
Constants
const ( StatusLength = 40 EmojiColumnWidth = 2 TickerInterval = 100 * time.Millisecond ProgressBarPadding = 2 MillisecondsPerTenth = 100 TenthsPerSecond = 10 )
Constants for rendering
Variables ¶
var DisplayColumns = []DisplayColumn{ {Title: "Name", Width: 10}, {Title: "Type", Width: 6}, {Title: "Location", Width: 16}, {Title: "Status", Width: StatusLength}, {Title: "Progress", Width: 20}, {Title: "Time", Width: 10}, {Title: "Pub IP", Width: 20}, {Title: "Priv IP", Width: 20}, {Title: models.DisplayTextOrchestrator, Width: EmojiColumnWidth, EmojiColumn: true}, {Title: models.DisplayTextSSH, Width: EmojiColumnWidth, EmojiColumn: true}, {Title: models.DisplayTextDocker, Width: EmojiColumnWidth, EmojiColumn: true}, {Title: models.DisplayTextBacalhau, Width: EmojiColumnWidth, EmojiColumn: true}, {Title: models.DisplayTextCustomScript, Width: EmojiColumnWidth, EmojiColumn: true}, {Title: "", Width: 1}, }
DisplayColumns defines the structure of the display table
var GetGlobalModelFunc func() *DisplayModel = GetGlobalModel
var GetGlobalProgramFunc = GetGlobalProgram
Functions ¶
func AggregateColumnWidths ¶
func AggregateColumnWidths() int
AggregateColumnWidths calculates the total width of all columns
func ConvertOrchestratorToEmoji ¶
ConvertOrchestratorToEmoji converts orchestrator status to an emoji
func ConvertStateToEmoji ¶
func ConvertStateToEmoji(serviceState models.ServiceState) string
ConvertStateToEmoji converts a service state to an emoji
func SetGlobalModel ¶
func SetGlobalModel(m *DisplayModel)
SetGlobalModel sets the global DisplayModel instance
Types ¶
type DisplayColumn ¶
DisplayColumn represents a column in the display table
type DisplayModel ¶
type DisplayModel struct { Deployment *models.Deployment TextBox []string Quitting bool LastUpdate time.Time DebugMode bool UpdateTimes []time.Duration UpdateTimesIndex int UpdateTimesSize int LastUpdateStart time.Time CPUUsage float64 MemoryUsage uint64 BatchedUpdates []models.StatusUpdateMsg BatchUpdateTimer *time.Timer UpdateMutex sync.Mutex UpdateQueue chan UpdateAction UpdateProcessorDone chan bool // contains filtered or unexported fields }
DisplayModel represents the main display model
func GetGlobalModel ¶
func GetGlobalModel() *DisplayModel
GetGlobalModel returns the singleton instance of DisplayModel
func NewDisplayModel ¶
func NewDisplayModel(deployment *models.Deployment) *DisplayModel
NewDisplayModel creates and returns a new DisplayModel
func (*DisplayModel) DeregisterGoroutine ¶
func (m *DisplayModel) DeregisterGoroutine(id int64)
DeregisterGoroutine deregisters a goroutine by its ID
func (*DisplayModel) ProcessUpdate ¶
func (m *DisplayModel) ProcessUpdate(update UpdateAction)
ProcessUpdate processes a single update action
func (*DisplayModel) QueueUpdate ¶
func (m *DisplayModel) QueueUpdate(update UpdateAction)
QueueUpdate queues an update to be processed
func (*DisplayModel) RegisterGoroutine ¶
func (m *DisplayModel) RegisterGoroutine(label string) int64
RegisterGoroutine registers a new goroutine with a label
func (*DisplayModel) RenderFinalTable ¶
func (m *DisplayModel) RenderFinalTable() string
RenderFinalTable renders the final table with additional summary information
func (*DisplayModel) StartUpdateProcessor ¶
func (m *DisplayModel) StartUpdateProcessor(ctx context.Context)
StartUpdateProcessor begins processing updates
func (*DisplayModel) StopUpdateProcessor ¶
func (m *DisplayModel) StopUpdateProcessor()
StopUpdateProcessor halts the update processor
func (*DisplayModel) UpdateStatus ¶
func (m *DisplayModel) UpdateStatus(status *models.DisplayStatus)
UpdateStatus updates the status of a machine
type GlobalProgammer ¶
type GlobalProgammer interface { InitProgram(m *DisplayModel) GetProgram() *GlobalProgram Quit() Run() (tea.Model, error) }
func GetGlobalProgram ¶
func GetGlobalProgram() GlobalProgammer
GetGlobalProgram returns the singleton instance of GlobalProgram
type GlobalProgram ¶
GlobalProgram represents the singleton instance
func (*GlobalProgram) GetProgram ¶
func (gp *GlobalProgram) GetProgram() *GlobalProgram
GetProgram returns the tea.Program instance
func (*GlobalProgram) InitProgram ¶
func (gp *GlobalProgram) InitProgram(m *DisplayModel)
InitProgram initializes the tea.Program
func (*GlobalProgram) Quit ¶
func (gp *GlobalProgram) Quit()
type MockProgram ¶
type MockProgram struct{}
func (*MockProgram) GetProgram ¶
func (m *MockProgram) GetProgram() *GlobalProgram
func (*MockProgram) InitProgram ¶
func (m *MockProgram) InitProgram(model *DisplayModel)
func (*MockProgram) Quit ¶
func (m *MockProgram) Quit()
type UpdateAction ¶
type UpdateAction struct { MachineName string UpdateData UpdateData UpdateFunc func(models.Machiner, UpdateData) }
UpdateAction represents an action to update the display
func NewUpdateAction ¶
func NewUpdateAction(machineName string, updateData UpdateData) UpdateAction
NewUpdateAction creates a new UpdateAction instance.
type UpdateData ¶
type UpdateData struct { UpdateType UpdateType ResourceType ResourceType ResourceState models.MachineResourceState ServiceType ServiceType ServiceState models.ServiceState Complete bool }
UpdateData contains data for an update action
func (*UpdateData) String ¶
func (u *UpdateData) String() string
String returns a string representation of the UpdatePayload.
type UpdateType ¶
type UpdateType string
Type definitions
const ( UpdateTypeComplete UpdateType = "Complete" UpdateTypeResource UpdateType = "Resource" UpdateTypeService UpdateType = "Service" )
Constants for update types