view

package
v1.0.1140 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ReservedColumnAttributes = "__row__attributes"
	ReservedColumnGrants     = "__grants"
)

Variables

This section is empty.

Functions

func CreateViewTable added in v1.0.983

func CreateViewTable(ctx context.Context, table string, columns ViewColumnDefList) error

func ExecuteQuery

func ExecuteQuery(ctx context.Context, q Query) ([]dataquery.QueryResultRow, error)

ExecuteQuery executes a single query and returns results with query name

func GetAllViews added in v1.0.983

func GetAllViews(ctx context.Context) ([]models.View, error)

func InsertViewRows added in v1.0.983

func InsertViewRows(ctx context.Context, table string, columns ViewColumnDefList, rows []Row, requestFingerprint string) error

func QueryViewTables added in v1.0.1041

func QueryViewTables(ctx context.Context, selector ViewSelector) ([]dataquery.QueryResultRow, error)

Types

type BadgeConfig added in v1.0.1117

type BadgeConfig struct {
	Color *ColorSource `json:"color,omitempty" yaml:"color,omitempty"`
}

+kubebuilder:object:generate=true

func (*BadgeConfig) DeepCopy added in v1.0.1117

func (in *BadgeConfig) DeepCopy() *BadgeConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BadgeConfig.

func (*BadgeConfig) DeepCopyInto added in v1.0.1117

