component

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: Apache-2.0 Imports: 20 Imported by: 40

Documentation

Index

Constants

View Source
const (
	// WidthFull is a full width section.
	WidthFull int = 24
	// WidthQuarter is a quarter width section.
	WidthQuarter int = 6
	// WidthHalf is a half width section.
	WidthHalf int = 12
	// WidthThird is a third width section.
	WidthThird int = 8
)
View Source
const (
	FieldTypeCheckBox = "checkbox"
	FieldTypeRadio    = "radio"
	FieldTypeText     = "text"
	FieldTypePassword = "password"
	FieldTypeNumber   = "number"
	FieldTypeSelect   = "select"
	FieldTypeTextarea = "textarea"
	FieldTypeHidden   = "hidden"
)
View Source
const (
	// EdgeTypeImplicit is an implicit edge
	EdgeTypeImplicit = "implicit"
	// EdgeTypeExplicit is an explicit edge
	EdgeTypeExplicit = "explicit"
)
View Source
const (
	// GridActionKey is the key for grid action in a table row.
	GridActionKey = "_action"
)

Variables

View Source
var EmptyContentResponse = ContentResponse{}

EmptyContentResponse is an empty content response.

Functions

func AssertContentResponseEquals added in v0.10.0

func AssertContentResponseEquals(t *testing.T, expected, got ContentResponse)

AssertContentResponseEquals asserts two content responses are equal.

func AssertEqual

func AssertEqual(t *testing.T, expected, got Component)

AssertEqual asserts two components are equal.

func TitleFromTitleComponent

func TitleFromTitleComponent(tc []TitleComponent) (string, error)

TitleFromTitleComponent gets a title from a TitleComponent

Types

type Action

type Action struct {
	Name  string `json:"name"`
	Title string `json:"title"`
	Form  Form   `json:"form"`
	Modal bool   `json:"modal"`
}

Action is an action that can be performed on a component.

type AdjList

type AdjList map[string][]Edge

AdjList is an adjacency list - it maps nodes to edges

func (AdjList) Add

func (al AdjList) Add(src string, edge Edge)

Add adds a directed edge to the adjacency list

type Alert

type Alert struct {
	Type    AlertType `json:"type"`
	Message string    `json:"message"`
}

Alert is an alert. It can be used in components which support alerts.

func NewAlert

func NewAlert(alertType AlertType, message string) Alert

NewAlert creates an instance of Alert.

type AlertType

type AlertType string
const (
	// AlertTypeError is an error alert.
	AlertTypeError AlertType = "error"
	// AlertTypeWarning is a warning alert.
	AlertTypeWarning AlertType = "warning"
	// AlertTypeInfo is an info alert.
	AlertTypeInfo AlertType = "info"
	// AlertTypeSuccess is a success alert.
	AlertTypeSuccess AlertType = "success"
)

type Annotations

type Annotations struct {
	Config AnnotationsConfig `json:"config"`
	// contains filtered or unexported fields
}

Annotations is a component representing key/value based annotations

func NewAnnotations

func NewAnnotations(annotations map[string]string) *Annotations

NewAnnotations creates a annotations component

func (*Annotations) GetMetadata

func (t *Annotations) GetMetadata() Metadata

GetMetadata accesses the components metadata. Implements Component.

func (*Annotations) IsEmpty

func (t *Annotations) IsEmpty() bool

IsEmpty specifies whether the component is considered empty. Implements Component.

func (*Annotations) LessThan

func (b *Annotations) LessThan(i interface{}) bool

LessThan returns false.

func (*Annotations) MarshalJSON

func (t *Annotations) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Annotations) SetAccessor

func (b *Annotations) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Annotations) String

func (b *Annotations) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type AnnotationsConfig

type AnnotationsConfig struct {
	Annotations map[string]string `json:"annotations"`
}

AnnotationsConfig is the contents of Annotations

type Button

type Button struct {
	Name         string         `json:"name"`
	Payload      action.Payload `json:"payload"`
	Confirmation *Confirmation  `json:"confirmation,omitempty"`
}

Button is a button in a group.

func NewButton

func NewButton(name string, payload action.Payload, options ...ButtonOption) Button

NewButton creates an instance of Button.

type ButtonGroup

type ButtonGroup struct {
	Config ButtonGroupConfig `json:"config"`
	// contains filtered or unexported fields
}

ButtonGroup is a group of buttons.

func NewButtonGroup

func NewButtonGroup() *ButtonGroup

NewButtonGroup creates an instance of ButtonGroup.

func (*ButtonGroup) AddButton

func (bg *ButtonGroup) AddButton(button Button)

AddButton adds a button to the ButtonGroup.

func (*ButtonGroup) GetMetadata

func (b *ButtonGroup) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*ButtonGroup) IsEmpty

func (b *ButtonGroup) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*ButtonGroup) LessThan

func (b *ButtonGroup) LessThan(i interface{}) bool

LessThan returns false.

func (*ButtonGroup) MarshalJSON

func (bg *ButtonGroup) MarshalJSON() ([]byte, error)

MarshalJSON marshals a button group.

func (*ButtonGroup) SetAccessor

func (b *ButtonGroup) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*ButtonGroup) String

func (b *ButtonGroup) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type ButtonGroupConfig

type ButtonGroupConfig struct {
	// Buttons are buttons in the group.
	Buttons []Button `json:"buttons"`
}

ButtonGroupConfig is configuration for a button group.

type ButtonOption

type ButtonOption func(button *Button)

ButtonOption is a function for configuring a Button.

func WithButtonConfirmation

func WithButtonConfirmation(title, body string) ButtonOption

WithButtonConfirmation configured a button with a confirmation.

type Card

type Card struct {
	Config CardConfig `json:"config"`
	// contains filtered or unexported fields
}

Card is a card component.

func NewCard

func NewCard(title []TitleComponent) *Card

NewCard creates a card component.

func (*Card) AddAction

func (c *Card) AddAction(action Action)

AddAction adds an action to a card.

func (*Card) GetMetadata

func (b *Card) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*Card) IsEmpty

func (b *Card) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Card) LessThan

func (b *Card) LessThan(i interface{}) bool

LessThan returns false.

func (*Card) MarshalJSON

func (c *Card) MarshalJSON() ([]byte, error)

MarshalJSON marshals a card to JSON.

func (*Card) SetAccessor

func (b *Card) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Card) SetAlert

func (c *Card) SetAlert(alert Alert)

SetAlert sets an alert for a card.

func (*Card) SetBody

func (c *Card) SetBody(body Component)

SetBody sets the body for the card.

func (*Card) String

func (b *Card) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type CardConfig

type CardConfig struct {
	// Body is the body of the card.
	Body Component `json:"body"`
	// Actions are actions for the card.
	Actions []Action `json:"actions"`
	// Alert is the alert to show for the card.
	Alert *Alert `json:"alert,omitempty"`
}

CardConfig is configuration for the card component.

func (*CardConfig) UnmarshalJSON

func (c *CardConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a card config from JSON.

type CardList

type CardList struct {
	Config CardListConfig `json:"config"`
	// contains filtered or unexported fields
}

CardList is a component which comprises of a list of cards.

func NewCardList

func NewCardList(title string) *CardList

NewCardList creates a card list component.

func (*CardList) AddCard

func (c *CardList) AddCard(card Card)

AddCard adds a card to the list.

func (*CardList) GetMetadata

func (b *CardList) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*CardList) IsEmpty

func (b *CardList) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*CardList) LessThan

func (b *CardList) LessThan(i interface{}) bool

LessThan returns false.

func (*CardList) MarshalJSON

func (c *CardList) MarshalJSON() ([]byte, error)

MarshalJSON marshals a card list to JSON.

func (*CardList) SetAccessor

func (b *CardList) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*CardList) String

func (b *CardList) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type CardListConfig

