yaml

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//
	// Using the previously defined API types
	// for backwards compatibility.
	//
	NodeTypeTrigger = "TYPE_TRIGGER"
	NodeTypeWidget  = "TYPE_WIDGET"
	NodeTypeAction  = "TYPE_ACTION"
)
View Source
const (
	ConsolePanelTypeMarkdown  = "markdown"
	ConsolePanelTypeHTML      = "html"
	ConsolePanelTypeNode      = "node"
	ConsolePanelTypeNodes     = "nodes"
	ConsolePanelTypeTable     = "table"
	ConsolePanelTypeChart     = "chart"
	ConsolePanelTypeNumber    = "number"
	ConsolePanelTypeScorecard = "scorecard"

	MaxConsolePanels       = 50
	MaxConsolePayloadBytes = 1024 * 1024
)
View Source
const (
	KindCanvas  = "Canvas"
	KindConsole = "Console"
	APIVersion  = "v1"
)

Variables

AllowedConsolePanelTypes lists the panel `type` values accepted on import. Keep this list in lockstep with `web_src/src/pages/app/console/panelTypes.ts` — the frontend validators and per-type form editors rely on the same set.

View Source
var AllowedMarkdownRunSelects = []string{"latest", "latest_passed", "latest_failed"}

AllowedMarkdownRunSelects mirrors `MARKDOWN_RUN_SELECTS` on the FE.

View Source
var AllowedMarkdownVariableDirections = []string{"asc", "desc"}

AllowedMarkdownVariableDirections mirrors `MARKDOWN_VARIABLE_DIRECTIONS` on the FE.

View Source
var AllowedMarkdownVariableModes = []string{"single", "list"}

AllowedMarkdownVariableModes mirrors `MARKDOWN_VARIABLE_MODES` on the FE. `single` keeps the existing first-row behavior; `list` resolves the variable to every matching row so authors can use CEL list macros.

View Source
var AllowedRunStatusFilters = []string{"running", "passed", "failed", "cancelled"}

AllowedRunStatusFilters mirrors `RUN_STATUS_FILTER_OPTIONS` on the FE. Shared by the widget runs datasource and markdown/html run variables so the accepted vocabulary cannot drift between kinds.

Functions

func ModelTypeToYamlType

func ModelTypeToYamlType(t string) string

func ValidateConsoleContent

func ValidateConsoleContent(panels []ConsolePanel, layout []ConsoleLayoutItem) error

func VersionToCanvasYAML

func VersionToCanvasYAML(name string, description string, canvasVersion *models.CanvasVersion) (string, error)

func VersionToConsoleYML

func VersionToConsoleYML(canvasName string, canvasVersion *models.CanvasVersion) (string, error)

Types

type Canvas

type Canvas struct {
	APIVersion string          `json:"apiVersion" yaml:"apiVersion"`
	Kind       string          `json:"kind" yaml:"kind"`
	Metadata   *CanvasMetadata `json:"metadata" yaml:"metadata"`
	Spec       *CanvasSpec     `json:"spec" yaml:"spec"`
}

func CanvasFromYAML

func CanvasFromYAML(raw []byte) (*Canvas, error)

func (*Canvas) Edges

func (c *Canvas) Edges() []models.Edge

func (*Canvas) FindShadowedNameWarnings

func (c *Canvas) FindShadowedNameWarnings(registry *registry.Registry) map[string]string

FindShadowedNameWarnings detects nodes with duplicate names within connected components. Only nodes that are connected (directly or transitively) and share the same name will be flagged. Returns a map of node ID -> warning message.

func (*Canvas) Nodes

func (c *Canvas) Nodes() []models.Node

func (*Canvas) Parse

func (c *Canvas) Parse(registry *registry.Registry, orgID string) ([]models.Node, []models.Edge, error)

type CanvasMetadata

type CanvasMetadata struct {
	ID          string `json:"id" yaml:"id"`
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description" yaml:"description"`
}

type CanvasSpec

type CanvasSpec struct {
	Nodes []Node `json:"nodes" yaml:"nodes"`
	Edges []Edge `json:"edges" yaml:"edges"`
}

type Console

type Console struct {
	APIVersion string          `json:"apiVersion" yaml:"apiVersion"`
	Kind       string          `json:"kind" yaml:"kind"`
	Metadata   ConsoleMetadata `json:"metadata" yaml:"metadata"`
	Spec       ConsoleSpec     `json:"spec" yaml:"spec"`
}

func ConsoleFromYML

func ConsoleFromYML(raw []byte) (*Console, error)

func (*Console) Layout

func (c *Console) Layout() []models.ConsoleLayoutItem

func (*Console) Panels

func (c *Console) Panels() []models.ConsolePanel

func (*Console) Validate

func (c *Console) Validate() error

type ConsoleLayoutItem

type ConsoleLayoutItem struct {
	I    string `json:"i" yaml:"i"`
	X    int    `json:"x" yaml:"x"`
	Y    int    `json:"y" yaml:"y"`
	W    int    `json:"w" yaml:"w"`
	H    int    `json:"h" yaml:"h"`
	MinW *int   `json:"minW,omitempty" yaml:"minW,omitempty"`
	MinH *int   `json:"minH,omitempty" yaml:"minH,omitempty"`
}

type ConsoleMetadata

type ConsoleMetadata struct {
	CanvasID string `json:"canvasId" yaml:"canvasId"`
	Name     string `json:"name" yaml:"name"`
}

type ConsolePanel

type ConsolePanel struct {
	ID      string         `json:"id" yaml:"id"`
	Type    string         `json:"type" yaml:"type"`
	Content map[string]any `json:"content" yaml:"content"`
}

type ConsoleSpec

type ConsoleSpec struct {
	Panels []ConsolePanel      `json:"panels" yaml:"panels"`
	Layout []ConsoleLayoutItem `json:"layout" yaml:"layout"`
}

type Edge

type Edge struct {
	SourceID string `json:"sourceId" yaml:"sourceId"`
	TargetID string `json:"targetId" yaml:"targetId"`
	Channel  string `json:"channel" yaml:"channel"`
}

func (*Edge) Model

func (e *Edge) Model() models.Edge

type IntegrationRef

type IntegrationRef struct {
	ID   string `json:"id" yaml:"id"`
	Name string `json:"name" yaml:"name"`
}

type Node

type Node struct {
	ID             string          `json:"id" yaml:"id"`
	Name           string          `json:"name" yaml:"name"`
	Type           string          `json:"type" yaml:"type"`
	Component      string          `json:"component" yaml:"component"`
	Configuration  map[string]any  `json:"configuration" yaml:"configuration"`
	Position       Position        `json:"position" yaml:"position"`
	IsCollapsed    bool            `json:"isCollapsed" yaml:"isCollapsed"`
	Metadata       map[string]any  `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Integration    *IntegrationRef `json:"integration,omitempty" yaml:"integration,omitempty"`
	ErrorMessage   *string         `json:"errorMessage,omitempty" yaml:"errorMessage,omitempty"`
	WarningMessage *string         `json:"warningMessage,omitempty" yaml:"warningMessage,omitempty"`
}

func (*Node) Model

func (n *Node) Model() models.Node

func (*Node) NodeTypeForModel

func (n *Node) NodeTypeForModel() string

type Position

type Position struct {
	X int `json:"x" yaml:"x"`
	Y int `json:"y" yaml:"y"`
}

Jump to

Keyboard shortcuts

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