component

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: Apache-2.0 Imports: 21 Imported by: 40

Documentation

Index

Constants

View Source
const (
	// TypeAccordion is an accordion component.
	TypeAccordion = "accordion"
	// TypeAnnotations is an annotations component.
	TypeAnnotations = "annotations"
	// TypeButton is a Button component.
	TypeButton = "button"
	// TypeButtonGroup is a button group component.
	TypeButtonGroup = "buttonGroup"
	// TypeCard is a card component.
	TypeCard = "card"
	// TypeCardList is a card list component.
	TypeCardList = "cardList"
	// TypeCode is a code block component.
	TypeCode = "codeBlock"
	// TypeContainers is a container component.
	TypeContainers = "containers"
	// TypeDonutChart is a donut chart component.
	TypeDonutChart = "donutChart"
	// TypeDropdown is a dropdown component.
	TypeDropdown = "dropdown"
	// TypeEditor is an editor component.
	TypeEditor = "editor"
	// TypeError is an error component.
	TypeError = "error"
	// TypeExpandableRowDetail is an expandable detail component for table rows.
	TypeExpandableRowDetail = "expandableRowDetail"
	// TypeExtension is an extension component.
	TypeExtension = "extension"
	// TypeExpressionSelector is an expression selector component.
	TypeExpressionSelector = "expressionSelector"
	// TypeFlexLayout is a flex layout component.
	TypeFlexLayout = "flexlayout"
	// TypeFormField is a form field component.
	TypeFormField = "formField"
	// TypeGraphviz is a graphviz component.
	TypeGraphviz = "graphviz"
	// TypeGridActions is a grid actions component.
	TypeGridActions = "gridActions"
	// TypeIcon is a Icon component.
	TypeIcon = "icon"
	// TypeIFrame is an iframe component.
	TypeIFrame = "iframe"
	// TypeJSONEditor is a JSON Editor component.
	TypeJSONEditor = "jsonEditor"
	// TypeLabels is a labels component.
	TypeLabels = "labels"
	// TypeLabelSelector is a label selector component.
	TypeLabelSelector = "labelSelector"
	// TypeLink is a link component.
	TypeLink = "link"
	// TypeList is a list component.
	TypeList = "list"
	// TypeLoading is a loading component.
	TypeLoading = "loading"
	// TypeLogs is a logs component.
	TypeLogs = "logs"
	// TypeModal is a modal component.
	TypeModal = "modal"
	// TypePodStatus is a pod status component.
	TypePodStatus = "podStatus"
	// TypePort is a port component.
	TypePort = "port"
	// TypePorts is a ports component.
	TypePorts = "ports"
	// TypeQuadrant is a quadrant component.
	TypeQuadrant = "quadrant"
	// TypeResourceViewer is a resource viewer component.
	TypeResourceViewer = "resourceViewer"
	// TypeSelectFile is a SelectFile component.
	TypeSelectFile = "selectFile"
	// TypeSelectors is a selectors component.
	TypeSelectors = "selectors"
	// TypeSignpost is a SignPost component.
	TypeSignpost = "signpost"
	// TypeSingleStat is a single stat component.
	TypeSingleStat = "singleStat"
	// TypeStepper is a stepper component.
	TypeStepper = "stepper"
	// TypeSummary is a summary component.
	TypeSummary = "summary"
	// TypeTable is a table component.
	TypeTable = "table"
	// TypeTabsView is a Tab component.
	TypeTabsView = "tabsView"
	// TypeTerminal is a terminal component.
	TypeTerminal = "terminal"
	// TypeText is a text component.
	TypeText = "text"
	// TypeTimeline is a timeline component.
	TypeTimeline = "timeline"
	// TypeTimestamp is a timestamp component.
	TypeTimestamp = "timestamp"
	// TypeYAML is a YAML component.
	TypeYAML = "yaml"
)
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 (
	// EdgeTypeImplicit is an implicit edge
	EdgeTypeImplicit = "implicit"
	// EdgeTypeExplicit is an explicit edge
	EdgeTypeExplicit = "explicit"
)
View Source
const (
	// ExpandableRowKey is the key for an expandable row
	ExpandableRowKey = "_expand"
)
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 OrderedBy added in v0.17.0

func OrderedBy(less []lessFunc) *multiSorter

func TitleFromTitleComponent

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

TitleFromTitleComponent gets a title from a TitleComponent

Types

type Accordion added in v0.18.0

type Accordion struct {
	Base
	Config AccordionConfig `json:"config"`
	// contains filtered or unexported fields
}

Accordion is a component for accordion

+octant:component

func NewAccordion added in v0.18.0

func NewAccordion(title string, rows []AccordionRow, options ...func(*Accordion)) *Accordion

NewAccordion creates a new accordion component

func (*Accordion) Add added in v0.18.0

func (a *Accordion) Add(row ...AccordionRow)

AddRow adds one or more rows to an accordion.

func (*Accordion) AllowMultipleExpanded added in v0.18.0

func (a *Accordion) AllowMultipleExpanded()

AllowMultipleExpanded sets an accordion to allow expanding multiple rows.

func (*Accordion) MarshalJSON added in v0.18.0

func (a *Accordion) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

type AccordionConfig added in v0.18.0

type AccordionConfig struct {
	Rows                  []AccordionRow `json:"rows"`
	AllowMultipleExpanded bool           `json:"allowMultipleExpanded"`
}

Accordion is the contents of Accordion

type AccordionRow added in v0.18.0

type AccordionRow struct {
	Title   string    `json:"title"`
	Content Component `json:"content"`
}

AccordionRow is a row of an accordion

func (*AccordionRow) UnmarshalJSON added in v0.18.0

func (a *AccordionRow) UnmarshalJSON(data []byte) error

Unmarshal unmarshals an accordion config from JSON.

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 {
	Status      AlertStatus  `json:"status"`
	Type        AlertType    `json:"type"`
	Message     string       `json:"message"`
	Closable    bool         `json:"closable"`
	ButtonGroup *ButtonGroup `json:"buttonGroup"`
}

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

func NewAlert