type CardListConfig struct {
	// Cards is a slice of cads.
	Cards []Card `json:"cards"`
}

CardListConfig is configuration for a card list.

func (*CardListConfig) UnmarshalJSON

func (c *CardListConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a card list config from JSON.

type Code added in v0.11.0

type Code struct {
	Config CodeConfig `json:"config"`
	// contains filtered or unexported fields
}

Value is a component for code

func NewCodeBlock added in v0.11.0

func NewCodeBlock(s string) *Code

NewCodeBlock creates a code component

func (*Code) GetMetadata added in v0.11.0

func (b *Code) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*Code) IsEmpty added in v0.11.0

func (b *Code) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Code) LessThan added in v0.11.0

func (b *Code) LessThan(i interface{}) bool

LessThan returns false.

func (*Code) MarshalJSON added in v0.11.0

func (c *Code) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Code) SetAccessor added in v0.11.0

func (b *Code) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Code) String added in v0.11.0

func (b *Code) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type CodeConfig added in v0.11.0

type CodeConfig struct {
	Code string `json:"value"`
}

CodeConfig is the contents of Value

type Component

type Component interface {
	json.Marshaler

	// GetMetadata returns metadata for the component.
	GetMetadata() Metadata
	// SetAccessor sets the accessor for the component.
	SetAccessor(string)
	// IsEmpty returns true if the component is "empty".
	IsEmpty() bool
	// String returns a string representation of the component.
	String() string
	// LessThan returns true if the components value is less than the other value.
	LessThan(other interface{}) bool
}

Component is a common interface for the data representation of visual components as rendered by the UI.

type Confirmation

type Confirmation struct {
	Title string `json:"title"`
	Body  string `json:"body"`
}

Confirmation is configuration for a confirmation dialog.

type ContainerDef

type ContainerDef struct {
	Name  string `json:"name"`
	Image string `json:"image"`
}

ContainerDef defines an individual docker container

type Containers

type Containers struct {
	Config ContainersConfig `json:"config"`
	// contains filtered or unexported fields
}

Containers is a component wrapping multiple docker container definitions

func NewContainers

func NewContainers() *Containers

NewContainers creates a containers component

func (*Containers) Add

func (t *Containers) Add(name string, image string)

Add adds additional items to the tail of the containers.

func (*Containers) GetMetadata

func (t *Containers) GetMetadata() Metadata

GetMetadata accesses the components metadata. Implements Component.

func (*Containers) IsEmpty

func (b *Containers) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Containers) LessThan

func (b *Containers) LessThan(i interface{}) bool

LessThan returns false.

func (*Containers) MarshalJSON

func (t *Containers) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Containers) SetAccessor

func (b *Containers) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Containers) String

func (b *Containers) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type ContainersConfig

type ContainersConfig struct {
	Containers []ContainerDef `json:"containers"`
}

ContainersConfig is the contents of a Containers wrapper

type ContentResponse

type ContentResponse struct {
	Title              []TitleComponent `json:"title,omitempty"`
	Components         []Component      `json:"viewComponents"`
	ExtensionComponent Component        `json:"extensionComponent,omitempty"`
	ButtonGroup        *ButtonGroup     `json:"buttonGroup,omitempty"`
}

ContentResponse is a a content response. It contains a title and one or more components.

func NewContentResponse

func NewContentResponse(title []TitleComponent) *ContentResponse

NewContentResponse creates an instance of ContentResponse.

func (*ContentResponse) Add

func (c *ContentResponse) Add(components ...Component)

Add adds zero or more components to a content response. Nil components will be ignored.

func (*ContentResponse) AddButton added in v0.11.0

func (c *ContentResponse) AddButton(name string, payload action.Payload, buttonOptions ...ButtonOption)

AddButton adds one or more actions to a content response.

func (*ContentResponse) SetExtension added in v0.10.0

func (c *ContentResponse) SetExtension(component *Extension)

SetExtension adds zero or more components to an extension content response.

func (*ContentResponse) UnmarshalJSON

func (c *ContentResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a content response from JSON.

type DonutChart added in v0.10.0

type DonutChart struct {
	Config DonutChartConfig `json:"config"`
	// contains filtered or unexported fields
}

func NewDonutChart added in v0.10.0

func NewDonutChart() *DonutChart

func (*DonutChart) GetMetadata added in v0.10.0

func (b *DonutChart) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*DonutChart) IsEmpty added in v0.10.0

func (b *DonutChart) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*DonutChart) LessThan added in v0.10.0

func (b *DonutChart) LessThan(i interface{}) bool

LessThan returns false.

func (*DonutChart) MarshalJSON added in v0.10.0

func (dc *DonutChart) MarshalJSON() ([]byte, error)

func (*DonutChart) SetAccessor added in v0.10.0

func (b *DonutChart) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*DonutChart) SetLabels added in v0.10.0

func (dc *DonutChart) SetLabels(plural string, singular string)

func (*DonutChart) SetSegments added in v0.10.0

func (dc *DonutChart) SetSegments(segments []DonutSegment)

func (*DonutChart) SetSize added in v0.10.0

func (dc *DonutChart) SetSize(size DonutChartSize)

func (*DonutChart) String added in v0.10.0

func (b *DonutChart) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type DonutChartConfig added in v0.10.0

type DonutChartConfig struct {
	Segments []DonutSegment   `json:"segments"`
	Labels   DonutChartLabels `json:"labels"`
	Size     DonutChartSize   `json:"size"`
}

type DonutChartLabels added in v0.10.0

type DonutChartLabels struct {
	Plural   string `json:"plural"`
	Singular string `json:"singular"`
}

type DonutChartSize added in v0.10.0

type DonutChartSize int
const (
	DonutChartSizeSmall  DonutChartSize = 21
	DonutChartSizeMedium DonutChartSize = 42
)

type DonutSegment added in v0.10.0

type DonutSegment struct {
	Count  int        `json:"count"`
	Status NodeStatus `json:"status"`
}

type Edge

type Edge struct {
	Node string   `json:"node"`
	Type EdgeType `json:"edge"`
}

Edge represents a directed edge in a graph

type EdgeType

type EdgeType string

EdgeType represents whether a relationship between resources is implicit or explicit

type Editor added in v0.11.0

type Editor struct {
	Config EditorConfig `json:"config"`
	// contains filtered or unexported fields
}

Value is a component for code

func NewEditor added in v0.11.0

func NewEditor(title []TitleComponent, value string, readOnly bool) *Editor

NewCodeBlock creates a code component

func (*Editor) GetMetadata added in v0.11.0

func (e *Editor) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*Editor) IsEmpty added in v0.11.0

func (b *Editor) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Editor) LessThan added in v0.11.0

func (b *Editor) LessThan(i interface{}) bool

LessThan returns false.

func (*Editor) MarshalJSON added in v0.11.0

func (e *Editor) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Editor) SetAccessor added in v0.11.0

func (b *Editor) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Editor) SetValueFromObject added in v0.11.0

func (e *Editor) SetValueFromObject(object runtime.Object) error

func (*Editor) String added in v0.11.0

func (b *Editor) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type EditorConfig added in v0.11.0

type EditorConfig struct {
	Value    string            `json:"value"`
	ReadOnly bool              `json:"readOnly"`
	Metadata map[string]string `json:"metadata"`
}

CodeConfig is the contents of Value

type Error

type Error struct {
	Config ErrorConfig `json:"config"`
	// contains filtered or unexported fields
}

Error is a component for freetext

func NewError

func NewError(title []TitleComponent, err error) *Error

NewError creates a text component

func (*Error) GetMetadata

func (b *Error) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*Error) IsEmpty

func (b *Error) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Error) LessThan

func (t *Error) LessThan(i interface{}) bool

LessThan returns true if this component's value is less than the argument supplied.

func (*Error) MarshalJSON

