k

package
v0.0.0-...-7737fca Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: MIT Imports: 13 Imported by: 8

Documentation

Index

Constants

View Source
const (

	// ModalSizeSmall represents a Small modal
	ModalSizeSmall = "Small"
	// ModalSizeMedium represents a Medium modal
	ModalSizeMedium = "Medium"
	// ModalSizeLarge represents a Large modal
	ModalSizeLarge = "Large"
	// ModalSizeExtraLarge represents a ExtraLarge modal
	ModalSizeExtraLarge = "ExtraLarge"
)

Variables

View Source
var DeploymentListHeaders = []string{"Namespace", "Name", "Pods", "Age"}

DeploymentListHeaders are the headers needed for the Deployment list

View Source
var NamespaceListHeaders = []string{"Status", "Name", "Age"}

NamespaceListHeaders are the headers needed for the Namespace list

View Source
var PodListHeaders = []string{"Namespace", "Name", "Restarts", "Age", "Ready", "Status"}

PodListHeaders are the headers needed for the Pod list

Functions

func Debugln

func Debugln(val ...interface{}) error

Debugln is a wrapper for logrus' Debugln

func DeploymentFilter

func DeploymentFilter(vs []appsv1.Deployment, f func(appsv1.Deployment) bool) []appsv1.Deployment

DeploymentFilter is a collection function that filters deployments based on a predicate

func DeploymentLineHelper

func DeploymentLineHelper(deployment appsv1.Deployment) []string

DeploymentLineHelper is the column helper for Deployments

func Errorln

func Errorln(val ...interface{}) error

Errorln is a wrapper for logrus' Errorln

func Infoln

func Infoln(val ...interface{}) error

Infoln is a wrapper for logrus' Infoln

func NamespaceLineHelper

func NamespaceLineHelper(ns corev1.Namespace) []string

NamespaceLineHelper is the column helper for Namespaces

func PodFilter

func PodFilter(vs []v1.Pod, f func(v1.Pod) bool) []v1.Pod

PodFilter is a collection function that filters pods based on a predicate

func PodLineHelper

func PodLineHelper(pod corev1.Pod) []string

PodLineHelper is the column helper for Pods

func PodNameFromLine

func PodNameFromLine(line string) (string, error)

PodNameFromLine returns a pods name from a line in a table

Types

type DebugEntities

type DebugEntities struct {
	Lines []interface{}
}

DebugEntities contains the data for Debugs

type DeploymentEntities

type DeploymentEntities struct {
	Cursor         int
	Filter         string
	FilterKind     string
	Selected       string
	Deployments    *appsv1.DeploymentList `json:"-"`
	SendingRequest bool
	Size           int
}

DeploymentEntities contains the data for deployments from the API

func (*DeploymentEntities) ClearFilter

func (e *DeploymentEntities) ClearFilter(g1 *gocui.Gui)

ClearFilter updates the DeploymentEntities state with an empty filter

func (*DeploymentEntities) CursorMove

func (e *DeploymentEntities) CursorMove(g1 *gocui.Gui, delta int)

CursorMove updates the DeploymentEntities state with a new cursor position (delta)

func (*DeploymentEntities) LoadDeploymentData

func (e *DeploymentEntities) LoadDeploymentData(g1 *gocui.Gui, deployments *appsv1.DeploymentList)

LoadDeploymentData updates the DeploymentEntities state with new data

func (*DeploymentEntities) SetCursor

func (e *DeploymentEntities) SetCursor(g1 *gocui.Gui, pos int)

SetCursor updates the DeploymentEntities state with a new cursor position (absolute)

func (*DeploymentEntities) SetFilter

func (e *DeploymentEntities) SetFilter(g1 *gocui.Gui, filter string)

SetFilter updates the DeploymentEntities state with a new filter

type EntitiesReducer

type EntitiesReducer struct {
	Pods        *PodEntities
	Debug       *DebugEntities
	Errors      *ErrorEntities
	Namespaces  *NamespaceEntities
	Resources   *ResourceEntities
	Deployments *DeploymentEntities
}

EntitiesReducer contains the data for Entities

type ErrorEntities

type ErrorEntities struct {
	Lines        []string
	Acknowledged bool
}

ErrorEntities contains the data for Errors

type ModalKind

type ModalKind string

ModalKind is the type of Modal

const (
	// KindDebug is a special debug modal
	KindDebug ModalKind = "Debug"
	// KindModalNamespaces represents a modal of the type namespace
	KindModalNamespaces ModalKind = "Namespaces"
	// KindModalResources represents a modal of the type resource
	KindModalResources ModalKind = "Resources"
	// KindModalSelectContainer represents a modal of the type container selection
	KindModalSelectContainer ModalKind = "Container"
	// KindModalContainerLogs represents a modal of the type container logs
	KindModalContainerLogs ModalKind = "ContainerLogs"
)

func (ModalKind) String

func (k ModalKind) String() string

String returns the string representation of the ModalKind

type ModalSize

type ModalSize string

ModalSize is the size of the modal

type ModalView

type ModalView struct {
	Title    string
	Kind     ModalKind
	Cursor   int
	Selected string
	Lines    []string
	Size     ModalSize
}