func NewAlert(alertStatus AlertStatus, alertType AlertType, message string, closable bool, buttonGroup *ButtonGroup) Alert

NewAlert creates an instance of Alert.

type AlertStatus added in v0.21.0

type AlertStatus string
const (
	// AlertStatusError is an error alert.
	AlertStatusError AlertStatus = "error"
	// AlertStatusWarning is a warning alert.
	AlertStatusWarning AlertStatus = "warning"
	// AlertStatusInfo is an info alert.
	AlertStatusInfo AlertStatus = "info"
	// AlertStatusSuccess is a success alert.
	AlertStatusSuccess AlertStatus = "success"
	// AlertStatusNeutral is a neutral alert.
	AlertStatusNeutral AlertStatus = "neutral"
)

type AlertType

type AlertType string
const (
	AlertTypeBanner  AlertType = "banner"
	AlertTypeDefault AlertType = "default"
	AlertTypeLight   AlertType = "light"
)

type Annotations

type Annotations struct {
	Base
	Config AnnotationsConfig `json:"config"`
}

Annotations is a component representing key/value based annotations

+octant:component

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) MarshalJSON

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

MarshalJSON implements json.Marshaler.

type AnnotationsConfig

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

AnnotationsConfig is the contents of Annotations

type Badge added in v0.18.0

type Badge string
const (
	BadgeInfo            Badge = "info"
	BadgeSuccess         Badge = "success"
	BadgeWarningTriangle Badge = "warning-triangle"
	BadgeDanger          Badge = "danger"
	BadgeWarning         Badge = "warning"
	BadgeInherit         Badge = "inherit"
	BadgeInheritTriangle Badge = "inherit-triangle"
)

type Base added in v0.15.0

type Base struct {
	Metadata `json:"metadata"`
}

Base is an abstract base for components..

func (*Base) GetMetadata added in v0.15.0

func (b *Base) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*Base) IsEmpty added in v0.15.0

func (b *Base) IsEmpty() bool

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

func (*Base) LessThan added in v0.15.0

func (b *Base) LessThan(_ interface{}) bool

LessThan returns false.

func (*Base) SetAccessor added in v0.15.0

func (b *Base) SetAccessor(accessor string)

SetAccessor sets the accessor for the object.

func (*Base) SetMetadata added in v0.15.0

func (b *Base) SetMetadata(metadata Metadata)

func (*Base) String added in v0.15.0

func (b *Base) String() string

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

type Button

type Button struct {
	Base
	Config ButtonConfig `json:"config"`
}

Button is a component for a Button +octant:component

func NewButton

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

NewButton creates an instance of Button.

func (*Button) MarshalJSON added in v0.19.0

func (b *Button) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

type ButtonConfig added in v0.19.0

type ButtonConfig struct {
	Name         string         `json:"name"`
	Payload      action.Payload `json:"payload"`
	Confirmation *Confirmation  `json:"confirmation,omitempty"`
	Modal        Component      `json:"modal,omitempty"`
	Status       ButtonStatus   `json:"status,omitempty"`
	Size         ButtonSize     `json:"size,omitempty"`
	Style        ButtonStyle    `json:"style,omitempty"`
}

ButtonConfig is the contents of a Button

func (*ButtonConfig) UnmarshalJSON added in v0.19.0

func (b *ButtonConfig) UnmarshalJSON(data []byte) error

type ButtonGroup

type ButtonGroup struct {
	Base
	Config ButtonGroupConfig `json:"config"`
}

ButtonGroup is a group of buttons. +octant:component

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) MarshalJSON

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

MarshalJSON marshals a button group.

type ButtonGroupConfig

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

ButtonGroupConfig is configuration for a button group.

func (*ButtonGroupConfig) UnmarshalJSON added in v0.19.0

func (bg *ButtonGroupConfig) UnmarshalJSON(data []byte) error

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.

func WithButtonSize added in v0.20.0

func WithButtonSize(size ButtonSize) ButtonOption

WithButtonSize configures the button size

func WithButtonStatus added in v0.20.0

func WithButtonStatus(status ButtonStatus) ButtonOption

WithButtonStatus configures the button color

func WithButtonStyle added in v0.20.0

func WithButtonStyle(style ButtonStyle) ButtonOption

WithButtonStyle configures the button appearance

func WithModal added in v0.16.0

func WithModal(modal *Modal) ButtonOption

WithModal configures a button to open a modal

type ButtonSize added in v0.20.0

type ButtonSize string

ButtonSize defines the size of a Button

const (
	// ButtonSizeBlock is a full width button
	ButtonSizeBlock ButtonSize = "block"
	// ButtonSizeMedium is a clarity small button
	ButtonSizeMedium ButtonSize = "md"
)

type ButtonStatus added in v0.20.0

type ButtonStatus string

ButtonStatus is the status of a Button

const (
	// ButtonStatusSuccess is a green button
	ButtonStatusSuccess ButtonStatus = "success"
	// ButtonStatusInfo is the default blue color
	ButtonStatusInfo ButtonStatus = "primary"
	// ButtonStatusDanger is a red button
	ButtonStatusDanger ButtonStatus = "danger"
	// ButtonStatusDisabled is a disabled button
	ButtonStatusDisabled ButtonStatus = "disabled"
)

type ButtonStyle added in v0.20.0

type ButtonStyle string

ButtonStyle is the style of a Button

const (
	// ButtonStyleOutline is a transparent button with a colored border
	ButtonStyleOutline ButtonStyle = "outline"
	// ButtonStyleSolid is a button with solid color
	ButtonStyleSolid ButtonStyle = "solid"
	// ButtonStyleFlat is a button with no background color or outline
	ButtonStyleFlat ButtonStyle = "flat"
)

type Card

type Card struct {
	Base

	Config CardConfig `json:"config"`
}

Card is a card component.

+octant: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) MarshalJSON

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

MarshalJSON marshals a card to JSON.

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.

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,omitempty"`
	// 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 {
	Base
	Config CardListConfig `json:"config"`
}

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

+octant:component

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) MarshalJSON

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

MarshalJSON marshals a card list to JSON.

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 {
	Base
	Config CodeConfig `json:"config"`
}

Value is a component for code