func (t *Error) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Error) SetAccessor

func (b *Error) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Error) String

func (t *Error) String() string

String returns the text content of the component.

func (*Error) SupportsTitle

func (t *Error) SupportsTitle()

SupportsTitle denotes this is a TextComponent.

type ErrorConfig

type ErrorConfig struct {
	Data string `json:"data,omitempty"`
}

ErrorConfig is the contents of Text

type ExpressionSelector

type ExpressionSelector struct {
	Config ExpressionSelectorConfig `json:"config"`
	// contains filtered or unexported fields
}

ExpressionSelector is a component for a single expression within a selector

func NewExpressionSelector

func NewExpressionSelector(k string, o Operator, values []string) *ExpressionSelector

NewExpressionSelector creates a expressionSelector component

func (*ExpressionSelector) GetMetadata

func (t *ExpressionSelector) GetMetadata() Metadata

GetMetadata accesses the components metadata. Implements Component.

func (*ExpressionSelector) IsEmpty

func (b *ExpressionSelector) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*ExpressionSelector) IsSelector

func (t *ExpressionSelector) IsSelector()

IsSelector marks the component as selector flavor. Implements Selector.

func (*ExpressionSelector) LessThan

func (b *ExpressionSelector) LessThan(i interface{}) bool

LessThan returns false.

func (*ExpressionSelector) MarshalJSON

func (t *ExpressionSelector) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*ExpressionSelector) Name

func (t *ExpressionSelector) Name() string

Name is the name of the ExpressionSelector.

func (*ExpressionSelector) SetAccessor

func (b *ExpressionSelector) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*ExpressionSelector) String

func (b *ExpressionSelector) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type ExpressionSelectorConfig

type ExpressionSelectorConfig struct {
	Key      string   `json:"key"`
	Operator Operator `json:"operator"`
	Values   []string `json:"values"`
}

ExpressionSelectorConfig is the contents of ExpressionSelector

type Extension added in v0.10.0

type Extension struct {
	Config ExtensionConfig `json:"config"`
	// contains filtered or unexported fields
}

func NewExtension added in v0.10.0

func NewExtension() *Extension

func (*Extension) AddTab added in v0.10.0

func (e *Extension) AddTab(tab ExtensionTab)

func (*Extension) GetMetadata added in v0.10.0

func (e *Extension) GetMetadata() Metadata

func (*Extension) IsEmpty added in v0.10.0

func (b *Extension) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Extension) LessThan added in v0.10.0

func (b *Extension) LessThan(i interface{}) bool

LessThan returns false.

func (*Extension) MarshalJSON added in v0.10.0

func (e *Extension) MarshalJSON() ([]byte, error)

func (*Extension) SetAccessor added in v0.10.0

func (b *Extension) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Extension) String added in v0.10.0

func (b *Extension) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type ExtensionConfig added in v0.10.0

type ExtensionConfig struct {
	Tabs []ExtensionTab `json:"tabs"`
}

type ExtensionTab added in v0.10.0

type ExtensionTab struct {
	Tab          Component      `json:"tab"`
	ClosePayload action.Payload `json:"payload,omitempty"`
}

func (*ExtensionTab) UnmarshalJSON added in v0.10.0

func (e *ExtensionTab) UnmarshalJSON(data []byte) error

type FlexLayout

type FlexLayout struct {
	Config FlexLayoutConfig `json:"config,omitempty"`
	// contains filtered or unexported fields
}

FlexLayout is a flex layout view.

func NewFlexLayout

func NewFlexLayout(title string) *FlexLayout

NewFlexLayout creates an instance of FlexLayout.

func (*FlexLayout) AddSections

func (fl *FlexLayout) AddSections(sections ...FlexLayoutSection)

AddSections adds one or more sections to the flex layout.

func (*FlexLayout) GetMetadata

func (b *FlexLayout) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*FlexLayout) IsEmpty

func (b *FlexLayout) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*FlexLayout) LessThan

func (b *FlexLayout) LessThan(i interface{}) bool

LessThan returns false.

func (*FlexLayout) MarshalJSON

func (fl *FlexLayout) MarshalJSON() ([]byte, error)

MarshalJSON marshals the flex layout to JSON.

func (*FlexLayout) SetAccessor

func (b *FlexLayout) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*FlexLayout) SetButtonGroup

func (fl *FlexLayout) SetButtonGroup(group *ButtonGroup)

func (*FlexLayout) String

func (b *FlexLayout) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type FlexLayoutConfig

type FlexLayoutConfig struct {
	Sections    []FlexLayoutSection `json:"sections,omitempty"`
	ButtonGroup *ButtonGroup        `json:"buttonGroup,omitempty"`
}

FlexLayoutConfig is configuration for the flex layout view.

func (*FlexLayoutConfig) UnmarshalJSON added in v0.11.0

func (f *FlexLayoutConfig) UnmarshalJSON(data []byte) error

type FlexLayoutItem

type FlexLayoutItem struct {
	Width  int       `json:"width,omitempty"`
	Height string    `json:"height,omitempty"`
	Margin string    `json:"margin,omitempty"`
	View   Component `json:"view,omitempty"`
}

FlexLayoutItem is an item in a flex layout.

func (*FlexLayoutItem) UnmarshalJSON

func (fli *FlexLayoutItem) UnmarshalJSON(data []byte) error

type FlexLayoutSection

type FlexLayoutSection []FlexLayoutItem

FlexLayoutSection is a slice of items group together.

type Form

type Form struct {
	Fields []FormField `json:"fields"`
}

func CreateFormForObject

func CreateFormForObject(actionName string, object runtime.Object, fields ...FormField) (Form, error)

CreateFormForObject creates a form for an object with additional fields.

func (*Form) MarshalJSON

func (f *Form) MarshalJSON() ([]byte, error)

func (*Form) UnmarshalJSON

func (f *Form) UnmarshalJSON(data []byte) error

type FormField

type FormField interface {
	Label() string
	Name() string
	Type() string
	Configuration() map[string]interface{}
	Value() interface{}

	json.Unmarshaler
	json.Marshaler
}

type FormFieldCheckBox

type FormFieldCheckBox struct {
	// contains filtered or unexported fields
}

func NewFormFieldCheckBox

func NewFormFieldCheckBox(label, name string, choices []InputChoice) *FormFieldCheckBox

func (*FormFieldCheckBox) Configuration

func (ff *FormFieldCheckBox) Configuration() map[string]interface{}

func (FormFieldCheckBox) Label

func (bff FormFieldCheckBox) Label() string

func (*FormFieldCheckBox) MarshalJSON

func (ff *FormFieldCheckBox) MarshalJSON() ([]byte, error)

func (FormFieldCheckBox) Name

func (bff FormFieldCheckBox) Name() string

func (FormFieldCheckBox) Type

func (bff FormFieldCheckBox) Type() string

func (*FormFieldCheckBox) UnmarshalJSON

func (ff *FormFieldCheckBox) UnmarshalJSON(data []byte) error

func (*FormFieldCheckBox) Value

func (ff *FormFieldCheckBox) Value() interface{}

type FormFieldHidden

type FormFieldHidden struct {
	// contains filtered or unexported fields
}

func NewFormFieldHidden

func NewFormFieldHidden(name, value string) *FormFieldHidden

func (*FormFieldHidden) Configuration

func (ff *FormFieldHidden) Configuration() map[string]interface{}

func (FormFieldHidden) Label

func (bff FormFieldHidden) Label() string

func (*FormFieldHidden) MarshalJSON

func (ff *FormFieldHidden) MarshalJSON() ([]byte, error)

func (FormFieldHidden) Name

func (bff FormFieldHidden) Name() string

func (FormFieldHidden) Type

func (bff FormFieldHidden) Type() string

func (*FormFieldHidden) UnmarshalJSON

