view

package
v2.11.2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package view defines saved Overview view configurations. A view captures a DAG-run query (workspace, labels, DAG name, relative date window) and the render type used to display it. Kanban is currently the only render type; the Type field is a forward-compatible discriminator for future types.

Index

Constants

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

Kanban columns.

View Source
const (
	MaxNameLength    = 100
	MaxDAGNameLength = 255
	MaxLabels        = 50
	MaxLabelLength   = 128
	MinIntervalDays  = 1
	MaxIntervalDays  = 30
)

Field bounds.

View Source
const (
	// TypeKanban renders the view as the Overview Kanban board.
	TypeKanban = "kanban"
)

Render types.

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

func ValidColumns(columns []string) bool

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

func ValidType

func ValidType(t string) bool

ValidType reports whether t is a known render type.

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 // empty means all workspaces
	Labels       []string
	DAGName      string
	IntervalDays int
	Columns      []string
	Pinned       bool
	CreatedBy    string
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

View is a saved Overview view configuration. Views are global and shared: they are keyed by ID with no per-user scoping. 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"`
	IntervalDays int       `json:"interval_days"`
	Columns      []string  `json:"columns,omitempty"`
	Pinned       bool      `json:"pinned,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