+octant:component

func NewCodeBlock added in v0.11.0

func NewCodeBlock(s string) *Code

NewCodeBlock creates a code component

func (*Code) MarshalJSON added in v0.11.0

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

MarshalJSON implements json.Marshaler

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 {
	MarshalJSON() ([]byte, error)
	UnmarshalJSON([]byte) error

	// GetMetadata returns metadata for the component.
	GetMetadata() Metadata
	// GetMetadata sets the metadata for the component.
	SetMetadata(metadata Metadata)
	// SetAccessor sets the accessor for the component.
	SetAccessor(accessor 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 {
	Base
	Config ContainersConfig `json:"config"`
}

Containers is a component wrapping multiple docker container definitions

+octant:component

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) MarshalJSON

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

MarshalJSON implements json.Marshaler

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"`
	TitleComponents    []Component      `json:"titleComponents,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) AddTitleComponents added in v0.20.0

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

AddTitleComponents Adds any number of components to accompany the title

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 Direction added in v0.18.0

type Direction string
const (
	DirectionUp    Direction = "up"
	DirectionDown  Direction = "down"
	DirectionLeft  Direction = "left"
	DirectionRight Direction = "right"
)

type DonutChart added in v0.10.0

type DonutChart struct {
	Base
	Config DonutChartConfig `json:"config"`
}

+octant:component

func NewDonutChart added in v0.10.0

func NewDonutChart() *DonutChart

func (*DonutChart) MarshalJSON added in v0.10.0

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

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) SetThickness added in v0.18.0

func (dc *DonutChart) SetThickness(thickness int)

Set donut chart thickness - trimmed to be inside [2-100] interval where 2 is barely visible and 100 turns it to a pie chart

type DonutChartConfig added in v0.10.0

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

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 = 50
	DonutChartSizeMedium DonutChartSize = 100
)

type DonutSegment added in v0.10.0

type DonutSegment struct {
	Count       int        `json:"count"`
	Status      NodeStatus `json:"status"`
	Color       string     `json:"color,omitempty"`
	Description string     `json:"description,omitempty"`
	Thickness   int        `json:"thickness,omitempty"`
}
type Dropdown struct {
	Base
	Config DropdownConfig `json:"config"`
}

Dropdown: displays dropdown component with a list of values Used to choose an option or action from a contextual list +octant:component

func NewDropdown added in v0.17.0

func NewDropdown(title string, dropdownType DropdownType, action string, items ...DropdownItemConfig) *Dropdown

NewDropdown creates a new dropdown component

func (t *Dropdown) AddDropdownItem(name string, itemType ItemType, label string, url string, description string)

AddDropdownItem adds an item to the dropdown

func (t *Dropdown) GetMetadata() Metadata

GetMetadata accesses the components metadata

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

MarshalJSON implements json.Marshaler

func (t *Dropdown) SetDropdownPosition(position DropdownPosition)

SetDropdownPosition sets the position of context menu relative to dropdown source.

func (t *Dropdown) SetDropdownShowToggleIcon(sti bool)

SetDropdownShowToggleIcon defines if dropdown toggle caret icon is shown.

func (t *Dropdown) SetDropdownUseSelection(sel bool)

SetDropdownUseSelection defines if dropdown title is updated on selection change

func (t *Dropdown) SetSelection(selection string)

SetSelection specifies the dropdown selected item.

func (t *Dropdown) SupportsTitle()

SupportsTitle designates this is a TextComponent.

type DropdownConfig struct {
	DropdownPosition DropdownPosition     `json:"position,omitempty"`
	DropdownType     DropdownType         `json:"type"`
	Action           string               `json:"action,omitempty"`
	Selection        string               `json:"selection,omitempty"`
	UseSelection     bool                 `json:"useSelection"`
	ShowToggleIcon   bool                 `json:"showToggleIcon"`
	Items            []DropdownItemConfig `json:"items"`
}

DropdownConfig defines the contents of a Dropdown

func (t *DropdownConfig) UnmarshalJSON(data []byte) error
type DropdownItemConfig struct {
	Name        string   `json:"name"`
	Type        ItemType `json:"type"`
	Label       string   `json:"label"`
	Url         string   `json:"url,omitempty"`
	Description string   `json:"description,omitempty"`
}

func NewDropdownItem added in v0.17.0

func NewDropdownItem(name string, itemType ItemType, label string, url string, description string) DropdownItemConfig

NewDropdownItem creates a new dropdown item

type DropdownPosition string

DropdownPosition denotes a position relative to source button

const (
	BottomLeft  DropdownPosition = "bottom-left"
	BottomRight DropdownPosition = "bottom-right"
	TopLeft     DropdownPosition = "top-left"
	TopRight    DropdownPosition = "top-right"
	LeftBottom  DropdownPosition = "left-bottom"
	LeftTop     DropdownPosition = "left-top"
	RightTop    DropdownPosition = "right-top"
	RightBottom DropdownPosition = "right-bottom"
)
type DropdownType string

DropdownType defines what the dropdown source is (UI component that's visible when dropdown is closed)

const (
	DropdownButton DropdownType = "button"
	DropdownLink   DropdownType = "link"
	DropdownLabel  DropdownType = "label"
	DropdownIcon   DropdownType = "icon"
)

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 {
	Base
	Config EditorConfig `json:"config"`
}

Editor is an editor component.

+octant:component

func NewEditor added in v0.11.0

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

NewEditor creates an instance of an editor component.

func (*Editor) GetMetadata added in v0.11.0

func (e *Editor) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*Editor) MarshalJSON added in v0.11.0

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

MarshalJSON implements json.Marshaler

func (*Editor) SetValueFromObject added in v0.11.0

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

type EditorConfig added in v0.11.0

type EditorConfig struct {
	Value        string            `json:"value"`
	Language     string            `json:"language"`
	ReadOnly     bool              `json:"readOnly"`
	Metadata     map[string]string `json:"metadata"`
	SubmitAction string            `json:"submitAction,omitempty"`
	SubmitLabel  string            `json:"submitLabel,omitempty"`
}

EditorConfig is configuration for Editor.

type Error

type Error struct {
	Base
	Config ErrorConfig `json:"config"`
}

Error is a component for freetext

+octant:component

func NewError

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

NewError creates a text component

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) 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 ExpandableRowDetail added in v0.18.0

type ExpandableRowDetail struct {
	Base

	Config ExpandableRowDetailConfig `json:"config"`
}

ExpandableRowDetail is a component hidden by a toggle under each table row.

+octant:component

func NewExpandableRowDetail added in v0.18.0

func NewExpandableRowDetail(body ...Component) *ExpandableRowDetail

NewExpandableRowDetail creates an expandable detail for a table row.

func (ExpandableRowDetail) MarshalJSON added in v0.18.0

func (e ExpandableRowDetail) MarshalJSON() ([]byte, error)

func (*ExpandableRowDetail) SetReplace added in v0.20.0

func (e *ExpandableRowDetail) SetReplace(replace bool)

type ExpandableRowDetailConfig added in v0.21.0

type ExpandableRowDetailConfig struct {
	Replace bool        `json:"replace"`
	Body    []Component `json:"body"`
}

ExpandableRowDetailConfig is a configuration for an expandable row detail.

func (*ExpandableRowDetailConfig) UnmarshalJSON added in v0.21.0

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

UnmarshalJSON unmarshals an expandable row detail config from JSON.

type ExpressionSelector

type ExpressionSelector struct {
	Base
	Config ExpressionSelectorConfig `json:"config"`
}

ExpressionSelector is a component for a single expression within a selector

+octant:component

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) IsSelector

func (t *ExpressionSelector) IsSelector()

IsSelector marks the component as selector flavor. Implements Selector.

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.

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 {
	Base

	Config ExtensionConfig `json:"config"`
}

+octant:component

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) MarshalJSON added in v0.10.0

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

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 FileStatus added in v0.21.0

type FileStatus string
const (
	FileStatusSuccess FileStatus = "success"
	FileStatusError   FileStatus = "error"
)

type FlexLayout

type FlexLayout struct {
	Base
	Config FlexLayoutConfig `json:"config,omitempty"`
}

FlexLayout is a flex layout view.

+octant:component

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) MarshalJSON

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

MarshalJSON marshals the flex layout to JSON.

func (*FlexLayout) SetAlert added in v0.21.0

func (fl *FlexLayout) SetAlert(alert Alert)

SetAlert sets an alert for the .

func (*FlexLayout) SetButtonGroup

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

type FlexLayoutConfig

type FlexLayoutConfig struct {
	Sections    []FlexLayoutSection `json:"sections,omitempty"`
	ButtonGroup *ButtonGroup        `json:"buttonGroup,omitempty"`
	Alert       *Alert              `json:"alert,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"`
	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 Flip added in v0.18.0

type Flip string
const (
	FlipHorizontal Flip = "horizontal"
	FlipVertical   Flip = "vertical"
)

type Form

type Form struct {
	Fields []FormField `json:"fields"`
	Action string      `json:"action,omitempty"`
}

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 struct {
	Base
	Config FormFieldConfig `json:"config"`
}

FormField is a component for fields within a Form +octant:component

func NewFormFieldCheckBox

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

func NewFormFieldHidden

func NewFormFieldHidden(name, value string) FormField

func NewFormFieldLayout added in v0.21.0

func NewFormFieldLayout(fields ...FormField) FormField

NewFormFieldLayout creates a group of form fields

func NewFormFieldNumber

func NewFormFieldNumber(label, name, value string) FormField

func NewFormFieldPassword

func NewFormFieldPassword(label, name, value string) FormField

func NewFormFieldRadio

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

func NewFormFieldSelect

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

func NewFormFieldText

func NewFormFieldText(label, name, value string) FormField

func NewFormFieldTextarea

func NewFormFieldTextarea(label, name, value string) FormField

func (*FormField) AddValidator added in v0.21.0

func (ff *FormField) AddValidator(errorMessage string, validators map[FormValidator]interface{})

AddValidator adds validator(s)

func (*FormField) MarshalJSON added in v0.18.0

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

func (*FormField) SetLabel added in v0.21.0

func (ff *FormField) SetLabel(label string)

func (*FormField) SetPlaceHolder added in v0.21.0

func (ff *FormField) SetPlaceHolder(placeholder string)

func (*FormField) SetWidth added in v0.21.0

func (ff *FormField) SetWidth(width int)

type FormFieldConfig added in v0.21.0

type FormFieldConfig struct {
	Type          FormFieldType                 `json:"type"`
	Label         string                        `json:"label"`
	Name          string                        `json:"name"`
	Value         interface{}                   `json:"value"`
	Configuration *FormFieldOptions             `json:"configuration,omitempty"`
	Placeholder   string                        `json:"placeholder,omitempty"`
	Error         string                        `json:"error,omitempty"`
	Validators    map[FormValidator]interface{} `json:"validators,omitempty"`
	Width         int                           `json:"width,omitempty"`
}

func (*FormFieldConfig) UnmarshalJSON added in v0.21.0

func (ffc *FormFieldConfig) UnmarshalJSON(data []byte) error

type FormFieldOptions added in v0.21.0

type FormFieldOptions struct {
	Choices  []InputChoice `json:"choices,omitempty"`
	Multiple bool          `json:"multiple,omitempty"`
	Fields   []FormField   `json:"fields,omitempty"`
}

FormFieldOptions provides additional configuration for form fields with multiple inputs

type FormFieldType added in v0.21.0

type FormFieldType string
const (
	FieldTypeCheckBox FormFieldType = "checkbox"
	FieldTypeRadio    FormFieldType = "radio"
	FieldTypeText     FormFieldType = "text"
	FieldTypePassword FormFieldType = "password"
	FieldTypeNumber   FormFieldType = "number"
	FieldTypeSelect   FormFieldType = "select"
	FieldTypeTextarea FormFieldType = "textarea"
	FieldTypeHidden   FormFieldType = "hidden"
	FieldTypeLayout   FormFieldType = "layout"
)

type FormValidator added in v0.18.0

type FormValidator string
const (
	FormValidatorMin           FormValidator = "min"
	FormValidatorMax           FormValidator = "max"
	FormValidatorRequired      FormValidator = "required"
	FormValidatorRequiredTrue  FormValidator = "requiredTrue"
	FormValidatorEmail         FormValidator = "email"
	FormValidatorMinLength     FormValidator = "minLength"
	FormValidatorMaxLength     FormValidator = "maxLength"
	FormValidatorPattern       FormValidator = "pattern"
	FormValidatorNullValidator FormValidator = "nullValidator"
)

type Graphviz

type Graphviz struct {
	Base
	Config GraphvizConfig `json:"config"`
}

Graphviz is a component for displaying graphviz diagrams.

+octant:component

func NewGraphviz

func NewGraphviz(dot string) *Graphviz

NewGraphviz creates a graphviz component.

func (*Graphviz) MarshalJSON

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

MarshalJSON implements json.Marshaler

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,omitempty"`
	// 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 {
	Base

	Config GridActionsConfig `json:"config"`
}

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.