func (ff *FormFieldHidden) UnmarshalJSON(data []byte) error

func (*FormFieldHidden) Value

func (ff *FormFieldHidden) Value() interface{}

type FormFieldNumber

type FormFieldNumber struct {
	// contains filtered or unexported fields
}

func NewFormFieldNumber

func NewFormFieldNumber(label, name, value string) *FormFieldNumber

func (*FormFieldNumber) Configuration

func (ff *FormFieldNumber) Configuration() map[string]interface{}

func (FormFieldNumber) Label

func (bff FormFieldNumber) Label() string

func (*FormFieldNumber) MarshalJSON

func (ff *FormFieldNumber) MarshalJSON() ([]byte, error)

func (FormFieldNumber) Name

func (bff FormFieldNumber) Name() string

func (FormFieldNumber) Type

func (bff FormFieldNumber) Type() string

func (*FormFieldNumber) UnmarshalJSON

func (ff *FormFieldNumber) UnmarshalJSON(data []byte) error

func (*FormFieldNumber) Value

func (ff *FormFieldNumber) Value() interface{}

type FormFieldPassword

type FormFieldPassword struct {
	// contains filtered or unexported fields
}

func NewFormFieldPassword

func NewFormFieldPassword(label, name, value string) *FormFieldPassword

func (*FormFieldPassword) Configuration

func (ff *FormFieldPassword) Configuration() map[string]interface{}

func (FormFieldPassword) Label

func (bff FormFieldPassword) Label() string

func (*FormFieldPassword) MarshalJSON

func (ff *FormFieldPassword) MarshalJSON() ([]byte, error)

func (FormFieldPassword) Name

func (bff FormFieldPassword) Name() string

func (FormFieldPassword) Type

func (bff FormFieldPassword) Type() string

func (*FormFieldPassword) UnmarshalJSON

func (ff *FormFieldPassword) UnmarshalJSON(data []byte) error

func (*FormFieldPassword) Value

func (ff *FormFieldPassword) Value() interface{}

type FormFieldRadio

type FormFieldRadio struct {
	// contains filtered or unexported fields
}

func NewFormFieldRadio

func NewFormFieldRadio(label, name string, choices []InputChoice) *FormFieldRadio

func (*FormFieldRadio) Configuration

func (ff *FormFieldRadio) Configuration() map[string]interface{}

func (FormFieldRadio) Label

func (bff FormFieldRadio) Label() string

func (*FormFieldRadio) MarshalJSON

func (ff *FormFieldRadio) MarshalJSON() ([]byte, error)

func (FormFieldRadio) Name

func (bff FormFieldRadio) Name() string

func (FormFieldRadio) Type

func (bff FormFieldRadio) Type() string

func (*FormFieldRadio) UnmarshalJSON

func (ff *FormFieldRadio) UnmarshalJSON(data []byte) error

func (*FormFieldRadio) Value

func (ff *FormFieldRadio) Value() interface{}

type FormFieldSelect

type FormFieldSelect struct {
	// contains filtered or unexported fields
}

func NewFormFieldSelect

func NewFormFieldSelect(label, name string, choices []InputChoice, multiple bool) *FormFieldSelect

func (*FormFieldSelect) Configuration

func (ff *FormFieldSelect) Configuration() map[string]interface{}

func (FormFieldSelect) Label

func (bff FormFieldSelect) Label() string

func (*FormFieldSelect) MarshalJSON

func (ff *FormFieldSelect) MarshalJSON() ([]byte, error)

func (FormFieldSelect) Name

func (bff FormFieldSelect) Name() string

func (FormFieldSelect) Type

func (bff FormFieldSelect) Type() string

func (*FormFieldSelect) UnmarshalJSON

func (ff *FormFieldSelect) UnmarshalJSON(data []byte) error

func (*FormFieldSelect) Value

func (ff *FormFieldSelect) Value() interface{}

type FormFieldText

type FormFieldText struct {
	// contains filtered or unexported fields
}

func NewFormFieldText

func NewFormFieldText(label, name, value string) *FormFieldText

func (*FormFieldText) Configuration

func (ff *FormFieldText) Configuration() map[string]interface{}

func (FormFieldText) Label

func (bff FormFieldText) Label() string

func (*FormFieldText) MarshalJSON

func (ff *FormFieldText) MarshalJSON() ([]byte, error)

func (FormFieldText) Name

func (bff FormFieldText) Name() string

func (FormFieldText) Type

func (bff FormFieldText) Type() string

func (*FormFieldText) UnmarshalJSON

func (ff *FormFieldText) UnmarshalJSON(data []byte) error

func (*FormFieldText) Value

func (ff *FormFieldText) Value() interface{}

type FormFieldTextarea

type FormFieldTextarea struct {
	// contains filtered or unexported fields
}

func NewFormFieldTextarea

func NewFormFieldTextarea(label, name, value string) *FormFieldTextarea

func (*FormFieldTextarea) Configuration

func (ff *FormFieldTextarea) Configuration() map[string]interface{}

func (FormFieldTextarea) Label

func (bff FormFieldTextarea) Label() string

func (*FormFieldTextarea) MarshalJSON

func (ff *FormFieldTextarea) MarshalJSON() ([]byte, error)

func (FormFieldTextarea) Name

func (bff FormFieldTextarea) Name() string

func (FormFieldTextarea) Type

func (bff FormFieldTextarea) Type() string

func (*FormFieldTextarea) UnmarshalJSON

func (ff *FormFieldTextarea) UnmarshalJSON(data []byte) error

func (*FormFieldTextarea) Value

func (ff *FormFieldTextarea) Value() interface{}

type Graphviz

type Graphviz struct {
	Config GraphvizConfig `json:"config"`
	// contains filtered or unexported fields
}

Graphviz is a component for displaying graphviz diagrams.

func NewGraphviz

func NewGraphviz(dot string) *Graphviz

func (*Graphviz) GetMetadata

func (b *Graphviz) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*Graphviz) IsEmpty

func (b *Graphviz) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Graphviz) LessThan

func (b *Graphviz) LessThan(i interface{}) bool

LessThan returns false.

func (*Graphviz) MarshalJSON

func (g *Graphviz) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Graphviz) SetAccessor

func (b *Graphviz) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Graphviz) String

func (b *Graphviz) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type GraphvizConfig

type GraphvizConfig struct {
	DOT string `json:"dot,omitempty"`
}

GraphvizConfig is the contents of Graphviz.

type GridAction added in v0.12.0

type GridAction struct {
	// Name is the name of action. It will be shown to the user.
	Name string `json:"name"`
	// ActionPath is the path of the action.
	ActionPath string `json:"actionPath"`
	// Payload is the payload that will be submitted with the action is invoked.
	Payload action.Payload `json:"payload"`
	// Confirmation is a confirmation that will be show to the user before the
	// action is invoked. It is optional.
	Confirmation *Confirmation `json:"confirmation"`
	// Type is the type of button that will be created.
	Type GridActionType `json:"type"`
}

GridAction is an action that can be performed on a data grid row.

type GridActionType added in v0.13.0

type GridActionType string

GridActionType is the type of this action. It is used to style buttons.

const (
	// GridActionPrimary is the default color.
	GridActionPrimary GridActionType = "primary"
	// GridActionDanger is for a dangerous action. A dangerous action is one that will change the state
	// of the cluster.
	GridActionDanger GridActionType = "danger"
)

type GridActions added in v0.12.0

type GridActions struct {
	Config GridActionsConfig `json:"config"`
	// contains filtered or unexported fields
}

GridActions add the ability to have specific actions for rows. This will allow for dynamic injection of actions that could be dependent on the content of a grid row.

func NewGridActions added in v0.12.0

func NewGridActions() *GridActions

NewGridActions creates an instance of GridActions.

func (*GridActions) AddAction added in v0.12.0

