view

package
v2.18.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package view defines shared saved view configurations.

Index

Constants

View Source
const (
	// TypeKanban renders the view as the Overview Kanban board.
	TypeKanban = "kanban"
	// TypeWorkflow filters and sorts the Workflows page.
	TypeWorkflow = "workflow"
	// TypeRun filters and scopes the Executions page.
	TypeRun = "run"
	// TypeArtifact filters and scopes the Artifacts page.
	TypeArtifact = "artifact"
)

Render types.

View Source
const (
	WorkspaceScopeAll       = "all"
	WorkspaceScopeDefault   = "default"
	WorkspaceScopeWorkspace = "workspace"
)

Workflow workspace scopes.

View Source
const (
	WorkflowSortName    = "name"
	WorkflowSortNextRun = "nextRun"
	SortOrderAscending  = "asc"
	SortOrderDescending = "desc"
)

Workflow sort fields and orders.

View Source
const (
	ColumnQueued  = "queued"
	ColumnRunning = "running"
	ColumnReview  = "review"
	ColumnDone    = "done"
	ColumnFailed  = "failed"
)

Kanban columns.

View Source
const (
	RunStatusAll         = "all"
	DateModePreset       = "preset"
	DateModeSpecific     = "specific"
	DateModeCustom       = "custom"
	DatePresetToday      = "today"
	DatePresetYesterday  = "yesterday"
	DatePresetLast7Days  = "last7days"
	DatePresetLast30Days = "last30days"
	DatePresetThisWeek   = "thisWeek"
	DatePresetThisMonth  = "thisMonth"
	// DatePresetAll applies no date bound. Only artifact views accept it.
	DatePresetAll       = "all"
	SpecificPeriodDate  = "date"
	SpecificPeriodMonth = "month"
	SpecificPeriodYear  = "year"
)

Run filter values. RunStatusAll matches every run status; date-related constants mirror the Executions page filter controls.

View Source
const (
	MaxNameLength          = 100
	MaxDAGNameLength       = 255
	MaxFileNameLength      = 255
	MaxLabels              = 50
	MaxLabelLength         = 128
	MinIntervalDays        = 1
	MaxIntervalDays        = 30
	MaxDAGRunIDLength      = 64
	MaxRunStatusLength     = 16
	MaxSpecificValueLength = 16
	MaxDateLength          = 32
)

Field bounds.

View Source
const (
	MinRunStatusCode = 0
	MaxRunStatusCode = 8
)

Run status bounds mirror the execution lifecycle statuses: NotStarted (0) through Rejected (8).

Variables

View Source
var (
	ErrInvalidViewID         = errors.New("view: invalid id")
	ErrViewNotFound          = errors.New("view: not found")
	ErrViewExists            = errors.New("view: already exists")
	ErrInvalidName           = errors.New("view: name is required")
	ErrNameTooLong           = errors.New("view: name too long")
	ErrDAGNameTooLong        = errors.New("view: dagName too long")
	ErrFileNameTooLong       = errors.New("view: fileName too long")
	ErrInvalidInterval       = errors.New("view: intervalDays out of range")
	ErrTooManyLabels         = errors.New("view: too many labels")
	ErrInvalidType           = errors.New("view: unknown type")
	ErrInvalidColumns        = errors.New("view: invalid columns")
	ErrInvalidWorkspaceScope = errors.New("view: invalid workspace scope")
	ErrInvalidSortField      = errors.New("view: invalid sort field")
	ErrInvalidSortOrder      = errors.New("view: invalid sort order")
	ErrDAGRunIDTooLong       = errors.New("view: dagRunId too long")
	ErrInvalidRunStatus      = errors.New("view: invalid run status")
	ErrRunStatusTooLong      = errors.New("view: runStatus too long")
	ErrInvalidSpecificValue  = errors.New("view: invalid specific value")
	ErrInvalidDateMode       = errors.New("view: invalid date mode")
	ErrInvalidDatePreset     = errors.New("view: invalid date preset")
	ErrInvalidSpecificPeriod = errors.New("view: invalid specific period")
	ErrSpecificValueTooLong  = errors.New("view: specific value too long")
	ErrInvalidDate           = errors.New("view: invalid date")
	ErrDateTooLong           = errors.New("view: date too long")
	ErrViewChanged           = errors.New("view: changed")
)

Sentinel errors returned by views and their stores.

Functions

func DefaultColumns

func DefaultColumns() []string

DefaultColumns returns all Kanban columns in their default display order.

func ValidArtifactDateMode added in v2.17.0

func ValidArtifactDateMode(mode string) bool

ValidArtifactDateMode reports whether mode is a supported Artifacts page date range mode. Artifact views have no period granularity, so DateModeSpecific is not accepted.

func ValidArtifactDatePreset added in v2.17.0

func ValidArtifactDatePreset(preset string) bool

ValidArtifactDatePreset reports whether preset is a supported Artifacts page date preset. It extends the run presets with DatePresetAll, which applies no date bound.

func ValidColumns

func ValidColumns(columns []string) bool

ValidColumns reports whether columns is a non-empty, duplicate-free subset of the supported Kanban columns.

