dataentry

package
v0.0.0-...-466d959 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: AGPL-3.0 Imports: 42 Imported by: 0

Documentation

Overview

Package dataentry provides a config-driven data entry web application built on top of rela's metamodel system. It reads a data-entry.yaml config file alongside a rela project and serves an interactive UI for CRUD operations on entities stored as markdown files.

Configuration types and validation logic live in the dataentryconfig package so that the CLI can validate configs without importing the full web layer. This file re-exports those types for backward compatibility.

Index

Constants

View Source
const (
	WidgetText        = dataentryconfig.WidgetText
	WidgetSelect      = dataentryconfig.WidgetSelect
	WidgetMultiSelect = dataentryconfig.WidgetMultiSelect
	WidgetCheckbox    = dataentryconfig.WidgetCheckbox
	WidgetTextarea    = dataentryconfig.WidgetTextarea
	WidgetNumber      = dataentryconfig.WidgetNumber
	WidgetDate        = dataentryconfig.WidgetDate

	DirectionIncoming = dataentryconfig.DirectionIncoming
	DirectionOutgoing = dataentryconfig.DirectionOutgoing
)

Widget and direction constants — re-exported from dataentryconfig.

ConfigFile is the conventional filename for data-entry configuration within a rela project.

Variables

ValidateConfig re-exports the validation function from dataentryconfig.

Functions

This section is empty.

Types

type APIAnalysisResult

type APIAnalysisResult struct {
	Errors   int            `json:"errors"`
	Warnings int            `json:"warnings"`
	Issues   []APIIssue     `json:"issues"`
	ByCheck  map[string]int `json:"byCheck"`
}

APIAnalysisResult is the JSON representation of analysis results.

type APICreateEntityRequest

type APICreateEntityRequest struct {
	ID         string                 `json:"id,omitempty"` // Optional, auto-generated if empty
	Type       string                 `json:"type"`
	Properties map[string]interface{} `json:"properties"`
	Content    string                 `json:"content,omitempty"`
}

APICreateEntityRequest is the request body for creating an entity.

type APICreateRelationRequest

type APICreateRelationRequest struct {
	From       string                 `json:"from"`
	Type       string                 `json:"type"`
	To         string                 `json:"to"`
	Properties map[string]interface{} `json:"properties,omitempty"`
}

APICreateRelationRequest is the request body for creating a relation.

type APIEntity

type APIEntity struct {
	ID         string                 `json:"id"`
	Type       string                 `json:"type"`
	Properties map[string]interface{} `json:"properties"`
	Content    string                 `json:"content,omitempty"`
	Relations  []APIRelation          `json:"relations,omitempty"`
}

APIEntity is the JSON representation of an entity for the API.

type APIEntityType

type APIEntityType struct {
	Name       string                 `json:"name"`
	Plural     string                 `json:"plural"`
	Primary    string                 `json:"primary,omitempty"`
	Properties map[string]APIProperty `json:"properties"`
}

APIEntityType is the JSON representation of an entity type definition.

type APIIssue

type APIIssue struct {
	EntityID   string `json:"entityId"`
	EntityType string `json:"entityType"`
	Message    string `json:"message"`
	Severity   string `json:"severity"` // "error" or "warning"
	CheckType  string `json:"checkType"`
}

APIIssue is the JSON representation of a single analysis issue.

type APIMetamodel

type APIMetamodel struct {
	EntityTypes   []APIEntityType   `json:"entityTypes"`
	RelationTypes []APIRelationType `json:"relationTypes"`
}

APIMetamodel is the JSON representation of the project metamodel.

type APIProperty

type APIProperty struct {
	Type     string   `json:"type"`
	Required bool     `json:"required"`
	Default  string   `json:"default,omitempty"`
	Values   []string `json:"values,omitempty"` // for enum types
}

APIProperty is the JSON representation of a property definition.

type APIRelation

type APIRelation struct {
	Type        string                 `json:"type"`
	From        string                 `json:"from"`
	To          string                 `json:"to"`
	Direction   Direction              `json:"direction"` // "outgoing" or "incoming"
	TargetID    string                 `json:"targetId"`
	TargetTitle string                 `json:"targetTitle"`
	TargetType  string                 `json:"targetType"`
	Properties  map[string]interface{} `json:"properties,omitempty"`
}