func (a *GridActions) AddAction(
	name, actionPath string,
	payload action.Payload,
	confirmation *Confirmation,
	actionType GridActionType)

AddAction adds an action to GridActions.

func (*GridActions) AddGridAction added in v0.13.0

func (a *GridActions) AddGridAction(gridAction GridAction)

AddGridAction adds a GridAction to GridActions.

func (*GridActions) GetMetadata added in v0.12.0

func (b *GridActions) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*GridActions) IsEmpty added in v0.12.0

func (b *GridActions) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*GridActions) LessThan added in v0.12.0

func (b *GridActions) LessThan(i interface{}) bool

LessThan returns false.

func (GridActions) MarshalJSON added in v0.12.0

func (a GridActions) MarshalJSON() ([]byte, error)

MarshalJSON converts the GridActions to a JSON.

func (*GridActions) SetAccessor added in v0.12.0

func (b *GridActions) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*GridActions) String added in v0.12.0

func (b *GridActions) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type GridActionsConfig added in v0.12.0

type GridActionsConfig struct {
	// Actions is a slice that contains actions that can be performed by the user.
	Actions []GridAction `json:"actions"`
}

GridActionsConfig is configuration items for GridActions.

type IFrame added in v0.10.0

type IFrame struct {
	Config IFrameConfig `json:"config"`
	// contains filtered or unexported fields
}

IFrame is a component for displaying content in an iframe

func NewIFrame added in v0.10.0

func NewIFrame(url string, title string) *IFrame

NewIFrame creates an iframe component

func (*IFrame) GetMetadata added in v0.10.0

func (b *IFrame) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*IFrame) IsEmpty added in v0.10.0

func (b *IFrame) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*IFrame) LessThan added in v0.10.0

func (t *IFrame) LessThan(i interface{}) bool

LessThan returns true if this component's url is lexically less than the argument supplied.

func (*IFrame) MarshalJSON added in v0.10.0

func (t *IFrame) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*IFrame) SetAccessor added in v0.10.0

func (b *IFrame) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*IFrame) String added in v0.10.0

func (t *IFrame) String() string

String returns the url content of the component.

type IFrameConfig added in v0.10.0

type IFrameConfig struct {
	Url   string `json:"url"`
	Title string `json:"title"`
}

IFrameConfig is the title and url of the iframe

type IFrameMarshal added in v0.10.0

type IFrameMarshal IFrame

type InputChoice

type InputChoice struct {
	Label   string `json:"label"`
	Value   string `json:"value"`
	Checked bool   `json:"checked"`
}

type LabelSelector

type LabelSelector struct {
	Config LabelSelectorConfig `json:"config"`
	// contains filtered or unexported fields
}

LabelSelector is a component for a single label within a selector

func NewLabelSelector

func NewLabelSelector(k, v string) *LabelSelector

NewLabelSelector creates a labelSelector component

func (*LabelSelector) GetMetadata

func (t *LabelSelector) GetMetadata() Metadata

GetMetadata accesses the components metadata. Implements Component.

func (*LabelSelector) IsEmpty

func (b *LabelSelector) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*LabelSelector) IsSelector

func (t *LabelSelector) IsSelector()

IsSelector marks the component as selector flavor. Implements Selector.

func (*LabelSelector) LessThan

func (b *LabelSelector) LessThan(i interface{}) bool

LessThan returns false.

func (*LabelSelector) MarshalJSON

func (t *LabelSelector) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*LabelSelector) Name

func (t *LabelSelector) Name() string

Name is the name of the LabelSelector.

func (*LabelSelector) SetAccessor

func (b *LabelSelector) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*LabelSelector) String

func (b *LabelSelector) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type LabelSelectorConfig

type LabelSelectorConfig struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

LabelSelectorConfig is the contents of LabelSelector

type Labels

type Labels struct {
	Config LabelsConfig `json:"config"`
	// contains filtered or unexported fields
}

Labels is a component representing key/value based labels

func NewLabels

func NewLabels(labels map[string]string) *Labels

NewLabels creates a labels component

func (*Labels) GetMetadata

func (t *Labels) GetMetadata() Metadata

GetMetadata accesses the components metadata. Implements Component.

func (*Labels) IsEmpty

func (b *Labels) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Labels) LessThan

func (b *Labels) LessThan(i interface{}) bool

LessThan returns false.

func (*Labels) MarshalJSON

func (t *Labels) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will filter label keys specified in `labelsFilteredKeys`.

func (*Labels) SetAccessor

func (b *Labels) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Labels) String

func (b *Labels) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type LabelsConfig

type LabelsConfig struct {
	Labels map[string]string `json:"labels"`
}

LabelsConfig is the contents of Labels

type Link struct {
	Config LinkConfig `json:"config"`
	// contains filtered or unexported fields
}

Link is a text component that contains a link.

func NewLink(title, s, ref string, options ...LinkOption) *Link

NewLink creates a link component

func (*Link) GetMetadata

func (t *Link) GetMetadata() Metadata

GetMetadata accesses the components metadata. Implements Component.

func (*Link) IsEmpty

func (b *Link) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Link) LessThan

func (t *Link) LessThan(i interface{}) bool

LessThan returns true if this component's value is less than the argument supplied.

func (*Link) MarshalJSON

func (t *Link) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Link) Ref

func (t *Link) Ref() string

Ref returns the link's ref.

func (*Link) SetAccessor

func (b *Link) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Link) SetStatus added in v0.13.0

func (t *Link) SetStatus(status TextStatus, detail Component)

SetStatus sets the status of the text component.

func (*Link) String

func (t *Link) String() string

String returns the link's text.

func (*Link) SupportsTitle

func (t *Link) SupportsTitle()

SupportsTitle designates this is a TextComponent.

func (*Link) Text

func (t *Link) Text() string

Text returns the link's text.

type LinkConfig

type LinkConfig struct {
	Text string `json:"value"`
	Ref  string `json:"ref"`
	// Status sets the status of the component.
	Status       TextStatus `json:"status,omitempty"`
	StatusDetail Component  `json:"statusDetail,omitempty"`
}

LinkConfig is the contents of Link

type LinkOption added in v0.13.0

type LinkOption func(l *Link)

type List

type List struct {
	Config ListConfig `json:"config"`
	// contains filtered or unexported fields
}

List contains other Components

func NewList

func NewList(title []TitleComponent, items []Component) *List

NewList creates a list component

func (*List) Add

func (t *List) Add(items ...Component)

Add adds additional items to the tail of the list.

func (*List) GetMetadata

func (b *List) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*List) IsEmpty

func (b *List) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*List) LessThan

func (b *List) LessThan(i interface{}) bool

LessThan returns false.

func (*List) MarshalJSON

func (t *List) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*List) SetAccessor

func (b *List) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*List) String

func (b *List) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type ListConfig

type ListConfig struct {
	Items []Component `json:"items"`
}

ListConfig is the contents of a List

func (*ListConfig) UnmarshalJSON

func (t *ListConfig) UnmarshalJSON(data []byte) error

type Loading

type Loading struct {
	Config LoadingConfig `json:"config"`
	// contains filtered or unexported fields
}

Loading is a component for a spinner

func NewLoading

func NewLoading(title []TitleComponent, message string) *Loading

NewLoading creates a loading component

func (*Loading) GetMetadata

func (b *Loading) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*Loading) IsEmpty

func (b *Loading) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Loading) LessThan

func (b *Loading) LessThan(i interface{}) bool

LessThan returns false.

func (*Loading) MarshalJSON

func (t *Loading) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Loading) SetAccessor

func (b *Loading) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Loading) String

func (t *Loading) String() string

String returns the text content of the component.

func (*Loading) SupportsTitle

func (t *Loading) SupportsTitle()

SupportsTitle denotes this is a LoadingComponent.

type LoadingConfig

type LoadingConfig struct {
	Text string `json:"value"`
}