+octant:component

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) MarshalJSON added in v0.12.0

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

MarshalJSON converts the GridActions to a JSON.

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 {
	Base
	Config IFrameConfig `json:"config"`
}

IFrame is a component for displaying content in an iframe

+octant:component

func NewIFrame added in v0.10.0

func NewIFrame(url string, title string) *IFrame

NewIFrame creates an iframe component

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) 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 Icon added in v0.18.0

type Icon struct {
	Base
	Config IconConfig `json:"config"`
}

func NewIcon added in v0.18.0

func NewIcon(shape string, options ...func(*Icon)) *Icon

func (*Icon) AddLabel added in v0.19.0

func (i *Icon) AddLabel(label string)

AddLabel adds an aria-label for screen readers

func (*Icon) MarshalJSON added in v0.18.0

func (i *Icon) MarshalJSON() ([]byte, error)

func (*Icon) SetBadgeColor added in v0.19.0

func (i *Icon) SetBadgeColor(color string)

SetBadgeColor sets the color of a badge. A set badge color has priority over a badge status.

func (*Icon) SetColor added in v0.19.0

func (i *Icon) SetColor(color string)

SetColor sets the color of an icon. A color from status has priority over a set color.

func (*Icon) SetCustomSvg added in v0.24.0

func (i *Icon) SetCustomSvg(customSvg string)