APIRelation is the JSON representation of a relation for the API.

type APIRelationType

type APIRelationType struct {
	Name   string   `json:"name"`
	From   []string `json:"from"`
	To     []string `json:"to"`
	Plural string   `json:"plural,omitempty"`
}

APIRelationType is the JSON representation of a relation type definition.

type APIUpdateEntityRequest

type APIUpdateEntityRequest struct {
	Properties map[string]interface{} `json:"properties,omitempty"`
	Content    *string                `json:"content,omitempty"` // Pointer to distinguish empty from not provided
}

APIUpdateEntityRequest is the request body for updating an entity.

type AnalysisIssue

type AnalysisIssue struct {
	EntityID   string // Empty for non-entity issues (e.g., ID gaps)
	EntityType string
	Title      string
	Message    string
	Severity   string // "error" or "warning"
}

AnalysisIssue represents a single validation issue, optionally linked to an entity.

type AnalysisResult

type AnalysisResult struct {
	Sections     []AnalysisSection
	ErrorCount   int
	WarningCount int
}

AnalysisResult is the complete output of running all analyses.

type AnalysisSection

type AnalysisSection struct {
	Name        string
	Description string
	Issues      []AnalysisIssue
}

AnalysisSection groups issues by analysis category.

func (AnalysisSection) ErrorCount

func (s AnalysisSection) ErrorCount() int

ErrorCount returns the number of error-severity issues in this section.

func (AnalysisSection) WarningCount

func (s AnalysisSection) WarningCount() int

WarningCount returns the number of warning-severity issues in this section.

type App

type App struct {
	Cfg *Config
	// contains filtered or unexported fields
}

App is the central application struct holding config, metamodel, graph, and templates.

func NewApp

func NewApp(ws *workspace.Workspace) (*App, error)

NewApp creates and initializes an App using the given workspace.

func (*App) NewRouter

func (a *App) NewRouter() http.Handler

NewRouter returns an http.Handler with all data entry routes registered. Handlers are wrapped with a reload-lock middleware so that live-reload does not swap state mid-request. The SSE endpoint is excluded from the middleware since it holds the connection open indefinitely.

func (*App) ProjectName

func (a *App) ProjectName() string

ProjectName returns the display name of the loaded project.

func (*App) ProjectRoot

func (a *App) ProjectRoot() string

ProjectRoot returns the root directory of the loaded project.

func (*App) StartGitFetch

func (a *App) StartGitFetch() (stop func())

StartGitFetch begins periodic git fetch in the background. Returns a stop function to shut down the fetcher.

coverage-ignore: background goroutine with timer

func (*App) StartWatching

func (a *App) StartWatching() error

StartWatching begins file watching for live-reload of views when project files change. The workspace handles metamodel + graph reload; this method adds dataentry-specific side-effects (config reload, SSE broadcast). Stop via a.ws.StopWatching().

coverage-ignore: requires real filesystem events via fsnotify

type AppConfig

type AppConfig = dataentryconfig.AppConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type CheckboxStats

type CheckboxStats struct {
	Checked int
	Total   int
}

CheckboxStats holds completion counts for task list items.

type CommandConfig

type CommandConfig = dataentryconfig.CommandConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type CommandMessage

type CommandMessage struct {
	Type       string `json:"type"`
	Text       string `json:"text,omitempty"`
	Level      string `json:"level,omitempty"`
	Path       string `json:"path,omitempty"`
	Label      string `json:"label,omitempty"`
	Action     string `json:"action,omitempty"`
	ID         string `json:"id,omitempty"`
	EntityType string `json:"entity_type,omitempty"`
	URL        string `json:"url,omitempty"`
}

CommandMessage is a structured message parsed from a command's stdout.

type CommandScope

type CommandScope = dataentryconfig.CommandScope

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type Config

type Config = dataentryconfig.Config

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ConfigValidationError

type ConfigValidationError = dataentryconfig.ConfigValidationError