ModalView is the UI state of the modal component

func (*ModalView) CursorMove

func (mv *ModalView) CursorMove(g1 *gocui.Gui, delta int)

CursorMove updates the UI state with a new cursor position (delta)

func (*ModalView) SetCursor

func (mv *ModalView) SetCursor(g1 *gocui.Gui, pos int)

SetCursor updates the modal UI state's cursor position

func (*ModalView) SetKind

func (mv *ModalView) SetKind(g1 *gocui.Gui, kind ModalKind)

SetKind updates the modal UI state's kind

func (*ModalView) SetLines

func (mv *ModalView) SetLines(g1 *gocui.Gui, lines []string)

SetLines updates the modal UI state's lines

func (*ModalView) SetSize

func (mv *ModalView) SetSize(g1 *gocui.Gui, size ModalSize)

SetSize updates the modal UI state's size

func (*ModalView) SetTitle

func (mv *ModalView) SetTitle(g1 *gocui.Gui, title string)

SetTitle updates the modal UI state's title

type NamespaceEntities

type NamespaceEntities struct {
	Size           int
	Cursor         int
	Filter         string
	FilterKind     string
	Namespaces     *v1.NamespaceList `json:"-"`
	SendingRequest bool
}

NamespaceEntities contains the data for namespaces

func (*NamespaceEntities) CursorMove

func (e *NamespaceEntities) CursorMove(g *gocui.Gui, delta int)

CursorMove updates the namespace state with a new cursor position (delta)

func (*NamespaceEntities) LoadNamespaces

func (e *NamespaceEntities) LoadNamespaces(g1 *gocui.Gui, ns *v1.NamespaceList)

LoadNamespaces updates the namespace state with a new dataset

type ParsedFlags

type ParsedFlags struct {
	KubeConfigPath  string
	RefreshInterval int
	AutoRefresh     bool
	LogFilePath     string
	LogToFile       bool
	Prod            bool
	Debug           bool
	Test            bool
}

ParsedFlags will contain the config for the app

func (*ParsedFlags) Parse

func (flags *ParsedFlags) Parse(c *cli.Context) error

Parse will parse the flags into a struct

type PodEntities

type PodEntities struct {
	Cursor         int
	Filter         string
	FilterKind     string
	Pods           *v1.PodList `json:"-"`
	SendingRequest bool
	Size           int
}

PodEntities represents the Pod data

func (*PodEntities) ClearFilter

func (e *PodEntities) ClearFilter(g1 *gocui.Gui)

ClearFilter updates the PodEntities state with an empty filter

func (*PodEntities) CursorMove

func (e *PodEntities) CursorMove(g1 *gocui.Gui, delta int)

CursorMove updates the PodEntities state with a new filter

func (*PodEntities) LoadPodData

func (e *PodEntities) LoadPodData(g1 *gocui.Gui, pods *v1.PodList)

LoadPodData updates the PodEntities state with a new filter

func (*PodEntities) SetCursor

func (e *PodEntities) SetCursor(g1 *gocui.Gui, pos int)

SetCursor updates the PodEntities state with a new cursor position

func (*PodEntities) SetFilter

func (e *PodEntities) SetFilter(g1 *gocui.Gui, filter string)

SetFilter updates the PodEntities state with a new filter

type ResourceEntities

type ResourceEntities struct {
	Resources []string
}

ResourceEntities contains the data for Resources

type Screen

type Screen string

Screen represents a main window

const (
	// ScreenTable is the Table screen
	ScreenTable Screen = "Table"
	// ScreenModal is the Modal screen
	ScreenModal Screen = "Modal"
	// ScreenState is the State screen
	ScreenState Screen = "State"
	// ScreenDebug is the Debug screen
	ScreenDebug Screen = "Debug"
)

func (Screen) String

func (s Screen) String() string

type State

type State struct {
	UI       *UIReducer
	Entities *EntitiesReducer
}

State is the top level reducer

func (*State) JSONString

func (s *State) JSONString() (string, error)

JSONString returns a string representation of the top level reducer for debugging purposes

type TableKind

type TableKind string

TableKind is the type of Table

const (
	// KindTableDeployments is the table of type Deployments
	KindTableDeployments TableKind = "DeploymentsTable"
	// KindTablePods is the table of type Pods
	KindTablePods TableKind = "PodsTable"
	// KindTableNamespaces is the table of type Namespaces
	KindTableNamespaces TableKind = "NamespacesTable"
)

func (TableKind) String

func (k TableKind) String() string

String returns the string representation of the TableKind

type TableView

type TableView struct {
	Kind TableKind
}

TableView is the state for the table component

func (*TableView) SetKind

func (v *TableView) SetKind(g1 *gocui.Gui, kind TableKind)

SetKind updates the table view state with a new table kind

type UIReducer

type UIReducer struct {
	Table        *TableView
	Modal        *ModalView
	ActiveScreen Screen
}

UIReducer is a high level reducer that contains state of the different UI components in the app

func (*UIReducer) SetActiveScreen

func (ur *UIReducer) SetActiveScreen(g1 *gocui.Gui, screen Screen)

SetActiveScreen updates the UI state with a new active screen

Jump to

Keyboard shortcuts

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