SetCustomSvg sets an SVG for an Icon.

func (*Icon) SetSize added in v0.19.0

func (i *Icon) SetSize(size string)

SetSize sets the size of a badge. The size can me sm, md, lg, xl, xxl, or an integer for N x N pixels.

type IconConfig added in v0.18.0

type IconConfig struct {
	Shape      string         `json:"shape"`
	Size       string         `json:"size"`
	Direction  Direction      `json:"direction"`
	Flip       Flip           `json:"flip"`
	Solid      bool           `json:"solid"`
	Status     Status         `json:"status"`
	Inverse    bool           `json:"inverse"`
	Badge      Badge          `json:"badge"`
	Color      string         `json:"color"`
	BadgeColor string         `json:"badgeColor"`
	Label      string         `json:"label"`
	Tooltip    *TooltipConfig `json:"tooltip,omitempty"`
	CustomSvg  string         `json:"customSvg"`
}

type IconOption added in v0.20.0

type IconOption func(icon *Icon)

func WithTooltip added in v0.20.0

func WithTooltip(message string, size TooltipSize, position TooltipPosition) IconOption

WithTooltip configures an icon with a tooltip

type InputChoice

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

type ItemType added in v0.17.0

type ItemType string

Defines the type of dropdown item

const (
	Header    ItemType = "header"
	PlainText ItemType = "text"
	Url       ItemType = "link"
	Separator ItemType = "separator"
)

type JSONEditor added in v0.21.0

type JSONEditor struct {
	Base
	Config JSONEditorConfig `json:"config"`
}

JSONEditor is an JSON editor component.

+octant:component

func NewJSONEditor added in v0.21.0

func NewJSONEditor(content string, collapsed bool) *JSONEditor

NewJSONEditor creates an instance of JSONEditor

func (*JSONEditor) GetMetadata added in v0.21.0

func (j *JSONEditor) GetMetadata() Metadata

GetMetadata returns the component's metadata.

func (*JSONEditor) MarshalJSON added in v0.21.0

func (j *JSONEditor) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

type JSONEditorConfig added in v0.21.0

type JSONEditorConfig struct {
	Mode      JSONEditorMode `json:"mode"`
	Content   string         `json:"content"`
	Collapsed bool           `json:"collapsed"`
}

type JSONEditorMode added in v0.21.0

type JSONEditorMode string
const (
	// ViewMode can show JSON up to 500MiB
	ViewMode JSONEditorMode = "view"
	TextMode JSONEditorMode = "text"
)

type LabelSelector

type LabelSelector struct {
	Base
	Config LabelSelectorConfig `json:"config"`
}

LabelSelector is a component for a single label within a selector

+octant:component

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) IsSelector

func (t *LabelSelector) IsSelector()

IsSelector marks the component as selector flavor. Implements Selector.

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.

type LabelSelectorConfig

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

LabelSelectorConfig is the contents of LabelSelector

type Labels

type Labels struct {
	Base
	Config LabelsConfig `json:"config"`
}

Labels is a component representing key/value based labels

+octant:component

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) MarshalJSON

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

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

type LabelsConfig

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

LabelsConfig is the contents of Labels

type Layout added in v0.21.0

type Layout string
const (
	LayoutHorizontal Layout = "horizontal"
	LayoutVertical   Layout = "vertical"
	LayoutCompact    Layout = "compact"
)
type Link struct {
	Config LinkConfig `json:"config"`
	Base
}

Link is a text component that contains a link.

+octant:component

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) 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) SetComponent added in v0.19.0

func (t *Link) SetComponent(component Component)

SetComponent sets the component to be wrapped by the Link

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" tsType:"number"`
	StatusDetail Component  `json:"statusDetail,omitempty"`
	// Component allows Links to receive a component to be wrapped as a link
	Component Component `json:"component,omitempty"`
}

LinkConfig is the contents of Link