func (in *BadgeConfig) DeepCopyInto(out *BadgeConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CardConfig added in v1.0.1096

type CardConfig struct {
	// Position defines where the field is displayed on the card
	// +kubebuilder:validation:Enum=title;subtitle;deck;body;footer;headerRight
	Position string `json:"position,omitempty" yaml:"position,omitempty"`

	// UseForAccent indicates if this column's value should be used for the accent color
	UseForAccent bool `json:"useForAccent,omitempty" yaml:"useForAccent,omitempty"`
}

CardConfig defines card layout configuration +kubebuilder:object:generate=true

func (*CardConfig) DeepCopy added in v1.0.1112

func (in *CardConfig) DeepCopy() *CardConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CardConfig.

func (*CardConfig) DeepCopyInto added in v1.0.1112

func (in *CardConfig) DeepCopyInto(out *CardConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CardPosition added in v1.0.1091

type CardPosition string

CardPosition defines predefined card rendering styles

const (
	CardPositionTitle    CardPosition = "title"
	CardPositionSubtitle CardPosition = "subtitle"
	CardPositionBody     CardPosition = "body"
	CardPositionFooter   CardPosition = "footer"

	// Show on the header after subtitle
	CardPositionDeck CardPosition = "deck"

	// Show on the header right side
	CardPositionHeaderRight CardPosition = "headerRight"
)

type ColorSource added in v1.0.1117

type ColorSource struct {
	// Auto indicates UI uses heuristics to determine color based on value
	Auto bool `json:"auto,omitempty" yaml:"auto,omitempty"`

	// Map defines explicit color mappings for specific values
	Map map[string]string `json:"map,omitempty" yaml:"map,omitempty"`
}

+kubebuilder:object:generate=true

func (*ColorSource) DeepCopy added in v1.0.1117

func (in *ColorSource) DeepCopy() *ColorSource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ColorSource.

func (*ColorSource) DeepCopyInto added in v1.0.1117

func (in *ColorSource) DeepCopyInto(out *ColorSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ColumnDef added in v1.0.1008

type ColumnDef struct {
	// Name of the column
	Name string `json:"name" yaml:"name"`

	// PrimaryKey indicates if the column is a primary key
	PrimaryKey bool `json:"primaryKey,omitempty" yaml:"primaryKey,omitempty"`

	// +kubebuilder:validation:Enum=string;number;boolean;datetime;duration;health;status;gauge;bytes;decimal;millicore;config_item;labels
	Type ColumnType `json:"type" yaml:"type"`

	// Width defines the display width of the column (e.g. "2" for weight or "150px")
	Width string `json:"width,omitempty" yaml:"width,omitempty"`

	// Description of the column
	Description string `json:"description,omitempty" yaml:"description,omitempty"`

	// Hidden indicates if the column should be hidden from view
	Hidden bool `json:"hidden,omitempty" yaml:"hidden,omitempty"`

	// Configuration for gauge visualization
	Gauge *GaugeConfig `json:"gauge,omitempty" yaml:"gauge,omitempty"`

	// Configuration for config item columns
	ConfigItem *ConfigItemColumnType `json:"configItem,omitempty"`

	// Badge configuration for the column
	Badge *BadgeConfig `json:"badge,omitempty" yaml:"badge,omitempty"`

	// Icon to use for the column.
	//
	// Supports mapping to a row value.
	// Example: icon: row.health
	Icon *string `json:"icon,omitempty" yaml:"icon,omitempty"`

	// Deprecated: Use properties instead. Example: URL
	//
	// For references the column this column is for.
	// Applicable only for type=url.
	//
	// When a column is designated for a different column,
	// it's not rendered on the UI but the designated column uses it to render itself.
	For *string `json:"for,omitempty" yaml:"for,omitempty"`

	// Enable filters in the UI
	Filter *ColumnFilter `json:"filter,omitempty" yaml:"filter,omitempty"`

	// Link to various mission control components.
	URL *ColumnURL `json:"url,omitempty" yaml:"url,omitempty"`

	// Unit of the column
	Unit string `json:"unit,omitempty" yaml:"unit,omitempty"`

	// Card defines the card layout configuration for the field
	Card *CardConfig `json:"card,omitempty" yaml:"card,omitempty"`

	// Deprecated: Use Card instead
	// +kubebuilder:validation:Enum=title;subtitle;deck;body;footer;headerRight
	// CardPosition defines the visual presentation style for the card field
	CardPosition CardPosition `json:"cardPosition,omitempty"`
}

ColumnDef defines a column in the view +kubebuilder:object:generate=true +kubebuilder:validation:XValidation:rule="self.type=='gauge' ? has(self.gauge) : !has(self.gauge)",message="gauge config required when type is gauge, not allowed for other types"

func (*ColumnDef) DeepCopy added in v1.0.1008

func (in *ColumnDef) DeepCopy() *ColumnDef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ColumnDef.

func (*ColumnDef) DeepCopyInto added in v1.0.1008

func (in *ColumnDef) DeepCopyInto(out *ColumnDef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ColumnFilter added in v1.0.1005

type ColumnFilter struct {
	Type ColumnFilterType `json:"type" yaml:"type"`
}

type ColumnFilterType added in v1.0.1005

type ColumnFilterType string
const (
	ColumnFilterTypeMultiSelect ColumnFilterType = "multiselect"
)

type ColumnType added in v1.0.983

type ColumnType string
const (
	ColumnTypeBoolean    ColumnType = "boolean"
	ColumnTypeBytes      ColumnType = "bytes"
	ColumnTypeConfigItem ColumnType = "config_item"
	ColumnTypeDateTime   ColumnType = "datetime"
	ColumnTypeDecimal    ColumnType = "decimal"
	ColumnTypeDuration   ColumnType = "duration"
	ColumnTypeGauge      ColumnType = "gauge"
	ColumnTypeHealth     ColumnType = "health"
	ColumnTypeMillicore  ColumnType = "millicore"
	ColumnTypeNumber     ColumnType = "number"
	ColumnTypeStatus     ColumnType = "status"
	ColumnTypeString     ColumnType = "string"
	ColumnTypeLabels     ColumnType = "labels"

	// reserved type for internal use.
	// Stores properties for all the columns in a row.
	ColumnTypeAttributes ColumnType = "row_attributes"

	// reserved type for internal use.
	// Stores scope UUIDs for row-level access control.
	ColumnTypeGrants ColumnType = "grants"
)

type ColumnURL added in v1.0.1008

type ColumnURL struct {
	// Cel expression that evaluates to the id of the config or search query.
	// Example:
	// - uuid: row.id
	// - search term:  f("name=$(tags.namespace) tags.cluster=$(tags.cluster) type=Kubernetes::Namespace", row)
	Config types.CelExpression `json:"config,omitempty" template:"true"`

	// Template a custom URL using Go template.
	Template types.GoTemplate `json:"template,omitempty" yaml:"template,omitempty"`

	// Link to a view.
	View *ViewURLRef `json:"view,omitempty" template:"true"`
}

+kubebuilder:object:generate=true

func (*ColumnURL) DeepCopy added in v1.0.1008

func (in *ColumnURL) DeepCopy() *ColumnURL

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ColumnURL.

func (*ColumnURL) DeepCopyInto added in v1.0.1008

func (in *ColumnURL) DeepCopyInto(out *ColumnURL)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (ColumnURL) Eval added in v1.0.1008

func (colURL ColumnURL) Eval(ctx context.Context, env map[string]any) (any, error)

type ConfigItemColumnType added in v1.0.1087

type ConfigItemColumnType struct {
	// IDField which field, from the merged query result, to use as the config item ID
	//
	// If not specified, defaults to "id"
	IDField string `json:"idField,omitempty"`
}

type GaugeConfig added in v1.0.983

type GaugeConfig struct {
	Max        string           `json:"max,omitempty" yaml:"max,omitempty"`
	Min        string           `json:"min,omitempty" yaml:"min,omitempty"`
	Precision  int              `json:"precision,omitempty" yaml:"precision,omitempty"`
	Thresholds []GaugeThreshold `json:"thresholds,omitempty" yaml:"thresholds,omitempty"`
}

GaugeConfig defines configuration for gauge visualization +kubebuilder:object:generate=true

func (*GaugeConfig) DeepCopy added in v1.0.983

func (in *GaugeConfig) DeepCopy() *GaugeConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GaugeConfig.

func (*GaugeConfig) DeepCopyInto added in v1.0.983

func (in *GaugeConfig) DeepCopyInto(out *GaugeConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GaugeThreshold added in v1.0.983

type GaugeThreshold struct {
	// Deprecated: Use Percent instead
	// +kubebuilder:validation:Optional
	Value int `json:"value,omitempty" yaml:"value,omitempty"`

	// Percent is the percentage value of the threshold
	Percent int `json:"percent" yaml:"percent"`

	// Color is the color of the threshold
	Color string `json:"color" yaml:"color"`
}

GaugeThreshold defines a threshold configuration for gauge charts +kubebuilder:object:generate=true

func (*GaugeThreshold) DeepCopy added in v1.0.983

func (in *GaugeThreshold) DeepCopy() *GaugeThreshold

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GaugeThreshold.

func (*GaugeThreshold) DeepCopyInto added in v1.0.983

func (in *GaugeThreshold) DeepCopyInto(out *GaugeThreshold)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Query

type Query struct {
	dataquery.Query `json:",inline" yaml:",inline" template:"true"`

	// Configs queries config items
	Configs *types.ResourceSelector `json:"configs,omitempty" yaml:"configs,omitempty" template:"true"`

	// Changes queries config changes
	Changes *types.ResourceSelector `json:"changes,omitempty" yaml:"changes,omitempty" template:"true"`

	// ViewTableSelector queries data from tables generated by other views
	ViewTableSelector *ViewSelector `json:"viewTableSelector,omitempty" yaml:"viewTableSelector,omitempty" template:"true"`
}

+kubebuilder:object:generate=true

func (*Query) DeepCopy

func (in *Query) DeepCopy() *Query

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Query.

func (*Query) DeepCopyInto

func (in *Query) DeepCopyInto(out *Query)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Query) IsEmpty

func (v *Query) IsEmpty() bool

type Row added in v1.0.983

type Row []any

Row represents a single row of data mapped to view columns

func ReadViewTable added in v1.0.983

func ReadViewTable(ctx context.Context, columnDef ViewColumnDefList, table string, requestFingerprint string) ([]Row, error)

type ViewColumnDefList added in v1.0.983

type ViewColumnDefList []ColumnDef

func GetViewColumnDefs added in v1.0.983

func GetViewColumnDefs(ctx context.Context, namespace, name string) (ViewColumnDefList, error)

func (ViewColumnDefList) PrimaryKey added in v1.0.983

func (c ViewColumnDefList) PrimaryKey() []string

func (ViewColumnDefList) QuotedColumns added in v1.0.997

func (c ViewColumnDefList) QuotedColumns() []string

func (ViewColumnDefList) SelectColumns added in v1.0.983

func (c ViewColumnDefList) SelectColumns() []string

func (ViewColumnDefList) ToColumnTypeMap added in v1.0.983

func (c ViewColumnDefList) ToColumnTypeMap() map[string]models.ColumnType

type ViewSelector added in v1.0.1041

type ViewSelector struct {
	Name          string `yaml:"name,omitempty" json:"name,omitempty"`
	Namespace     string `yaml:"namespace,omitempty" json:"namespace,omitempty"`
	LabelSelector string `json:"labelSelector,omitempty" yaml:"labelSelector,omitempty"`
}

+kubebuilder:object:generate=true

func (*ViewSelector) DeepCopy added in v1.0.1041

func (in *ViewSelector) DeepCopy() *ViewSelector

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ViewSelector.

func (*ViewSelector) DeepCopyInto added in v1.0.1041

func (in *ViewSelector) DeepCopyInto(out *ViewSelector)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ViewSelector) IsEmpty added in v1.0.1041

func (vs *ViewSelector) IsEmpty() bool

func (*ViewSelector) ToResourceSelector added in v1.0.1041

func (vs *ViewSelector) ToResourceSelector() types.ResourceSelector

type ViewURLRef added in v1.0.1008

type ViewURLRef struct {
	Namespace string            `json:"namespace,omitempty" template:"true"`
	Name      string            `json:"name,omitempty" template:"true"`
	Filter    map[string]string `json:"filter,omitempty" template:"true"`
}

+kubebuilder:object:generate=true

func (*ViewURLRef) DeepCopy added in v1.0.1008

func (in *ViewURLRef) DeepCopy() *ViewURLRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ViewURLRef.

func (*ViewURLRef) DeepCopyInto added in v1.0.1008

func (in *ViewURLRef) DeepCopyInto(out *ViewURLRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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