models

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package models holds the ui model

Package models holds the ui model

Index

Constants

View Source
const (
	View mode = iota
	Filter
	Input
)

Application Modes

Variables

This section is empty.

Functions

func ReceiveAppEvent

func ReceiveAppEvent(event v1alpha1.ApplicationWatchEvent) tea.Cmd

ReceiveAppEvent wraps app events received from argocd

Types

type AppEvent

type AppEvent struct {
	Event v1alpha1.ApplicationWatchEvent
}

AppEvent corresponds to an argocd application event

type AppListItem

type AppListItem struct {
	Name            string
	ItemDescription string
}

AppListItem is used as bubbletea list.Items

func (AppListItem) Description

func (a AppListItem) Description() string

Description returns the ItemDescription

func (AppListItem) FilterValue

func (a AppListItem) FilterValue() string

FilterValue returns the string to filter on

func (AppListItem) Title

func (a AppListItem) Title() string

Title returns the item's name

type ArTUIModel

type ArTUIModel struct {
	Cluster         string
	Ready           bool
	Activity        mode
	Applications    v1alpha1.ApplicationList
	List            list.Model
	Viewport        viewport.Model
	Textinput       textinput.Model
	Glamour         *glamour.TermRenderer
	Templates       *template.Template
	WindowHeight    int
	WindowWidth     int
	LastAppRefresh  time.Time
	RefreshDuration time.Duration
	AppEventChan    <-chan AppEvent
	AppWorkerChan   chan<- WorkerCmd
	DarkMode        bool
}

ArTUIModel is the bubbletea app model

func (ArTUIModel) Init

func (m ArTUIModel) Init() tea.Cmd

Init the app model

func (ArTUIModel) Update

func (m ArTUIModel) Update(message tea.Msg) (tea.Model, tea.Cmd)

Update the app model

func (*ArTUIModel) UpdateApplications

func (m *ArTUIModel) UpdateApplications(updateApp v1alpha1.Application)

UpdateApplications updates the model application list

func (ArTUIModel) View

func (m ArTUIModel) View() string

View the model

type WorkerCmd

type WorkerCmd struct {
	Cmd WorkerCommand
	App v1alpha1.Application
}

WorkerCmd corresponds to an argocd application event

type WorkerCommand

type WorkerCommand int

WorkerCommand differenciates possible commands

const (
	Refresh WorkerCommand = iota
	HardRefresh
	Sync
)

Possible Commands

Jump to

Keyboard shortcuts

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