func (*LinkConfig) UnmarshalJSON added in v0.16.0

func (lc *LinkConfig) UnmarshalJSON(data []byte) error

type LinkOption added in v0.13.0

type LinkOption func(l *Link)

func WithComponent added in v0.19.0

func WithComponent(c Component) LinkOption

WithComponent sets a component for the Link

type List

type List struct {
	Base
	Config ListConfig `json:"config"`
}

List contains other Components

+octant:component

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) MarshalJSON

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

MarshalJSON implements json.Marshaler

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 {
	Base
	Config LoadingConfig `json:"config"`
}

Loading is a component for a spinner

+octant:component

func NewLoading

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

NewLoading creates a loading component

func (*Loading) MarshalJSON

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

MarshalJSON implements json.Marshaler

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 {
	Base
	Config LogsConfig `json:"config,omitempty"`
}

Logs is a logs component.

+octant:component

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) MarshalJSON

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

type LogsConfig

type LogsConfig struct {
	Namespace  string   `json:"namespace,omitempty"`
	Name       string   `json:"name,omitempty"`
	Containers []string `json:"containers,omitempty"`
	Durations  []Since  `json:"durations,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) SetTitle added in v0.17.0

func (m *Metadata) SetTitle(titleComponents []TitleComponent)

SetTitle sets the title using the provided 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 Modal struct {
	Base
	Config ModalConfig `json:"config"`
}

Modal is a modal component.

+octant:component

func NewModal added in v0.16.0

func NewModal(title []TitleComponent) *Modal

NewModal creates a new modal.

func (*Modal) AddButton added in v0.16.0

func (m *Modal) AddButton(button Button)

AddButton is a helper to add a custom button

func (*Modal) AddForm added in v0.16.0

func (m *Modal) AddForm(form Form)

AddForm adds a form to a modal. It is added after the body.

func (*Modal) Close added in v0.16.0

func (m *Modal) Close()

Close closes a modal.

func (*Modal) MarshalJSON added in v0.16.0

func (m *Modal) MarshalJSON() ([]byte, error)

MarshalJSON marshal a modal to JSON.

func (*Modal) Open added in v0.16.0

func (m *Modal) Open()

Open opens a modal. A modal is closed by default.

func (*Modal) SetAlert added in v0.21.0

func (m *Modal) SetAlert(alert Alert)

SetAlert sets an alert for the modal.

func (*Modal) SetBody added in v0.16.0

func (m *Modal) SetBody(body Component)

SetBody sets the body of a modal.

func (*Modal) SetSize added in v0.16.0

func (m *Modal) SetSize(size ModalSize)

SetSize sets the size of a modal. Size is medium by default.

type ModalConfig added in v0.16.0

type ModalConfig struct {
	Body      Component `json:"body,omitempty"`
	Form      *Form     `json:"form,omitempty"`
	Opened    bool      `json:"opened"`
	ModalSize ModalSize `json:"size,omitempty"`
	Buttons   []Button  `json:"buttons,omitempty"`
	Alert     *Alert    `json:"alert,omitempty"`
}

ModalConfig is a configuration for the modal component.

func (*ModalConfig) UnmarshalJSON added in v0.16.0

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

UnmarshalJSON unmarshals a modal config from JSON.

type ModalSize added in v0.16.0

type ModalSize string
const (
	// ModalSizeSmall is the smallest modal
	ModalSizeSmall ModalSize = "sm"
	// ModalSizeLarge is a large modal
	ModalSizeLarge ModalSize = "lg"
	// ModalSizeExtraLarge is the largest modal
	ModalSizeExtraLarge ModalSize = "xl"
)

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"`
	Properties []Property  `json:"properties,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.

func (*Node) UnmarshalJSON added in v0.16.0

func (n *Node) UnmarshalJSON(data []byte) error

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 {
	Base
	Config PodStatusConfig `json:"config"`
}

PodStatus represents the status for a group of pods.

+octant:component

func NewPodStatus

func NewPodStatus() *PodStatus

NewPodStatus creates a PodStatus.

func (*PodStatus) AddSummary

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

AddSummary adds summary for a pod.

func (*PodStatus) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*PodStatus) Status

func (ps *PodStatus) Status() NodeStatus

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"`
	Properties []Property  `json:"properties,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 {
	Base
	Config PortConfig `json:"config"`
}

Port is a component for a port

+octant:component

func NewPort

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

NewPort creates a port component

func NewServicePort added in v0.14.0

func NewServicePort(namespace, apiVersion, kind, name string, port int, protocol string, targetPort int, targetPortName 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) MarshalJSON

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

MarshalJSON implements json.Marshaler

type PortConfig

type PortConfig struct {
	Port           int              `json:"port,omitempty"`
	Protocol       string           `json:"protocol,omitempty"`
	TargetPort     int              `json:"targetPort,omitempty"`
	TargetPortName string           `json:"targetPortName,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 {
	Base
	Config PortsConfig `json:"config,omitempty"`
}

Ports is a group of ports.

+octant:component

func NewPorts

func NewPorts(ports []Port) *Ports

func (*Ports) GetMetadata

func (t *Ports) GetMetadata() Metadata

func (*Ports) MarshalJSON

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

type PortsConfig

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

type Position added in v0.19.0

type Position string
const (
	PositionTopLeft      Position = "top-left"
	PositionTopMiddle    Position = "top-middle"
	PositionTopRight     Position = "top-right"
	PositionRightTop     Position = "right-top"
	PositionRightMiddle  Position = "right-middle"
	PositionRightBottom  Position = "right-bottom"
	PositionBottomRight  Position = "bottom-right"
	PositionBottomMiddle Position = "bottom-middle"
	PositionBottomLeft   Position = "bottom-left"
	PositionLeftBottom   Position = "left-bottom"
	PositionLeftMiddle   Position = "left-middle"
	PositionLeftTop      Position = "left-top"
)

type Property added in v0.21.0

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

type PropertyObject added in v0.21.0

type PropertyObject struct {
	Label string       `json:"label,omitempty"`
	Value *TypedObject `json:"value,omitempty"`
}

type Quadrant