func ValidRunDateMode added in v2.17.0

func ValidRunDateMode(mode string) bool

ValidRunDateMode reports whether mode is a supported Executions page date range mode.

func ValidRunDatePreset added in v2.17.0

func ValidRunDatePreset(preset string) bool

ValidRunDatePreset reports whether preset is a supported relative run date preset.

func ValidRunDateString added in v2.17.0

func ValidRunDateString(value string) bool

ValidRunDateString reports whether value is empty or a datetime-local string (YYYY-MM-DDTHH:mm, optionally with seconds).

func ValidRunSpecificPeriod added in v2.17.0

func ValidRunSpecificPeriod(period string) bool

ValidRunSpecificPeriod reports whether period is a supported run period granularity.

func ValidRunSpecificValue added in v2.17.0

func ValidRunSpecificValue(period string, value string) bool

ValidRunSpecificValue reports whether value matches the granularity of period: a date (YYYY-MM-DD), month (YYYY-MM), or year (YYYY). Periods the caller does not recognize are not the concern of this checker, so they count as valid to avoid masking an invalid-period error.

func ValidRunStatus added in v2.17.0

func ValidRunStatus(status string) bool

ValidRunStatus reports whether status is a supported run status: the wildcard "all" or a numeric status code within the execution lifecycle range [MinRunStatusCode, MaxRunStatusCode].

func ValidSortOrder added in v2.12.0

func ValidSortOrder(order string) bool

ValidSortOrder reports whether order is a supported view sort order.

func ValidType

func ValidType(t string) bool

ValidType reports whether t is a known render type.

func ValidWorkflowSortField added in v2.12.0

func ValidWorkflowSortField(field string) bool

ValidWorkflowSortField reports whether field is supported by the Workflows page.

func ValidWorkspaceScope added in v2.12.0

func ValidWorkspaceScope(scope string, workspace string) bool

ValidWorkspaceScope reports whether scope and workspace identify a workflow scope.

Types

type Store

type Store interface {
	Create(ctx context.Context, v *View) error
	GetByID(ctx context.Context, id string) (*View, error)
	List(ctx context.Context) ([]*View, error)
	Update(ctx context.Context, v *View, expectedWorkspace string) error
	Delete(ctx context.Context, id string, expectedWorkspace string) error
}

Store persists view configurations. Implementations are safe for concurrent use. List returns views ordered by creation time, oldest first.

type View

type View struct {
	ID             string
	Name           string
	Type           string
	Workspace      string
	Labels         []string
	DAGName        string
	FileName       string
	IntervalDays   int
	Columns        []string
	Pinned         bool
	WorkspaceScope string
	SortField      string
	SortOrder      string
	ActiveOnly     bool
	// Run and artifact filters. DAGRunID and RunStatus are TypeRun only;
	// SpecificPeriod and SpecificValue back the TypeRun "specific" date mode.
	DAGRunID       string
	RunStatus      string
	DateMode       string
	DatePreset     string
	SpecificPeriod string
	SpecificValue  string
	FromDate       string
	ToDate         string
	Default        bool
	CreatedBy      string
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

View is a shared saved view configuration. CreatedBy is recorded for display only and confers no ownership.

func (*View) Normalize

func (v *View) Normalize()

Normalize trims string fields, drops empty or oversized labels, and applies default values. Call before Validate.

func (*View) ToStorage

func (v *View) ToStorage() *ViewForStorage

ToStorage converts a View to its persistence representation.

func (*View) Validate

func (v *View) Validate() error

Validate reports whether the view's fields satisfy their bounds. It assumes Normalize has already been applied.

type ViewForStorage

type ViewForStorage struct {
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	Type           string    `json:"type"`
	Workspace      string    `json:"workspace,omitempty"`
	Labels         []string  `json:"labels,omitempty"`
	DAGName        string    `json:"dag_name,omitempty"`
	FileName       string    `json:"file_name,omitempty"`
	IntervalDays   int       `json:"interval_days"`
	Columns        []string  `json:"columns,omitempty"`
	Pinned         bool      `json:"pinned,omitempty"`
	WorkspaceScope string    `json:"workspace_scope,omitempty"`
	SortField      string    `json:"sort_field,omitempty"`
	SortOrder      string    `json:"sort_order,omitempty"`
	ActiveOnly     bool      `json:"active_only,omitempty"`
	DAGRunID       string    `json:"dag_run_id,omitempty"`
	RunStatus      string    `json:"run_status,omitempty"`
	DateMode       string    `json:"date_mode,omitempty"`
	DatePreset     string    `json:"date_preset,omitempty"`
	SpecificPeriod string    `json:"specific_period,omitempty"`
	SpecificValue  string    `json:"specific_value,omitempty"`
	FromDate       string    `json:"from_date,omitempty"`
	ToDate         string    `json:"to_date,omitempty"`
	Default        bool      `json:"default,omitempty"`
	CreatedBy      string    `json:"created_by,omitempty"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
}

ViewForStorage is the on-disk JSON representation of a View.

func (*ViewForStorage) ToView

func (s *ViewForStorage) ToView() *View

ToView converts a stored representation back to a View.

Jump to

Keyboard shortcuts

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