LoadingConfig is the contents of Loading

type Logs

type Logs struct {
	Config LogsConfig `json:"config,omitempty"`
	// contains filtered or unexported fields
}

func NewLogs

func NewLogs(namespace, name string, containers ...string) *Logs

func (*Logs) GetMetadata

func (l *Logs) GetMetadata() Metadata

GetMetadata accesses the components metadata. Implements Component.

func (*Logs) IsEmpty

func (b *Logs) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Logs) LessThan

func (b *Logs) LessThan(i interface{}) bool

LessThan returns false.

func (*Logs) MarshalJSON

func (l *Logs) MarshalJSON() ([]byte, error)

func (*Logs) SetAccessor

func (b *Logs) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Logs) String

func (b *Logs) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type LogsConfig

type LogsConfig struct {
	Namespace  string   `json:"namespace,omitempty"`
	Name       string   `json:"name,omitempty"`
	Containers []string `json:"containers,omitempty"`
}

type Metadata

type Metadata struct {
	Type     string           `json:"type"`
	Title    []TitleComponent `json:"title,omitempty"`
	Accessor string           `json:"accessor,omitempty"`
}

Metadata collects common fields describing Components

func (*Metadata) SetTitleText

func (m *Metadata) SetTitleText(parts ...string)

SetTitleText sets the title using text components.

func (*Metadata) UnmarshalJSON

func (m *Metadata) UnmarshalJSON(data []byte) error

type Node

type Node struct {
	Name       string      `json:"name,omitempty"`
	APIVersion string      `json:"apiVersion,omitempty"`
	Kind       string      `json:"kind,omitempty"`
	Status     NodeStatus  `json:"status,omitempty"`
	Details    []Component `json:"details,omitempty"`
	Path       *Link       `json:"path,omitempty"`
}

Node is a node in a graph, representing a kubernetes object IsNetwork is a hint to the layout engine.

type NodeStatus

type NodeStatus string
const (
	// NodeStatusOK means a node is in a health state
	NodeStatusOK NodeStatus = "ok"
	// NodeStatusWarning means ...
	NodeStatusWarning NodeStatus = "warning"
	// NodeStatusError means ...
	NodeStatusError NodeStatus = "error"
)

type Nodes

type Nodes map[string]Node

Nodes is a set of graph nodes

type Operator

type Operator string

Operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.

const (
	// OperatorIn means a key value is in a set of possible values
	OperatorIn Operator = "In"
	// OperatorNotIn means a key value is not in a set of exclusionary values
	OperatorNotIn Operator = "NotIn"
	// OperatorExists means a key exists on the selected resource
	OperatorExists Operator = "Exists"
	// OperatorDoesNotExist means a key does not exists on the selected resource
	OperatorDoesNotExist Operator = "DoesNotExist"
)

func MatchOperator

func MatchOperator(s string) (Operator, error)

MatchOperator matches an operator.

type PodStatus

type PodStatus struct {
	Config PodStatusConfig `json:"config"`
	// contains filtered or unexported fields
}

PodStatus represents the status for a group of pods.

func NewPodStatus

func NewPodStatus() *PodStatus

NewPodStatus creates a PodStatus.

func (*PodStatus) AddSummary

func (ps *PodStatus) AddSummary(name string, details []Component, status NodeStatus)

AddSummary adds summary for a pod.

func (*PodStatus) GetMetadata

func (b *PodStatus) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*PodStatus) IsEmpty

func (b *PodStatus) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*PodStatus) LessThan

func (b *PodStatus) LessThan(i interface{}) bool

LessThan returns false.

func (*PodStatus) MarshalJSON

func (ps *PodStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*PodStatus) SetAccessor

func (b *PodStatus) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*PodStatus) Status

func (ps *PodStatus) Status() NodeStatus

func (*PodStatus) String

func (b *PodStatus) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type PodStatusConfig

type PodStatusConfig struct {
	Pods map[string]PodSummary `json:"pods,omitempty"`
}

PodStatusConfig is config for PodStatus.

type PodSummary

type PodSummary struct {
	Details []Component `json:"details,omitempty"`
	Status  NodeStatus  `json:"status,omitempty"`
}

PodSummary is a status summary for a pod.

func (*PodSummary) UnmarshalJSON

func (podSummary *PodSummary) UnmarshalJSON(data []byte) error

type Port

type Port struct {
	Config PortConfig `json:"config"`
	// contains filtered or unexported fields
}

Port is a component for a port

func NewPort

func NewPort(namespace, apiVersion, kind, name string, port int, protocol string, pfs PortForwardState) *Port

NewPort creates a port component

func (*Port) GetMetadata

func (t *Port) GetMetadata() Metadata

GetMetadata accesses the components metadata. Implements Component.

func (*Port) IsEmpty

func (b *Port) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Port) LessThan

func (b *Port) LessThan(i interface{}) bool

LessThan returns false.

func (*Port) MarshalJSON

func (t *Port) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Port) SetAccessor

func (b *Port) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Port) String

func (b *Port) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type PortConfig

type PortConfig struct {
	Port     int              `json:"port,omitempty"`
	Protocol string           `json:"protocol,omitempty"`
	State    PortForwardState `json:"state,omitempty"`
	Button   *ButtonGroup     `json:"buttonGroup,omitempty"`
}

PortConfig is the contents of Port

type PortForwardState

type PortForwardState struct {
	IsForwardable bool   `json:"isForwardable,omitempty"`
	IsForwarded   bool   `json:"isForwarded,omitempty"`
	Port          int    `json:"port,omitempty"`
	ID            string `json:"id,omitempty"`
}

type Ports

type Ports struct {
	Config PortsConfig `json:"config,omitempty"`
	// contains filtered or unexported fields
}

func NewPorts

func NewPorts(ports []Port) *Ports

func (*Ports) GetMetadata

func (t *Ports) GetMetadata() Metadata

func (*Ports) IsEmpty

func (b *Ports) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Ports) LessThan

func (b *Ports) LessThan(i interface{}) bool

LessThan returns false.

func (*Ports) MarshalJSON

func (t *Ports) MarshalJSON() ([]byte, error)

func (*Ports) SetAccessor

func (b *Ports) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Ports) String

func (b *Ports) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type PortsConfig

type PortsConfig struct {
	Ports []Port `json:"ports,omitempty"`
}

type Quadrant

type Quadrant struct {
	Config QuadrantConfig `json:"config"`
	// contains filtered or unexported fields
}

func NewQuadrant

func NewQuadrant(title string) *Quadrant

NewQuadrant creates a quadrant component

func (*Quadrant) GetMetadata

func (t *Quadrant) GetMetadata() Metadata

GetMetadata accesses the components metadata. Implements Component.

func (*Quadrant) IsEmpty

func (b *Quadrant) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Quadrant) LessThan

func (b *Quadrant) LessThan(i interface{}) bool

LessThan returns false.

func (*Quadrant) MarshalJSON

func (t *Quadrant) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Quadrant) Set

func (t *Quadrant) Set(pos QuadrantPosition, label, value string) error

Set adds additional panels to the quadrant

func (*Quadrant) SetAccessor

func (b *Quadrant) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Quadrant) String

func (b *Quadrant) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type QuadrantConfig

type QuadrantConfig struct {
	NW QuadrantValue `json:"nw,omitempty"`
	NE QuadrantValue `json:"ne,omitempty"`
	SE QuadrantValue `json:"se,omitempty"`
	SW QuadrantValue `json:"sw,omitempty"`
}

QuadrantConfig is the contents of a Quadrant

type QuadrantPosition

type QuadrantPosition int

QuadrantPosition denotes a position within a quadrant

const (
	// QuadNW denotes the north-west position within a quadrant
	QuadNW QuadrantPosition = iota
	// QuadNE denotes the north-east position within a quadrant
	QuadNE
	// QuadSE denotes the south-east position within a quadrant
	QuadSE
	// QuadSW denotes the south-west position within a quadrant
	QuadSW
)