type Quadrant struct {
	Base
	Config QuadrantConfig `json:"config"`
}

Quadrant displays information in a quadrant.

+octant:component

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) 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

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 {
	Base
	Config ResourceViewerConfig `json:"config,omitempty"`
}

ResourceView is a resource viewer component.

+octant: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) MarshalJSON

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

MarshalJSON implements json.Marshaler

func (*ResourceViewer) Select

func (rv *ResourceViewer) Select(id string)

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 SelectFile added in v0.21.0

type SelectFile struct {
	Base
	Config SelectFileConfig `json:"config"`
}

func NewSelectFile added in v0.21.0

func NewSelectFile(label string, multiple bool, layout Layout, action string) *SelectFile

NewSelectFile creates a new Select File component.

func (*SelectFile) GetMetadata added in v0.21.0

func (sf *SelectFile) GetMetadata() Metadata

GetMetadata accesses the components metadata. Implements Component.

func (*SelectFile) MarshalJSON added in v0.21.0

func (sf *SelectFile) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*SelectFile) SetStatus added in v0.21.0

func (sf *SelectFile) SetStatus(status FileStatus, message string)

SetStatus sets the status and status message.

type SelectFileConfig added in v0.21.0

type SelectFileConfig struct {
	Label         string     `json:"label"`
	Multiple      bool       `json:"multiple"`
	Status        FileStatus `json:"status"`
	StatusMessage string     `json:"statusMessage"`
	Layout        Layout     `json:"layout"`
	Action        string     `json:"action,omitempty"`
}

type Selector

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

Selector identifies a Component as being a selector flavor.

type Selectors

type Selectors struct {
	Base
	Config SelectorsConfig `json:"config"`
}

Selectors contains other Components

+octant:component

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) MarshalJSON

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

MarshalJSON implements json.Marshaler

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 Signpost added in v0.19.0

type Signpost struct {
	Base
	Config SignpostConfig `json:"config"`
}

Signpost is a component for a signpost +octant:component

func NewSignpost added in v0.19.0

func NewSignpost(t Component, m string) *Signpost

func (*Signpost) MarshalJSON added in v0.19.0

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

MarshalJSON implements json.Marshaller

func (*Signpost) SetPosition added in v0.19.0

func (t *Signpost) SetPosition(position Position)

SetPosition sets the status of the text component.

type SignpostConfig added in v0.19.0

type SignpostConfig struct {
	// Trigger is the component that will trigger the signpost.
	Trigger Component `json:"trigger"`
	// Message is the text that will be displayed.
	Message string `json:"message"`
	// Position of Signpost
	Position Position `json:"position"`
}

SignpostConfig is the contents of a signpost

func (*SignpostConfig) UnmarshalJSON added in v0.19.0

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

type Since added in v0.16.0

type Since struct {
	Label   string `json:"label,omitempty"`
	Seconds int64  `json:"seconds,omitempty"`
}

type SingleStat added in v0.10.0

type SingleStat struct {
	Base
	Config SingleStatConfig `json:"config"`
}

Single stat shows a single statistic.

+octant:component

func NewSingleStat added in v0.10.0

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

func (*SingleStat) MarshalJSON added in v0.10.0

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

type SingleStatConfig added in v0.15.0

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

type SingleStatValue added in v0.10.0

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

type SingleTab added in v0.21.0

type SingleTab struct {
	Name     string     `json:"name"`
	Contents FlexLayout `json:"contents"`
}

type Status added in v0.18.0

type Status string
const (
	StatusInfo    Status = "info"
	StatusSuccess Status = "success"
	StatusWarning Status = "warning"
	StatusDanger  Status = "danger"
)

type StepConfig added in v0.15.0

type StepConfig struct {
	Name        string `json:"name"`
	Form        Form   `json:"form"`
	Title       string `json:"title"`
	Description string `json:"description"`
}

type Stepper added in v0.15.0

type Stepper struct {
	Base
	Config StepperConfig `json:"config"`
}

Stepper component implements json.Marshaler

+octant:component

func NewStepper added in v0.16.0

func NewStepper(title string, actionName string, steps ...StepConfig) *Stepper

NewStepper creates a stepper component

func (*Stepper) AddStep added in v0.16.0

func (t *Stepper) AddStep(name string, form Form, title string, description string)

AddStep adds a step to a stepper

func (*Stepper) MarshalJSON added in v0.15.0

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

type StepperConfig added in v0.15.0

type StepperConfig struct {
	Action string       `json:"action"`
	Steps  []StepConfig `json:"steps"`
}

func (*StepperConfig) UnmarshalJSON added in v0.15.0

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

type Summary

type Summary struct {
	Base
	Config SummaryConfig `json:"config"`
}

Summary contains other Components

+octant:component

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) 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) SetAlert

func (t *Summary) SetAlert(alert Alert)

SetAlert sets an alert for the summary.

type SummaryConfig

type SummaryConfig struct {
	Sections SummarySections `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     `json:"name"`
	Contents FlexLayout `json:"contents"`
}

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 {
	Base
	Config TableConfig `json:"config"`
	// contains filtered or unexported fields
}

Table contains other Components

+octant:component

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) AddButton added in v0.16.0

func (t *Table) AddButton(name string, payload action.Payload, buttonOptions ...ButtonOption)

AddButton adds a button the button group for a table.

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) IsEmpty

func (t *Table) IsEmpty() bool

IsEmpty returns true if there is one or more rows.

func (*Table) MarshalJSON

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

MarshalJSON implements json.Marshaler

func (*Table) Reverse added in v0.17.0

func (t *Table) Reverse()

func (*Table) Rows

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

Rows returns the table rows.

func (*Table) SetIsLoading

func (t *Table) SetIsLoading(isLoading bool)

func (*Table) SetPlaceholder

func (t *Table) SetPlaceholder(placeholder string)

SetPlaceholder adds placeholder text to an empty table.

func (*Table) Sort

func (t *Table) Sort(keys ...string)

Sort sorts a table by one or more keys with booleans for reverse and object status.

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"`
	ButtonGroup  *ButtonGroup           `json:"buttonGroup,omitempty"`
}

TableConfig is the contents of a Table