ConfigValidationError is re-exported from dataentryconfig.

type ConflictListItem

type ConflictListItem struct {
	Path        string
	RelPath     string
	EntityType  string
	EntityID    string
	MarkerCount int
}

ConflictListItem represents a conflicted file for display.

type ConflictResolutionData

type ConflictResolutionData struct {
	File       *conflict.ConflictedFile
	Info       *conflict.Info
	RelPath    string
	IsEntity   bool
	IsRelation bool
}

ConflictResolutionData contains data for the resolution page.

type DashboardCard

type DashboardCard = dataentryconfig.DashboardCard

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type DashboardConfig

type DashboardConfig = dataentryconfig.DashboardConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type DefaultOverride

type DefaultOverride = dataentryconfig.DefaultOverride

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type Direction

type Direction = dataentryconfig.Direction

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type DocumentConfig

type DocumentConfig = dataentryconfig.DocumentConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type FilterConfig

type FilterConfig = dataentryconfig.FilterConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type FilterControl

type FilterControl = dataentryconfig.FilterControl

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type Form

type Form = dataentryconfig.Form

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type FormField

type FormField = dataentryconfig.FormField

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type FormRelation

type FormRelation = dataentryconfig.FormRelation

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type GitStatusResponse

type GitStatusResponse struct {
	Available     bool     `json:"available"`
	Branch        string   `json:"branch,omitempty"`
	LocalChanges  int      `json:"local_changes"`
	RemoteAhead   int      `json:"remote_ahead"`
	Syncing       bool     `json:"syncing"`
	Conflict      bool     `json:"conflict"`
	ConflictFiles []string `json:"conflict_files,omitempty"`
}

GitStatusResponse is the JSON response for /api/git/status.

type GitSyncResponse

type GitSyncResponse struct {
	Success       bool     `json:"success"`
	Error         string   `json:"error,omitempty"`
	ConflictFiles []string `json:"conflict_files,omitempty"`
}

GitSyncResponse is the JSON response for /api/git/sync.

type GroupData

type GroupData struct {
	GroupName string
	Rows      []SectionRowData
	Entities  []SectionEntityData
}

GroupData holds a group of rows/entities for grouped table/card display.

type Kanban

type Kanban = dataentryconfig.Kanban

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type KanbanCard

type KanbanCard = dataentryconfig.KanbanCard

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type KanbanCardData

type KanbanCardData struct {
	ID          string
	EntityType  string
	Title       string
	Fields      []KanbanCardField
	AccentType  string // Property type for accent color (column property)
	AccentValue string // Value for accent color lookup
}

KanbanCardData holds the display data for a single card on the board.

type KanbanCardField

type KanbanCardField struct {
	Label    string
	Values   []string
	PropType string
}

KanbanCardField holds a single field displayed on a card.

type KanbanColumn

type KanbanColumn = dataentryconfig.KanbanColumn

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type KanbanSwimlane

type KanbanSwimlane = dataentryconfig.KanbanSwimlane

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type List

type List = dataentryconfig.List

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ListColumn

type ListColumn = dataentryconfig.ListColumn

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type NavElement struct {
	Item  *NavItem
	Group *NavGroup
}

NavElement is a union of either a direct NavItem or a NavGroup. Exactly one of Item or Group is non-nil.

type NavGroup struct {
	Group     string
	Collapsed bool
	Items     []NavItem
}

NavGroup is an enriched navigation group containing resolved nav items.

type NavItem struct {
	Label      string
	List       string
	Dashboard  bool
	Graph      bool
	Kanban     string
	EntityType string
	Count      int
}

NavItem is an enriched navigation entry that includes the entity type for client-side matching.

type NavigationEntry = dataentryconfig.NavigationEntry

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type PropertyHelp

type PropertyHelp struct {
	Name        string
	Type        string
	Required    bool
	Description htmltemplate.HTML
}

PropertyHelp holds documentation for a single property.

type RelationHelp

type RelationHelp struct {
	Name        string
	Label       string
	TargetType  string // target type for outgoing, source type for incoming
	Cardinality string
	Required    bool // true if min cardinality >= 1
	Description htmltemplate.HTML
}