type QuadrantValue

type QuadrantValue struct {
	Value string `json:"value,omitempty"`
	Label string `json:"label,omitempty"`
}

type ResourceViewer

type ResourceViewer struct {
	Config ResourceViewerConfig `json:"config,omitempty"`
	// contains filtered or unexported fields
}

ResourceView is a resource viewer component.

func NewResourceViewer

func NewResourceViewer(title string) *ResourceViewer

NewResourceViewer creates a resource viewer component.

func (*ResourceViewer) AddEdge

func (rv *ResourceViewer) AddEdge(nodeID, childID string, edgeType EdgeType) error

func (*ResourceViewer) AddNode

func (rv *ResourceViewer) AddNode(id string, node Node)

func (*ResourceViewer) GetMetadata

func (rv *ResourceViewer) GetMetadata() Metadata

func (*ResourceViewer) IsEmpty

func (b *ResourceViewer) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*ResourceViewer) LessThan

func (b *ResourceViewer) LessThan(i interface{}) bool

LessThan returns false.

func (*ResourceViewer) MarshalJSON

func (rv *ResourceViewer) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*ResourceViewer) Select

func (rv *ResourceViewer) Select(id string)

func (*ResourceViewer) SetAccessor

func (b *ResourceViewer) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*ResourceViewer) String

func (b *ResourceViewer) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

func (*ResourceViewer) Validate

func (rv *ResourceViewer) Validate() error

type ResourceViewerConfig

type ResourceViewerConfig struct {
	Edges    AdjList `json:"edges,omitempty"`
	Nodes    Nodes   `json:"nodes,omitempty"`
	Selected string  `json:"selected,omitempty"`
}

ResourceViewerConfig is configuration for a resource viewer.

type Selector

type Selector interface {
	IsSelector()
	Name() string
}

Selector identifies a Component as being a selector flavor.

type Selectors

type Selectors struct {
	Config SelectorsConfig `json:"config"`
	// contains filtered or unexported fields
}

Selectors contains other Components

func NewSelectors

func NewSelectors(selectors []Selector) *Selectors

NewSelectors creates a selectors component

func (*Selectors) Add

func (t *Selectors) Add(selectors ...Selector)

Add adds additional items to the tail of the selectors.

func (*Selectors) GetMetadata

func (t *Selectors) GetMetadata() Metadata

GetMetadata accesses the components metadata. Implements Component.

func (*Selectors) IsEmpty

func (b *Selectors) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Selectors) LessThan

func (b *Selectors) LessThan(i interface{}) bool

LessThan returns false.

func (*Selectors) MarshalJSON

func (t *Selectors) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Selectors) SetAccessor

func (b *Selectors) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Selectors) String

func (b *Selectors) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type SelectorsConfig

type SelectorsConfig struct {
	Selectors []Selector `json:"selectors"`
}

SelectorsConfig is the contents of a Selectors

func (*SelectorsConfig) UnmarshalJSON

func (t *SelectorsConfig) UnmarshalJSON(data []byte) error

type SingleStat added in v0.10.0

type SingleStat struct {
	Config SingleStateConfig `json:"config"`
	// contains filtered or unexported fields
}

func NewSingleStat added in v0.10.0

func NewSingleStat(title, valueText, color string) *SingleStat

func (*SingleStat) GetMetadata added in v0.10.0

func (b *SingleStat) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*SingleStat) IsEmpty added in v0.10.0

func (b *SingleStat) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*SingleStat) LessThan added in v0.10.0

func (b *SingleStat) LessThan(i interface{}) bool

LessThan returns false.

func (*SingleStat) MarshalJSON added in v0.10.0

func (ss *SingleStat) MarshalJSON() ([]byte, error)

func (*SingleStat) SetAccessor added in v0.10.0

func (b *SingleStat) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*SingleStat) String added in v0.10.0

func (b *SingleStat) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type SingleStatValue added in v0.10.0

type SingleStatValue struct {
	Text  string `json:"text"`
	Color string `json:"color"`
}

type SingleStateConfig added in v0.10.0

type SingleStateConfig struct {
	Title string          `json:"title"`
	Value SingleStatValue `json:"value"`
}

type Summary

type Summary struct {
	Config SummaryConfig `json:"config"`
	// contains filtered or unexported fields
}

Summary contains other Components

func NewSummary

func NewSummary(title string, sections ...SummarySection) *Summary

NewSummary creates a summary component

func (*Summary) Add

func (t *Summary) Add(sections ...SummarySection)

Add adds additional items to the tail of the summary. If section with header name exists, replace it instead of adding an additional item. Adding sections is concurrency safe.

func (*Summary) AddAction

func (t *Summary) AddAction(action Action)

func (*Summary) AddSection added in v0.10.0

func (t *Summary) AddSection(header string, content Component)

AddSection adds a section to the tail of a summary.

func (*Summary) GetMetadata

func (b *Summary) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*Summary) IsEmpty

func (b *Summary) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Summary) LessThan

func (b *Summary) LessThan(i interface{}) bool

LessThan returns false.

func (*Summary) MarshalJSON

func (t *Summary) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Summary) Sections

func (t *Summary) Sections() []SummarySection

Sections returns sections for the summary.

func (*Summary) SetAccessor

func (b *Summary) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Summary) SetAlert

func (t *Summary) SetAlert(alert Alert)

SetAlert sets an alert for the summary.

func (*Summary) String

func (b *Summary) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type SummaryConfig

type SummaryConfig struct {
	Sections []SummarySection `json:"sections"`
	Actions  []Action         `json:"actions,omitempty"`
	Alert    *Alert           `json:"alert,omitempty"`
}

SummaryConfig is the contents of a Summary

type SummarySection

type SummarySection struct {
	Header  string    `json:"header"`
	Content Component `json:"content"`
}

SummarySection is a section within a summary

func (*SummarySection) UnmarshalJSON

func (t *SummarySection) UnmarshalJSON(data []byte) error

type SummarySections

type SummarySections []SummarySection

SummarySections is a slice of summary sections

func (*SummarySections) Add

func (s *SummarySections) Add(header string, view Component)

func (*SummarySections) AddText

func (s *SummarySections) AddText(header string, text string)

AddText adds a section with a single text component

type Tab

type Tab struct {
	Name     string
	Contents FlexLayout
}

Tab represents a tab. A tab is a flex layout with a name.

func NewTabWithContents

func NewTabWithContents(flexLayout FlexLayout) *Tab

NewTabWithContents creates a tab with contents.

type Table

type Table struct {
	Config TableConfig `json:"config"`
	// contains filtered or unexported fields
}

Table contains other Components

func NewTable

func NewTable(title, placeholder string, cols []TableCol) *Table

NewTable creates a table component

func NewTableWithRows

func NewTableWithRows(title, placeholder string, cols []TableCol, rows []TableRow) *Table

NewTableWithRows creates a table with rows.

func (*Table) Add

func (t *Table) Add(rows ...TableRow)

Add adds additional items to the tail of the table. Use this function to add rows in a concurrency safe fashion.

func (*Table) AddColumn

func (t *Table) AddColumn(name string)

AddColumn adds a column to the table.

func (*Table) AddFilter

func (t *Table) AddFilter(columnName string, filter TableFilter)

AddFilter adds a filter to the table. Each column can only have a single filter.

func (*Table) Columns

func (t *Table) Columns() []TableCol

Columns returns the table columns.

func (*Table) GetMetadata

func (b *Table) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*Table) IsEmpty

func (t *Table) IsEmpty() bool

IsEmpty returns true if there is one or more rows.

func (*Table) LessThan

func (b *Table) LessThan(i interface{}) bool

LessThan returns false.

