action

package
v0.4.37 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TypeFolder    = &Type{Key: "", Title: "Folder", Icon: "folder", Description: "holds other actions, like a folder"}
	TypeStatic    = &Type{Key: "static", Title: "Static", Icon: "image", Description: "returns HTML for rendering"}
	TypeSeparator = &Type{Key: "separator", Title: "Separator", Icon: "handle", Description: "a separator, used between other items"}

	TypeAll      = &Type{Key: "all", Title: "All Sources", Icon: "world", Description: "provides actions for each source in the system"}
	TypeSource   = &Type{Key: "source", Title: "Source", Icon: "location", Description: "provides actions for each model in the source"}
	TypePackage  = &Type{Key: "package", Title: "Package", Icon: "tag", Description: "provides actions for a package contained in a source"}
	TypeModel    = &Type{Key: "model", Title: "Model", Icon: "file-text", Description: "provides actions for a model contained in a source"}
	TypeActivity = &Type{Key: "activity", Title: "Activity", Icon: "happy", Description: "provides actions for a specific activity"}

	TypeTest    = &Type{Key: "test", Title: "Test", Icon: "star", Description: "a test action, who knows what it'll do"}
	TypeUnknown = &Type{Key: "unknown", Title: "Unknown", Icon: "star", Description: "an unknown action type"}
)
View Source
var RootAction = &Action{TypeKey: TypeFolder.Key, Config: util.ValueMap{}}

Functions

func GetItem

func GetItem(act *Action, schemata schema.Schemata, key string) (any, []string, error)

func GetModel

func GetModel(act *Action, schemata schema.Schemata) (*model.Model, []string, error)

func GetPackage

func GetPackage(act *Action, schemata schema.Schemata) (*model.Package, []string, error)

func GetSource

func GetSource(act *Action, schemata schema.Schemata) (*model.Package, error)

Types

type Action

type Action struct {
	Key         string        `json:"key,omitempty"`
	TypeKey     string        `json:"type,omitempty"`
	Title       string        `json:"title,omitempty"`
	Description string        `json:"description,omitempty"`
	Icon        string        `json:"icon,omitempty"`
	Children    Actions       `json:"children,omitempty"`
	Pkg         util.Pkg      `json:"-"` // injected
	Config      util.ValueMap `json:"config,omitempty"`
}

func (*Action) Clone

func (a *Action) Clone(pkg util.Pkg, kids Actions) *Action

func (*Action) ConfigString

func (a *Action) ConfigString() string

func (*Action) IconWithFallback

func (a *Action) IconWithFallback() string

func (*Action) Name

func (a *Action) Name() string

func (*Action) Path

func (a *Action) Path() []string

func (*Action) Size

func (a *Action) Size() int

func (*Action) String

func (a *Action) String() string

func (*Action) Type

func (a *Action) Type() *Type

type Actions

type Actions []*Action

func ReorderActions

func ReorderActions(acts Actions, orderings Orderings) (Actions, error)

func (Actions) CleanKeys

func (a Actions) CleanKeys()

func (Actions) Cleanup

func (a Actions) Cleanup()

func (Actions) Clone

func (a Actions) Clone() Actions

func (Actions) Find

func (a Actions) Find(key string) *Action

func (Actions) Get

func (a Actions) Get(paths []string) (*Action, []string)

func (Actions) Size

func (a Actions) Size() int

type Ordering

type Ordering struct {
	Key          string    `json:"k"`
	Title        string    `json:"t"`
	OriginalPath string    `json:"p"`
	Children     Orderings `json:"c,omitempty"`
}

type Orderings

type Orderings []*Ordering

func (Orderings) Find

func (a Orderings) Find(key string) *Ordering

func (Orderings) Get

func (a Orderings) Get(paths []string) (*Ordering, []string)

type Type

type Type struct {
	Key         string
	Title       string
	Icon        string
	Description string
}

func TypeFromString

func TypeFromString(s string) (*Type, error)

func (Type) ConfigString

func (t Type) ConfigString(cfg util.ValueMap) string

func (*Type) String

func (t *Type) String() string

Jump to

Keyboard shortcuts

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