RelationHelp holds documentation for a single relation.

type RelationProperty

type RelationProperty = dataentryconfig.RelationProperty

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ResolvedColumn

type ResolvedColumn struct {
	Value string
	Label string
}

ResolvedColumn holds a column's value and display label.

type ResolvedCommand

type ResolvedCommand struct {
	ID       string
	Label    string
	Confirm  string
	Context  string
	AutoOpen *bool
}

ResolvedCommand is a command that has been matched to a specific page context.

type ResolvedSwimlane

type ResolvedSwimlane struct {
	Value string
	Label string
}

ResolvedSwimlane holds a swimlane's value and display label.

type ScopeNav

type ScopeNav struct {
	PrevURL  string // URL for previous entity (empty if at first)
	NextURL  string // URL for next entity (empty if at last)
	Progress string // e.g. "[3/12]"
	Label    string // e.g. "12 tickets" or "5 results for 'auth'"
	BackURL  string // URL to return to the list/search
}

ScopeNav holds prev/next navigation context for browsing through a list of entities.

type SectionAddInfo

type SectionAddInfo struct {
	Relation string
	LinkAs   string // "from" or "to" — role of the new entity in the relation
	PeerID   string // entry entity ID
	Targets  []SectionAddTarget
}

SectionAddInfo describes an "Add" button on a view section.

type SectionAddTarget

type SectionAddTarget struct {
	EntityType string
	FormID     string
	Label      string
}

SectionAddTarget holds a possible entity type target for an "Add" button.

type SectionColumnData

type SectionColumnData struct {
	Values     []string
	PropType   string
	Widget     string
	Link       string // resolved link URL or empty
	EntityID   string
	EntityType string
}

SectionColumnData holds a resolved table cell for template rendering.

type SectionData

type SectionData struct {
	Heading      string
	SectionID    string
	Display      string
	Fields       []SectionFieldData
	Entities     []SectionEntityData
	Columns      []ListColumn
	Rows         []SectionRowData
	Groups       []GroupData
	IsGrouped    bool
	EmptyMessage string
	IsEmpty      bool
	Link         string // section-level link configuration (currently unused in templates)
	Content      string
	HasContent   bool
	AddInfo      *SectionAddInfo
	LinkInfo     *SectionLinkInfo
}

SectionData holds all resolved data for a single view section.

type SectionEntityData

type SectionEntityData struct {
	ID         string
	Title      string
	Type       string
	EditFormID string
	Fields     []SectionFieldData
	Content    string
	HasContent bool
}

SectionEntityData holds a resolved entity for template rendering.

type SectionFieldData

type SectionFieldData struct {
	Label    string
	Value    string
	PropType string
}

SectionFieldData holds a single resolved field for template rendering.

type SectionLinkInfo

type SectionLinkInfo struct {
	Relation    string   // relation type name
	LinkAs      string   // "from" or "to" — role of the linked entity
	PeerID      string   // entry entity ID
	EntityTypes []string // valid target entity types
}

SectionLinkInfo describes a "Link existing" button on a view section.

type SectionRowData

type SectionRowData struct {
	EntityID   string
	EntityType string
	EditFormID string
	Cells      []SectionColumnData
	Content    string
}

SectionRowData holds a resolved table row for template rendering.

type SidePanelConfig

type SidePanelConfig = dataentryconfig.SidePanelConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type SortSpec

type SortSpec = dataentryconfig.SortSpec

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type UIState

type UIState = dataentryconfig.UIState

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type UserDefaults

type UserDefaults = dataentryconfig.UserDefaults

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ViewConfig

type ViewConfig = dataentryconfig.ViewConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ViewEntry

type ViewEntry = dataentryconfig.ViewEntry

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ViewSection

type ViewSection = dataentryconfig.ViewSection

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ViewSectionField

type ViewSectionField = dataentryconfig.ViewSectionField

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ViewTraverse

type ViewTraverse = dataentryconfig.ViewTraverse

Config type aliases — re-exported from dataentryconfig for backward compatibility.

Jump to

Keyboard shortcuts

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