func (*Table) MarshalJSON

func (t *Table) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Table) Rows

func (t *Table) Rows() []TableRow

Rows returns the table rows.

func (*Table) SetAccessor

func (b *Table) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Table) SetIsLoading

func (t *Table) SetIsLoading(isLoading bool)

func (*Table) SetPlaceholder

func (t *Table) SetPlaceholder(placeholder string)

func (*Table) Sort

func (t *Table) Sort(name string, reverse bool)

func (*Table) String

func (b *Table) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type TableCol

type TableCol struct {
	Name     string `json:"name"`
	Accessor string `json:"accessor"`
}

TableCol describes a column from a table. Accessor is the key this column will appear as in table rows, and must be unique within a table.

func NewTableCols

func NewTableCols(keys ...string) []TableCol

NewTableCols returns a slice of table columns, each with name/accessor set according to the provided keys arguments.

type TableConfig

type TableConfig struct {
	Columns      []TableCol             `json:"columns"`
	Rows         []TableRow             `json:"rows"`
	EmptyContent string                 `json:"emptyContent"`
	Loading      bool                   `json:"loading"`
	Filters      map[string]TableFilter `json:"filters"`
}

TableConfig is the contents of a Table

type TableFilter

type TableFilter struct {
	Values   []string `json:"values"`
	Selected []string `json:"selected"`
}

TableFilter describer a text filter for a table.

type TableRow

type TableRow map[string]Component

TableRow is a row in table. Each key->value represents a particular column in the row.

func (TableRow) AddAction added in v0.13.0

func (t TableRow) AddAction(gridAction GridAction)

func (*TableRow) UnmarshalJSON

func (t *TableRow) UnmarshalJSON(data []byte) error

type Terminal added in v0.10.0

type Terminal struct {
	Config TerminalConfig `json:"config"`
	// contains filtered or unexported fields
}

func NewTerminal added in v0.10.0

func NewTerminal(namespace, name string, podName string, containers []string, details TerminalDetails) *Terminal

NewTerminal creates a terminal component.

func (*Terminal) GetMetadata added in v0.10.0

func (t *Terminal) GetMetadata() Metadata

GetMetadata accesses the components metadata. Implements Component.

func (*Terminal) IsEmpty added in v0.10.0

func (b *Terminal) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Terminal) LessThan added in v0.10.0

func (b *Terminal) LessThan(i interface{}) bool

LessThan returns false.

func (*Terminal) MarshalJSON added in v0.10.0

func (t *Terminal) MarshalJSON() ([]byte, error)

func (*Terminal) SetAccessor added in v0.10.0

func (b *Terminal) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Terminal) String added in v0.10.0

func (b *Terminal) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type TerminalConfig added in v0.10.0

type TerminalConfig struct {
	Namespace  string          `json:"namespace"`
	Name       string          `json:"name"`
	PodName    string          `json:"podName"`
	Containers []string        `json:"containers"`
	Details    TerminalDetails `json:"terminal"`
}

TerminalConfig holds a terminal config.

type TerminalDetails added in v0.10.0

type TerminalDetails struct {
	Container string    `json:"container"`
	Command   string    `json:"command"`
	CreatedAt time.Time `json:"createdAt"`
	Active    bool      `json:"active"`
}

type Text

type Text struct {
	Config TextConfig `json:"config"`
	// contains filtered or unexported fields
}

Text is a component for text

func NewMarkdownText

func NewMarkdownText(s string) *Text

NewMarkdownText creates a text component styled with markdown.

func NewText

func NewText(s string, options ...func(*Text)) *Text

NewText creates a text component

func NewTextf added in v0.13.0

func NewTextf(format string, a ...interface{}) *Text

NewTextf creates a a text component using a printf like helper.

func (*Text) DisableMarkdown

func (t *Text) DisableMarkdown()

DisableMarkdown disables markdown for this text component.

func (*Text) EnableMarkdown

func (t *Text) EnableMarkdown()

EnableMarkdown enables markdown for this text component.

func (*Text) GetMetadata

func (b *Text) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*Text) IsEmpty

func (b *Text) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Text) IsMarkdown

func (t *Text) IsMarkdown() bool

IsMarkdown returns if this component is markdown.

func (*Text) LessThan

func (t *Text) LessThan(i interface{}) bool

LessThan returns true if this component's value is less than the argument supplied.

func (*Text) MarshalJSON

func (t *Text) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Text) SetAccessor

func (b *Text) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Text) SetStatus added in v0.11.0

func (t *Text) SetStatus(status TextStatus)

SetStatus sets the status of the text component.

func (*Text) String

func (t *Text) String() string

String returns the text content of the component.

func (*Text) SupportsTitle

func (t *Text) SupportsTitle()

SupportsTitle denotes this is a TextComponent.

type TextConfig

type TextConfig struct {
	// Text is the text that will be displayed.
	Text string `json:"value"`
	// IsMarkdown sets if the component has markdown text.
	IsMarkdown bool `json:"isMarkdown,omitempty"`
	// Status sets the status of the component.
	Status TextStatus `json:"status,omitempty"`
}

TextConfig is the contents of Text

type TextStatus added in v0.11.0

type TextStatus int

TextStatus is the status of a text component

const (
	// TextStatusOK
	TextStatusOK TextStatus = 1
	// TextStatusWarning
	TextStatusWarning TextStatus = 2
	// TextStatusError
	TextStatusError TextStatus = 3
)

type Timestamp

type Timestamp struct {
	Config TimestampConfig `json:"config"`
	// contains filtered or unexported fields
}

Timestamp is a component representing a point in time

func NewTimestamp

func NewTimestamp(t time.Time) *Timestamp

NewTimestamp creates a timestamp component

func (*Timestamp) GetMetadata

func (b *Timestamp) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*Timestamp) IsEmpty

func (b *Timestamp) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*Timestamp) LessThan

func (t *Timestamp) LessThan(i interface{}) bool

LessThan returns true if this component's value is less than the argument supplied.

func (*Timestamp) MarshalJSON

func (t *Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Timestamp) SetAccessor

func (b *Timestamp) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Timestamp) String

func (b *Timestamp) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type TimestampConfig

type TimestampConfig struct {
	Timestamp int64 `json:"timestamp"`
}

TimestampConfig is the contents of Timestamp

type TitleComponent

type TitleComponent interface {
	Component

	SupportsTitle()
}

TitleComponent is a view component that can be used for a title.

func Title

func Title(components ...TitleComponent) []TitleComponent

Title is a convenience method for creating a title.

func TitleFromString

func TitleFromString(s string) []TitleComponent

TitleFromString is a convenience method for create a title from a string.

type TypedObject

type TypedObject struct {
	Config   json.RawMessage `json:"config,omitempty"`
	Metadata Metadata        `json:"metadata,omitempty"`
}

func (*TypedObject) ToComponent

func (to *TypedObject) ToComponent() (Component, error)

type YAML

type YAML struct {
	Config YAMLConfig `json:"config,omitempty"`
	// contains filtered or unexported fields
}

func NewYAML

func NewYAML(title []TitleComponent, data string) *YAML

func (*YAML) Data

func (y *YAML) Data(object runtime.Object) error

func (*YAML) GetMetadata

func (y *YAML) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*YAML) IsEmpty

func (b *YAML) IsEmpty() bool

IsEmpty returns false by default. Let the components that wrap base determine if they are empty or not if they wish.

func (*YAML) LessThan

func (b *YAML) LessThan(i interface{}) bool

LessThan returns false.

func (*YAML) MarshalJSON

func (y *YAML) MarshalJSON() ([]byte, error)

func (*YAML) SetAccessor

func (b *YAML) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*YAML) String

func (b *YAML) String() string

String returns an empty string. If a component wants to provide a value it can override this function.

type YAMLConfig

type YAMLConfig struct {
	Data string `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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