func (*TableConfig) UnmarshalJSON added in v0.16.0

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

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) AddExpandableDetail added in v0.18.0

func (t TableRow) AddExpandableDetail(details *ExpandableRowDetail)

AddExpandableDetail allows a row to be expandable

func (*TableRow) UnmarshalJSON

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

type TabsOrientation added in v0.21.0

type TabsOrientation string

TabsOrientation is the direction of the Tabs

const (
	// VerticalTabs are tabs organized vertically
	VerticalTabs TabsOrientation = "vertical"
	// HorizontalTabs are tabs organized horizontally
	HorizontalTabs TabsOrientation = "horizontal"
)

type TabsView added in v0.21.0

type TabsView struct {
	Base
	Config TabsViewConfig `json:"config"`
}

func NewTabs added in v0.21.0

func NewTabs(orientation TabsOrientation, tabs []SingleTab) *TabsView

func (*TabsView) MarshalJSON added in v0.21.0

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

MarshalJSON marshals a button group.

type TabsViewConfig added in v0.21.0

type TabsViewConfig struct {
	// Tabs are an array of Tab structs
	Tabs []SingleTab `json:"tabs"`
	// Orientation is the direction of the tabs
	Orientation TabsOrientation `json:"orientation,omitempty"`
}

func (*TabsViewConfig) UnmarshalJSON added in v0.21.0

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

type Terminal added in v0.10.0

type Terminal struct {
	Base
	Config TerminalConfig `json:"config"`
}

Terminal is a terminal component.

+octant:component

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) MarshalJSON added in v0.10.0

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

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 {
	Base
	Config TextConfig `json:"config"`
}

Text is a component for text +octant:component

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) AddClipboard added in v0.20.0

func (t *Text) AddClipboard(value string)

AddClipboard adds a clipboard button next to text

func (*Text) DisableMarkdown

func (t *Text) DisableMarkdown()

DisableMarkdown disables markdown for this text component.

func (*Text) DisableTrustedContent added in v0.16.1

func (t *Text) DisableTrustedContent()

DisableTrustedContent enables trusted content for markdown of this text component.

func (*Text) EnableMarkdown

func (t *Text) EnableMarkdown()

EnableMarkdown enables markdown for this text component.

func (*Text) EnableTrustedContent added in v0.16.1

func (t *Text) EnableTrustedContent()

EnableTrustedContent enables trusted content for markdown of this text component.

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) 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.

func (*Text) TrustedContent added in v0.16.1

func (t *Text) TrustedContent() bool

TrustedContent returns if this component markdown has trusted content.

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"`
	// TrustedContent sets if the content of the markdown text can be trusted.
	// Use this when you want to use the markdown area to render custom HTML and links.
	// Setting this to true for content you do not control, like Kubernetes Resources, can result
	// in your plugin exposing XSS vulnerabilities.
	TrustedContent bool `json:"trustedContent,omitempty"`
	// Status sets the status of the component.
	Status TextStatus `json:"status,omitempty"`
	// ClipboardValue adds a copy button with text to be added to clipboard
	ClipboardValue string `json:"clipboardValue,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 Timeline added in v0.18.0

type Timeline struct {
	Base
	Config TimelineConfig `json:"config"`
	// contains filtered or unexported fields
}

Timeline is a component for timeline +octant:component

func NewTimeline added in v0.18.0

func NewTimeline(steps []TimelineStep, vertical bool) *Timeline

NewTimeline creates a timeline component

func (*Timeline) Add added in v0.18.0

func (t *Timeline) Add(steps ...TimelineStep)

Add adds an additional step to the timeline

func (*Timeline) MarshalJSON added in v0.18.0

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

type TimelineConfig added in v0.18.0

type TimelineConfig struct {
	Steps    []TimelineStep `json:"steps"`
	Vertical bool           `json:"vertical"`
}

TimelineConfig is the contents of Timeline

type TimelineState added in v0.18.0

type TimelineState string

TimelineState is the state of a timeline step

const (
	TimelineStepNotStarted TimelineState = "not-started"
	TimelineStepCurrent    TimelineState = "current"
	TimelineStepProcessing TimelineState = "processing"
	TimelineStepSuccess    TimelineState = "success"
	TimelineStepError      TimelineState = "error"
)

type TimelineStep added in v0.18.0

type TimelineStep struct {
	State       TimelineState `json:"state"`
	Header      string        `json:"header"`
	Title       string        `json:"title"`
	Description string        `json:"description"`
	ButtonGroup *ButtonGroup  `json:"buttonGroup,omitempty"`
}

TimelineStep is the data for each timeline step

func (*TimelineStep) UnmarshalJSON added in v0.18.0

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

type Timestamp

type Timestamp struct {
	Base
	Config TimestampConfig `json:"config"`
}

Timestamp is a component representing a point in time

+octant:component

func NewTimestamp

func NewTimestamp(t time.Time) *Timestamp

NewTimestamp creates a timestamp component

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

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 TooltipConfig added in v0.20.0

type TooltipConfig struct {
	Message  string          `json:"message"`
	Size     TooltipSize     `json:"size"`
	Position TooltipPosition `json:"position"`
}

type TooltipPosition added in v0.20.0

type TooltipPosition string
const (
	TooltipLeft        TooltipPosition = "left"
	TooltipRight       TooltipPosition = "right"
	TooltipTopLeft     TooltipPosition = "top-left"
	TooltipTopRight    TooltipPosition = "top-right"
	TooltipBottomLeft  TooltipPosition = "bottom-left"
	TooltipBottomRight TooltipPosition = "bottom-right"
)

type TooltipSize added in v0.20.0

type TooltipSize string
const (
	TooltipExtraSmall TooltipSize = "xs"
	TooltipSmall      TooltipSize = "sm"
	TooltipMedium     TooltipSize = "md"
	TooltipLarge      TooltipSize = "lg"
)

type TypedObject

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

func (*TypedObject) ToComponent

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

type YAML

type YAML struct {
	Base
	Config YAMLConfig `json:"config,omitempty"`
}

YAML is a YAML component.

+octant:component

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) MarshalJSON

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

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